minor regression after patching

Dimitry Andric dim at FreeBSD.org
Wed Dec 28 00:03:47 UTC 2011


On 2011-12-27 11:36, Volodymyr Kostyrko wrote:
...
> Yes. I have set up a chrooted environment to retest. Config files are:
>
> === /etc/make.conf
> # vim:set ft=make:
>
> #CPUTYPE?=native
> INSTALL:=install -C
> KERNCONF?=MINIMAL
> NO_CLEAN:=yes
> WITHOUT_NOUVEAU:=yes
> WRKDIRPREFIX=/tmp/ports
>
> .if (empty(.CURDIR:N*/usr/src/*) || empty(.CURDIR:N*/usr/obj/*))&&
> !defined(NOCCACHE)

The problem is this test, it doesn't return true when you are exactly in
/usr/src.  The result is that clang doesn't get built in the cross-tools
stage, and /usr/bin/clang is used instead for the rest of the world.

This clang will include files from /usr/include, and link with libs from
/usr/lib, causing the problem you are seeing.

You could write the test as follows instead:

   .if ${.CURDIR:M/usr/src} || ${.CURDIR:M/usr/src/*} || ${.CURDIR:M/usr/obj} || ${.CURDIR:M/usr/obj/*}

or if you insist on using empty():

   .if !empty(.CURDIR:M/usr/src) || !empty(.CURDIR:M/usr/src/*) || !empty(.CURDIR:M/usr/obj) || !empty(.CURDIR:M/usr/obj/*)

or any other form which includes /usr/src and /usr/obj 'top level' in
addition to /usr/src/* and /usr/obj/*.  If you don't care about
strictness, you could just use:

   .if ${.CURDIR:M/usr/src*} || ${.CURDIR:M/usr/obj*}


...
>     CC:=${CC:C,^cc$,clang,1}
>     CXX:=${CXX:C,^c\+\+$,clang++,1}
>     CPP:=${CPP:C,^cpp$,clang -E,}
>     NO_WERROR:=
>     WERROR:=

Here, it is better to use the idiom mentioned on:

   http://wiki.freebsd.org/BuildingFreeBSDWithClang

e.g.:

   .if !defined(CC) || ${CC} == "cc"
   CC=clang
   .endif
   .if !defined(CXX) || ${CXX} == "c++"
   CXX=clang++
   .endif
   .if !defined(CPP) || ${CPP} == "cpp"
   CPP=clang-cpp
   .endif

I know it looks ugly, but it is required for stable/9, because I was not
given permission to MFC r227120 yet, which fixes this, so you can just
use:

   CC=clang
   CXX=clang++
   CPP=clang-cpp

instead.


More information about the freebsd-stable mailing list