Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 08 Sep 2012 12:59:11 +0200
From:      Dimitry Andric <dim@FreeBSD.org>
To:        "O. Hartmann" <ohartman@zedat.fu-berlin.de>
Cc:        Current FreeBSD <freebsd-current@FreeBSD.org>, "O. Hartmann" <ohartman@mail.zedat.fu-berlin.de>, Brooks Davis <brooks@FreeBSD.org>
Subject:   Re: FreeBSD 10.0-CURRENT: CLANG and port/clang weirdness!
Message-ID:  <504B24FF.5070901@FreeBSD.org>
In-Reply-To: <504B033B.4020001@zedat.fu-berlin.de>
References:  <5049C13E.5010808@mail.zedat.fu-berlin.de> <504A0E46.3010306@FreeBSD.org> <504A16BA.7030407@mail.zedat.fu-berlin.de> <20120907170728.GB28113@lor.one-eyed-alien.net> <504B033B.4020001@zedat.fu-berlin.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2012-09-08 10:35, O. Hartmann wrote:
> On 09/07/12 19:07, Brooks Davis wrote:
...
>> FWIW, picking up clang etc from /usr/local should be mostly harmless
>> during the early build stage.  You're actual world will be built with
>> the cross clang.
> ... means, the resulting WORLD and KERNEL is then build by the
> LLVM/CLANG that is residing in /usr/obj/...?

Yes.  This is done so you can build an updated version of the system
compiler during the cross-tools stage, and then build the rest of the
world with this updated compiler.


> But what is with PORTS I build later? They definitely pick up the
> "wrong" clang/clang++.

If your search path has /usr/local/bin before /usr/bin, it will
obviously always pick up the ports-compiled clang, whatever version that
is.

If some other ports explicitly require clang 3.1, there should be a
mechanism to specifically invoke that version, instead of whatever the
first "clang" executable in the search path is.

For now, I think the best solution is to use the following (admittedly
rather kludgy) fragment in /etc/make.conf:

.if ${.CURDIR:M/usr/src*} || ${.CURDIR:M/usr/obj*}
CC=clang
CXX=clang++
CPP=clang-cpp
.else
CC=/usr/bin/clang
CXX=/usr/bin/clang++
CPP=/usr/bin/clang-cpp
.endif

Or alternatively:

.if ${.CURDIR:M/usr/ports*}
CC=/usr/bin/clang
CXX=/usr/bin/clang++
CPP=/usr/bin/clang-cpp
.else
CC=clang
CXX=clang++
CPP=clang-cpp
.endif


>> You're probably looking for WITH_CLANG_EXTRAS.
> I already have that option enabled in my /etc/src.conf. But
> unfortunately, a tool called "llvm-config" and sibblings weren't
> installed, they get installed only with /usr/ports/devel/llvm[-devel].

This is on purpose, at least for now.  The base system should only
contain the clang compiler proper, and none of the LLVM libraries.  The
WITH_CLANG_EXTRAS option is just for getting a few tools that could be
handy, but should not be used by 99% of the users out there.

If you want the whole llvm and/or clang shebang, including the shared
libraries, just install the port.  You can use the lang/clang-devel port
if you want to try out the bleeding edge version.  AFAIK Brooks updates
it regularly.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?504B24FF.5070901>