Re: FreeBSD 10.0-CURRENT: CLANG and port/clang weirdness!

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Sat, 08 Sep 2012 12:59:11 +0200
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.
Received on Sat Sep 08 2012 - 08:59:05 UTC

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