Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Dec 2011 01:03:44 +0100
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Volodymyr Kostyrko <c.kworr@gmail.com>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: minor regression after patching
Message-ID:  <4EFA5CE0.6040203@FreeBSD.org>
In-Reply-To: <4EF99F93.9000405@gmail.com>
References:  <4EF88D7B.4040600@gmail.com> <CAE-mSOJx51E%2BcMGy_UytDtDBdujnzM2ZEXBBqFRTgC2VCaucng@mail.gmail.com> <4EF8E21E.10401@gmail.com> <4EF92639.8070903@FreeBSD.org> <4EF99F93.9000405@gmail.com>

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4EFA5CE0.6040203>