FYI on aarch64: building and installing devel/aarch64-gcc fails with "Unable to access file" for 6 files
Mark Millard
markmi at dsl-only.net
Thu Apr 20 17:16:58 UTC 2017
On 2017-Apr-20, at 4:55 AM, Alexander Kabaev <kabaev at gmail.com> wrote:
> aarch64-gcc is not a full compiler, but one intended to be used as
> cross toolchain.
I've used powerpc64-xtoolchain-gcc and its powerpc64-gcc
to build modern, libc++ based powerpc64 builds for years,
mostly self-hosted on powerpc64 hardware but also cross
built from amd64.
So I'm familiar with the ???-gcc's and their purpose.
???-gcc is also part of how I test if the code is compliant with
both gcc and clang in a self hosted manor. I've reported various
examples over the years of incompatibilities that had appeared.
> Said that, when built on x86-64, it does have gcov
> and man pages, so this must be an artefact of your build environment or
> your aarch64 setup, as this never was tested when run natively nor was
> it meant to be -
The problem for self hosted is the need to add the
prefixes, such as,
aarch64-unknown-freebsd12.0-
to the names such as:
gcov
gcov-tool
gcov.1.gz
The logic for doing that is conditional on the cross-build status
and the prefix is not added when it is a self-hosted-build (so it
is not a cross build).
But pkg-plist has no such conditional status (using gcov-tool
as an example) :
# grep -R gcov-tool /usr/ports/devel/aarch64-gcc/
/usr/ports/devel/aarch64-gcc/pkg-plist:bin/%%GCC_TARGET%%-gcov-tool
(and for good reasons for pkg-plist). Continuing to use gcov-tool
as an example. . .
From /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/Makefile.in :
GCC_INSTALL_NAME := $(shell echo gcc|sed '$(program_transform_name)')
GCC_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gcc|sed '$(program_transform_name)')
CPP_INSTALL_NAME := $(shell echo cpp|sed '$(program_transform_name)')
GCOV_INSTALL_NAME := $(shell echo gcov|sed '$(program_transform_name)')
GCOV_TOOL_INSTALL_NAME := $(shell echo gcov-tool|sed '$(program_transform_name)')
# grep -R GCOV_TOOL_INSTALL_NAME /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/ | more
/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/Makefile.in:GCOV_TOOL_INSTALL_NAME := $(shell echo gcov-tool|sed '$(program_transform_name)')
/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/Makefile.in: rm -f $(DESTDIR)$(bindir)/$(GCOV_TOOL_INSTALL_NAME)$(exeext); \
/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/Makefile.in: gcov-tool$(exeext) $(DESTDIR)$(bindir)/$(GCOV_TOOL_INSTALL_NAME)$(exeext); \
/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/Makefile.in:$(DESTDIR)$(man1dir)/$(GCOV_TOOL_INSTALL_NAME)$(man1ext): doc/gcov-tool.1 installdirs
/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/.build/gcc/Makefile:GCOV_TOOL_INSTALL_NAME := $(shell echo gcov-tool|sed '$(program_transform_name)')
/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/.build/gcc/Makefile: rm -f $(DESTDIR)$(bindir)/$(GCOV_TOOL_INSTALL_NAME)$(exeext); \
/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/.build/gcc/Makefile: gcov-tool$(exeext) $(DESTDIR)$(bindir)/$(GCOV_TOOL_INSTALL_NAME)$(exeext); \
/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/.build/gcc/Makefile:$(DESTDIR)$(man1dir)/$(GCOV_TOOL_INSTALL_NAME)$(man1ext): doc/gcov-tool.1 installdirs
So when GCOV_TOOL_INSTALL_NAME omits the prefix for self-hosted
the result is incorrect for the pkg-plist .
> there is unfinished work in ports/base to create
> native toolchain.
I'm aware. I've submitted Bugzilla reports 21400 though 214405
against it from attempting to use it and work around some of
its problems.
> Please provide full log of your port build soemwhere, though I will not
> be able to look at it under weekend at the earliest.
I'll deal with sending a compressed copy of my:
~/ports_typescripts/r438677_aarch_xtoolchain_gcc_try-00-typescript
separately later --and off list. But I doubt it will be any
more interesting/useful than the above and below extractions.
> % pkg info -l aarch64-gcc-6.3.0 | grep gcov
> /usr/local/bin/aarch64-unknown-freebsd12.0-gcov
> /usr/local/bin/aarch64-unknown-freebsd12.0-gcov-tool
> /usr/local/lib/gcc/aarch64-unknown-freebsd12.0/6.3.0/plugin/include/gcov-counter.def
> /usr/local/lib/gcc/aarch64-unknown-freebsd12.0/6.3.0/plugin/include/gcov-io.h
> /usr/local/man/man1/aarch64-unknown-freebsd12.0-gcov.1.gz
Using gcov-tool as an example again:
As far as the log goes for mentions of gcov-tool. . .
# grep gcov-tool ~/ports_typescripts/r438677_aarch_xtoolchain_gcc_try-00-typescript | more
c++ -std=gnu++98 -fno-PIE -c -fbracket-depth=512 -DIN_GCC -fno-strict-aliasing -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -I. -I. -I/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc -I/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/. -I/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/../include -I/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/../libcpp/include -I/usr/local/include -I/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/../libdecnumber -I/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/../libdecnumber/dpd -I../libdecnumber -I/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/../libbacktrace -B/usr/local/aarch64-freebsd/bin/ -mcpu=cortex-a53 -DLIBICONV_PLUG -o gcov-tool.o -MT gcov-tool.o -MMD -MP -MF ./.deps/gcov-tool.TPo /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/gcov-tool.c
ESC[0mIn file included from /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/gcov-tool.c:28:
ESC[0mIn file included from /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/gcov-tool.c:28:
ESC[0mIn file included from /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/gcov-tool.c:28:
ESC[0mIn file included from /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/gcov-tool.c:28:
ESC[0mIn file included from /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/gcov-tool.c:28:
ESC[1m/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/gcov-tool.c:490:7: ESC[0mESC[0;1;35mwarning: ESC[0mESC[1mvariable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]ESC[0m
ESC[0mESC[1m/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/gcov-tool.c:495:10: ESC[0mESC[0;1;30mnote: ESC[0muninitialized use occurs hereESC[0m
ESC[0mESC[1m/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/gcov-tool.c:490:3: ESC[0mESC[0;1;30mnote: ESC[0mremove the 'if' if its condition is always trueESC[0m
ESC[0mESC[1m/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/gcov-tool.c:459:10: ESC[0mESC[0;1;30mnote: ESC[0minitialize the variable 'ret' to silence this warningESC[0m
ESC[0mc++ -std=gnu++98 -fbracket-depth=512 -DIN_GCC -fno-strict-aliasing -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H gcov-tool.o libgcov-util.o libgcov-driver-tool.o libgcov-merge-tool.o libcommon.a ../libcpp/libcpp.a ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -o gcov-tool
if [ -f gcov-tool ]; \
rm -f /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/stage/usr/local/bin/gcov-tool; \
gcov-tool /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/stage/usr/local/bin/gcov-tool; \
pkg-static: Unable to access file /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/stage/usr/local/bin/aarch64-unknown-freebsd12.0-gcov-tool:No such file or directory
Note the lack of aarch64-unknown-freebsd12.0- except in the pkg-static message.
> Thanks,
>
> On Wed, 19 Apr 2017 17:09:34 -0700
> Mark Millard <markmi at dsl-only.net> wrote:
>
>> The attempt to build & install devel/aarch64-gcc on a aarch64
>> environment gets (I use WRKDIRPREFIX=/usr/obj/portswork ):
>>
>> ===> Installing for aarch64-gcc-6.3.0
>> ===> Checking if aarch64-gcc already installed
>> ===> Registering installation for aarch64-gcc-6.3.0 as automatic
>> pkg-static: Unable to access
>> file /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/stage/usr/local/bin/aarch64-unknown-freebsd12.0-gcov:No
>> such file or directory pkg-static: Unable to access
>> file /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/stage/usr/local/bin/aarch64-unknown-freebsd12.0-gcov-tool:No
>> such file or directory pkg-static: Unable to access
>> file /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/stage/usr/local/man/man1/aarch64-unknown-freebsd12.0-cpp.1.gz:No
>> such file or directory pkg-static: Unable to access
>> file /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/stage/usr/local/man/man1/aarch64-unknown-freebsd12.0-g++.1.gz:No
>> such file or directory pkg-static: Unable to access
>> file /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/stage/usr/local/man/man1/aarch64-unknown-freebsd12.0-gcc.1.gz:No
>> such file or directory pkg-static: Unable to access
>> file /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/stage/usr/local/man/man1/aarch64-unknown-freebsd12.0-gcov.1.gz:No
>> such file or directory *** Error code 74
>>
>> Stop.
>> make: stopped in /usr/ports/devel/aarch64-gcc
>>
>> ===>>> Installation of aarch64-gcc-6.3.0 (devel/aarch64-gcc) failed
>>
>>
>> A hack before doing a portmaster -CDK lang/aarch64-gcc to continue
>> the build/install is to execute the script shown below (I use
>> WRKDIRPREFIX=/usr/obj/portswork ):
>>
>> # more ~/aarch64-gcc_fixup.sh
>> #!/bin/sh
>> cp
>> -ax /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/.build/gcc/gcov /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/stage/usr/local/bin/aarch64-unknown-freebsd12.0-gcov
>>
>> cp
>> -ax /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/.build/gcc/gcov-tool /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/stage/usr/local/bin/aarch64-unknown-freebsd12.0-gcov-tool
>>
>> gzip
>> -c /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-*/gcc/doc/cpp.1
>>> /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/stage/usr/local/man/man1/aarch64-unknown-freebsd12.0-cpp.1.gz
>>
>> gzip
>> -c /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/.build/gcc/doc/g++.1
>>> /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/stage/usr/local/man/man1/aarch64-unknown-freebsd12.0-g++.1.gz
>>
>> gzip
>> -c /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/.build/gcc/doc/gcc.1
>>> /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/stage/usr/local/man/man1/aarch64-unknown-freebsd12.0-gcc.1.gz
>>
>> gzip
>> -c /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-*/gcc/doc/gcov.1
>>> /usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/stage/usr/local/man/man1/aarch64-unknown-freebsd12.0-gcov.1.gz
>>
>> That puts in place the files that are not where they are expected.
>>
>> Of course this sort of hack-then-continue would not fit well
>> with poudriere use or analogous build techniques.
>>
>>
>> The same sort of thing happens for lang/powerpc64 on a powerpc64
>> environment.
>>
>> As I remember. . .
>> The same sort of thing happens for lang/amd64 on a amd64
>> environment.
>>
>> So I have ~/powerpc64-gcc_fixup.sh and ~/amd64-gcc_fixup.sh
>> as well.
>>
>>
>> I get to these ???-gcc's by trying to install a
>> self-hosted lang/???-xtoolchain-gcc in each case.
>> Such allows for experimenting with self-hosted gcc
>> based system builds that are libc++ based (instead
>> of using gcc 4.2.1).
More information about the freebsd-arm
mailing list