Adrian Chadd
2015-11-05 06:01:29 UTC
Hi,
I started digging into why "make installworld" doesn't work when using
the external toolchain support using CROSS_TOOLCHAIN= support. This is
one of the big hurdles to just using 100% external toolchain using
bapt's CROSS_TOOLCHAIN support.
The TL;DR seems to be:
* buildworld/buildkernel: CC gets set right; PATH doesn't include
/usr/bin:/usr/sbin
* installkernel: MACHINE is set, CC is not set (so it's 'cc') and PATH
includes /usr/bin:/usr/sbin
* installworld: MACHINE is set, CC is not set, PATH doesn't include
/usr/bin:/usr/sbin
The result is that during installkernel it finds 'cc' in /usr/bin and
detects it as clang, even though I'm doing a mips-gcc build. During
installworld it fails because it can't find 'cc'.
So! In the short term, is there any way that during
installworld/installkernel we can also set CC, etc appropriately?
Otherwise we're either using the wrong compiler logic/version
(installkernel) or we're just plain not going to work (installworld.)
Also - why is PATH including /usr/bin:/usr/sbin when doing
installkernel, but not installworld?
To reproduce:
* pkg install mips-gcc mips-xtoolchain-gcc mips-binutils
* env MAKEOBJDIRPREFIX=/tmp/mips-obj make CROSS_TOOLCHAIN=mips-gcc
TARGET=mips TARGET_ARCH=mips TARGET_CPUTYPE=mips32
DESTDIR=/tmp/mips-root -j 4 buildworld buildkernel installworld
installkernel KERNCONF=MALTA
...
make[4]: "/usr/home/adrian/work/freebsd/head-embedded-gcc5/src/share/mk/bsd.compiler.mk"
line 50: warning: "machine: mips, X_COMPILER_TYPE: , CC: cc"
make[4]: "/usr/home/adrian/work/freebsd/head-embedded-gcc5/src/share/mk/bsd.compiler.mk"
line 96: warning: "Finished; COMPILER_TYPE=clang,
COMPILER_VERSION=30700, COMPILER_FEATURES=c++11"
.. so in the installkernel setup, the PATH includes /usr/bin which
means 'cc' works, and thus it's detecting the compiler as clang even
though we're supposed to be using mips-gcc.
in the installworld setup, there's no /usr/bin in PATH, so it can't find cc.
buildworld is ok:
make[6]: "/usr/home/adrian/work/freebsd/head-embedded-gcc5/src/share/mk/bsd.compiler.mk"
line 50: warning: "machine: amd64, X_COMPILER_TYPE: , CC: cc"
make[6]: "/usr/home/adrian/work/freebsd/head-embedded-gcc5/src/share/mk/bsd.compiler.mk"
line 96: warning: "Finished; COMPILER_TYPE=clang,
COMPILER_VERSION=30700, COMPILER_FEATURES=c++11"
===> gnu/usr.bin/groff/src/devices/grops (obj)
.. for the local stuff, and:
make[5]: "/usr/home/adrian/work/freebsd/head-embedded-gcc5/src/share/mk/bsd.compiler.mk"
line 50: warning: "machine: mips, X_COMPILER_TYPE: , CC:
/usr/local/bin/mips-portbld-freebsd11.0-gcc -isystem
/home/adrian/work/freebsd/head-embedded-gcc5/src/../obj/mips_ap//mips.mips/usr/home/adrian/work/freebsd/head-embedded-gcc5/src/tmp/usr/include
-L/home/adrian/work/freebsd/head-embedded-gcc5/src/../obj/mips_ap//mips.mips/usr/home/adrian/work/freebsd/head-embedded-gcc5/src/tmp/usr/lib
--sysroot=/home/adrian/work/freebsd/head-embedded-gcc5/src/../obj/mips_ap//mips.mips/usr/home/adrian/work/freebsd/head-embedded-gcc5/src/tmp
-B/usr/local/mips-freebsd/bin/"
make[5]: "/usr/home/adrian/work/freebsd/head-embedded-gcc5/src/share/mk/bsd.compiler.mk"
line 96: warning: "Finished; COMPILER_TYPE=gcc,
COMPILER_VERSION=50200, COMPILER_FEATURES=c++11"
.. for the building mips stuff.
So installkernel works only "by magic" because of PATH, and CC is just
not being set right for installkernel/installworld.
ok, so what now? :)
-adrian
I started digging into why "make installworld" doesn't work when using
the external toolchain support using CROSS_TOOLCHAIN= support. This is
one of the big hurdles to just using 100% external toolchain using
bapt's CROSS_TOOLCHAIN support.
The TL;DR seems to be:
* buildworld/buildkernel: CC gets set right; PATH doesn't include
/usr/bin:/usr/sbin
* installkernel: MACHINE is set, CC is not set (so it's 'cc') and PATH
includes /usr/bin:/usr/sbin
* installworld: MACHINE is set, CC is not set, PATH doesn't include
/usr/bin:/usr/sbin
The result is that during installkernel it finds 'cc' in /usr/bin and
detects it as clang, even though I'm doing a mips-gcc build. During
installworld it fails because it can't find 'cc'.
So! In the short term, is there any way that during
installworld/installkernel we can also set CC, etc appropriately?
Otherwise we're either using the wrong compiler logic/version
(installkernel) or we're just plain not going to work (installworld.)
Also - why is PATH including /usr/bin:/usr/sbin when doing
installkernel, but not installworld?
To reproduce:
* pkg install mips-gcc mips-xtoolchain-gcc mips-binutils
* env MAKEOBJDIRPREFIX=/tmp/mips-obj make CROSS_TOOLCHAIN=mips-gcc
TARGET=mips TARGET_ARCH=mips TARGET_CPUTYPE=mips32
DESTDIR=/tmp/mips-root -j 4 buildworld buildkernel installworld
installkernel KERNCONF=MALTA
...
make[4]: "/usr/home/adrian/work/freebsd/head-embedded-gcc5/src/share/mk/bsd.compiler.mk"
line 50: warning: "machine: mips, X_COMPILER_TYPE: , CC: cc"
make[4]: "/usr/home/adrian/work/freebsd/head-embedded-gcc5/src/share/mk/bsd.compiler.mk"
line 96: warning: "Finished; COMPILER_TYPE=clang,
COMPILER_VERSION=30700, COMPILER_FEATURES=c++11"
.. so in the installkernel setup, the PATH includes /usr/bin which
means 'cc' works, and thus it's detecting the compiler as clang even
though we're supposed to be using mips-gcc.
in the installworld setup, there's no /usr/bin in PATH, so it can't find cc.
buildworld is ok:
make[6]: "/usr/home/adrian/work/freebsd/head-embedded-gcc5/src/share/mk/bsd.compiler.mk"
line 50: warning: "machine: amd64, X_COMPILER_TYPE: , CC: cc"
make[6]: "/usr/home/adrian/work/freebsd/head-embedded-gcc5/src/share/mk/bsd.compiler.mk"
line 96: warning: "Finished; COMPILER_TYPE=clang,
COMPILER_VERSION=30700, COMPILER_FEATURES=c++11"
===> gnu/usr.bin/groff/src/devices/grops (obj)
.. for the local stuff, and:
make[5]: "/usr/home/adrian/work/freebsd/head-embedded-gcc5/src/share/mk/bsd.compiler.mk"
line 50: warning: "machine: mips, X_COMPILER_TYPE: , CC:
/usr/local/bin/mips-portbld-freebsd11.0-gcc -isystem
/home/adrian/work/freebsd/head-embedded-gcc5/src/../obj/mips_ap//mips.mips/usr/home/adrian/work/freebsd/head-embedded-gcc5/src/tmp/usr/include
-L/home/adrian/work/freebsd/head-embedded-gcc5/src/../obj/mips_ap//mips.mips/usr/home/adrian/work/freebsd/head-embedded-gcc5/src/tmp/usr/lib
--sysroot=/home/adrian/work/freebsd/head-embedded-gcc5/src/../obj/mips_ap//mips.mips/usr/home/adrian/work/freebsd/head-embedded-gcc5/src/tmp
-B/usr/local/mips-freebsd/bin/"
make[5]: "/usr/home/adrian/work/freebsd/head-embedded-gcc5/src/share/mk/bsd.compiler.mk"
line 96: warning: "Finished; COMPILER_TYPE=gcc,
COMPILER_VERSION=50200, COMPILER_FEATURES=c++11"
.. for the building mips stuff.
So installkernel works only "by magic" because of PATH, and CC is just
not being set right for installkernel/installworld.
ok, so what now? :)
-adrian