Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Apr 2017 10:10:15 -0700
From:      Mark Millard <markmi@dsl-only.net>
To:        Alexander Kabaev <kabaev@gmail.com>
Cc:        FreeBSD Toolchain <freebsd-toolchain@freebsd.org>, freebsd-arm <freebsd-arm@freebsd.org>
Subject:   Re: FYI on aarch64: building and installing devel/aarch64-gcc fails with "Unable to access file" for 6 files
Message-ID:  <C17D20C5-8A00-4765-ADC4-9F7BD40AACC2@dsl-only.net>
In-Reply-To: <20170420075548.66f6bc4d@kan>
References:  <921E1189-B07D-4BFA-873B-9C2DF195D771@dsl-only.net> <20170420075548.66f6bc4d@kan>

next in thread | previous in thread | raw e-mail | index | archive | help
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. . .

=46rom =
/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/Makefile=
.in :

GCC_INSTALL_NAME :=3D $(shell echo gcc|sed '$(program_transform_name)')
GCC_TARGET_INSTALL_NAME :=3D $(target_noncanonical)-$(shell echo gcc|sed =
'$(program_transform_name)')
CPP_INSTALL_NAME :=3D $(shell echo cpp|sed '$(program_transform_name)')
GCOV_INSTALL_NAME :=3D $(shell echo gcov|sed =
'$(program_transform_name)')
GCOV_TOOL_INSTALL_NAME :=3D $(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 :=3D $(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:GC=
OV_TOOL_INSTALL_NAME :=3D $(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-c=
ounter.def
>        =
/usr/local/lib/gcc/aarch64-unknown-freebsd12.0/6.3.0/plugin/include/gcov-i=
o.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=3Dgnu++98 -fno-PIE -c   -fbracket-depth=3D512 -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/../inc=
lude =
-I/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/../lib=
cpp/include -I/usr/local/include  =
-I/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/../lib=
decnumber =
-I/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/../lib=
decnumber/dpd -I../libdecnumber =
-I/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/../lib=
backtrace  -B/usr/local/aarch64-freebsd/bin/ -mcpu=3Dcortex-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-too=
l.c
ESC[0mIn file included from =
/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/gcov-too=
l.c:28:
ESC[0mIn file included from =
/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/gcov-too=
l.c:28:
ESC[0mIn file included from =
/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/gcov-too=
l.c:28:
ESC[0mIn file included from =
/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/gcov-too=
l.c:28:
ESC[0mIn file included from =
/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/gcov-too=
l.c:28:
=
ESC[1m/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/gcc-6.3.0/gcc/gc=
ov-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=3Dgnu++98    -fbracket-depth=3D512 -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/gc=
ov-tool; \
    gcov-tool =
/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/stage/usr/local/bin/gc=
ov-tool; \
pkg-static: Unable to access file =
/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/stage/usr/local/bin/aa=
rch64-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,
>=20
> On Wed, 19 Apr 2017 17:09:34 -0700
> Mark Millard <markmi at dsl-only.net> wrote:
>=20
>> The attempt to build & install devel/aarch64-gcc on a aarch64
>> environment gets (I use WRKDIRPREFIX=3D/usr/obj/portswork ):
>>=20
>> =3D=3D=3D>  Installing for aarch64-gcc-6.3.0
>> =3D=3D=3D>  Checking if aarch64-gcc already installed
>> =3D=3D=3D>   Registering installation for aarch64-gcc-6.3.0 as =
automatic =20
>> pkg-static: Unable to access
>> file =
/usr/obj/portswork/usr/ports/devel/aarch64-gcc/work/stage/usr/local/bin/aa=
rch64-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/aa=
rch64-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/ma=
n1/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/ma=
n1/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/ma=
n1/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/ma=
n1/aarch64-unknown-freebsd12.0-gcov.1.gz:No
>> such file or directory *** Error code 74
>>=20
>> Stop.
>> make: stopped in /usr/ports/devel/aarch64-gcc
>>=20
>> =3D=3D=3D>>> Installation of aarch64-gcc-6.3.0 (devel/aarch64-gcc) =
failed =20
>>=20
>>=20
>> 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=3D/usr/obj/portswork ):
>>=20
>> # more ~/aarch64-gcc_fixup.sh=20
>> #!/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/aa=
rch64-unknown-freebsd12.0-gcov
>>=20
>> 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/aa=
rch64-unknown-freebsd12.0-gcov-tool
>>=20
>> 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/ma=
n1/aarch64-unknown-freebsd12.0-cpp.1.gz
>>=20
>> 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/ma=
n1/aarch64-unknown-freebsd12.0-g++.1.gz
>>=20
>> 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/ma=
n1/aarch64-unknown-freebsd12.0-gcc.1.gz
>>=20
>> 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/ma=
n1/aarch64-unknown-freebsd12.0-gcov.1.gz
>>=20
>> That puts in place the files that are not where they are expected.
>>=20
>> Of course this sort of hack-then-continue would not fit well
>> with poudriere use or analogous build techniques.
>>=20
>>=20
>> The same sort of thing happens for lang/powerpc64 on a powerpc64
>> environment.
>>=20
>> As I remember. . .
>> The same sort of thing happens for lang/amd64 on a amd64
>> environment.
>>=20
>> So I have ~/powerpc64-gcc_fixup.sh and ~/amd64-gcc_fixup.sh
>> as well.
>>=20
>>=20
>> 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).




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C17D20C5-8A00-4765-ADC4-9F7BD40AACC2>