Fwd: COMPILER_TYPE and installworld

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Fwd: COMPILER_TYPE and installworld

Adrian Chadd-2
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
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: COMPILER_TYPE and installworld

O'Connor, Daniel-2

> On 5 Nov 2015, at 16:31, Adrian Chadd <[hidden email]> wrote:
> 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.)

Why does installworld/kernel care what the compiler type is?

Or is it just something incidental which gets pulled in that complains because it can't work it out? If so perhaps the easiest way would be to add a flag which turns off compiler detection and set it for install*

If install* _do_ need to know the compiler type then, bleh..

--
Daniel O'Connor
"The nice thing about standards is that there
are so many of them to choose from."
 -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C

_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: COMPILER_TYPE and installworld

Adrian Chadd-2
On 4 November 2015 at 23:08, O'Connor, Daniel <[hidden email]> wrote:
>
>> On 5 Nov 2015, at 16:31, Adrian Chadd <[hidden email]> wrote:
>> 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.)
>
> Why does installworld/kernel care what the compiler type is?

There's some stuff that's conditionally compiled based ont he
compiler. Don't ask. :)


-a

> Or is it just something incidental which gets pulled in that complains because it can't work it out? If so perhaps the easiest way would be to add a flag which turns off compiler detection and set it for install*
>
> If install* _do_ need to know the compiler type then, bleh..
>
> --
> Daniel O'Connor
> "The nice thing about standards is that there
> are so many of them to choose from."
>  -- Andrew Tanenbaum
> GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
>
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: COMPILER_TYPE and installworld

Enji Cooper
In reply to this post by O'Connor, Daniel-2

> On Nov 4, 2015, at 23:08, O'Connor, Daniel <[hidden email]> wrote:
>
>
>> On 5 Nov 2015, at 16:31, Adrian Chadd <[hidden email]> wrote:
>> 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.)
>
> Why does installworld/kernel care what the compiler type is?
>
> Or is it just something incidental which gets pulled in that complains because it can't work it out? If so perhaps the easiest way would be to add a flag which turns off compiler detection and set it for install*
>
> If install* _do_ need to know the compiler type then, bleh..

It shouldn’t care. bsd.compiler.mk just has the intelligence of a stump and Makefile.inc1 doesn’t tell bsd.compiler.mk to do otherwise in the distribution/install phases.

If it were up to me, CC would be false when make install* is run from Makefile.inc1.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: COMPILER_TYPE and installworld

Adrian Chadd-2
On 4 November 2015 at 23:46, NGie Cooper <[hidden email]> wrote:

>
>> On Nov 4, 2015, at 23:08, O'Connor, Daniel <[hidden email]> wrote:
>>
>>
>>> On 5 Nov 2015, at 16:31, Adrian Chadd <[hidden email]> wrote:
>>> 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.)
>>
>> Why does installworld/kernel care what the compiler type is?
>>
>> Or is it just something incidental which gets pulled in that complains because it can't work it out? If so perhaps the easiest way would be to add a flag which turns off compiler detection and set it for install*
>>
>> If install* _do_ need to know the compiler type then, bleh..
>
> It shouldn’t care. bsd.compiler.mk just has the intelligence of a stump and Makefile.inc1 doesn’t tell bsd.compiler.mk to do otherwise in the distribution/install phases.
>
> If it were up to me, CC would be false when make install* is run from Makefile.inc1.

I don't mind what people do, I'd just really appreciate some help
fixing this up. I think we're pretty close to being able to transition
mips over to using 100% external toolchain only, and this is the
starting point.

So, what can we do? Pretty please? :)



-adrian
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: COMPILER_TYPE and installworld

Warner Losh
On Thu, Nov 5, 2015 at 9:02 AM, Adrian Chadd <[hidden email]> wrote:

> On 4 November 2015 at 23:46, NGie Cooper <[hidden email]> wrote:
> >
> >> On Nov 4, 2015, at 23:08, O'Connor, Daniel <[hidden email]> wrote:
> >>
> >>
> >>> On 5 Nov 2015, at 16:31, Adrian Chadd <[hidden email]> wrote:
> >>> 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.)
> >>
> >> Why does installworld/kernel care what the compiler type is?
> >>
> >> Or is it just something incidental which gets pulled in that complains
> because it can't work it out? If so perhaps the easiest way would be to add
> a flag which turns off compiler detection and set it for install*
> >>
> >> If install* _do_ need to know the compiler type then, bleh..
> >
> > It shouldn’t care. bsd.compiler.mk just has the intelligence of a stump
> and Makefile.inc1 doesn’t tell bsd.compiler.mk to do otherwise in the
> distribution/install phases.
> >
> > If it were up to me, CC would be false when make install* is run from
> Makefile.inc1.
>
> I don't mind what people do, I'd just really appreciate some help
> fixing this up. I think we're pretty close to being able to transition
> mips over to using 100% external toolchain only, and this is the
> starting point.
>
> So, what can we do? Pretty please? :)
>

Sadly, CC=true (or CC=false) doesn't solve the problem.
The defaults on the system depend, stupidly[*], on the compiler
you are using and it's capabilities. This means you won't install
all the bits that need C++11 to build, for example.

I'm joining this discussion late. What circumstances do we get CC
wrong in install*? For ages, that's been working properly. What
changed? I suspect 'nothing' and this is nothing more than a
pilot error, but it's possible it's a real bug. Most likely it's the
specific flavor of external toolchain that Bapt added isn't quite
setting variables the way it should.

Warner

[*] I've railed against this in the past to no good effect, mind you.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "[hidden email]"