Re: 9.0 RC1 linking problem with i386 libs on amd64

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Fri, 28 Oct 2011 20:19:20 +0200
On 2011-10-28 16:41, Dominic Fandrey wrote:
...
> Like that:
> .if ${.CURDIR:M/usr/src} || ${.CURDIR:M/usr/src/*}
> CC=clang
> CXX=clang++
> CPP=clang-cpp
> NO_WERROR=
> WERROR=
> .endif
>
> I had hoped that the .ifdef construction from the wiki was dated. I
> suppose it's emulating setting CC in the environment instead of in
> the make/src.conf.

There are two different problems here.  One is that src.conf is read
relatively late, and only when bsd.own.mk is included.  Therefore,
src.conf is not the right place to put CC, CXX and so on.

The other problem is that the build32 stage uses environment variables
to override CC, CXX, AS and LD for its sub-make (see LIB32WMAKEENV in
Makefile.inc1), adding the necessary flags for 32-bit compilation.

However, since environment variables are in turn overridden by direct
assignments (like via reading make.conf), the 32-bit compilation flags
get lost when you specify any of CC, CXX, AS or LD in make.conf.

This latter problem is what my patch attempts to fix, while changing as
little as possible.

...
> I tried CC?=, but that doesn't work, because apparently make always
> initializes CC before parsing makefiles.

Yes, that is because make implicitly reads sys.mk, which either defines
CC directly, or through reading make.conf.


...
> I didn't try it, though. Your patch works for me.
>
>> I would really like to have this in head, and even stable/9.  It makes
>> it possible to just set CC in make.conf, without .ifdef trickery.  Works
>> nicely for clang, too. :)
>
> Seconded!

If there aren't any objections, I will commit it this weekend.
Received on Fri Oct 28 2011 - 16:19:21 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:19 UTC