Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Feb 2012 01:58:40 -0600
From:      "Conrad J. Sabatier" <conrads@cox.net>
To:        Joshua Isom <jrisom@gmail.com>
Cc:        "freebsd-questions@freebsd.org" <freebsd-questions@freebsd.org>
Subject:   Re: Clang and ports
Message-ID:  <20120202015840.69193201@cox.net>
In-Reply-To: <4F2A3E0F.6060707@gmail.com>
References:  <4F2A3E0F.6060707@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 02 Feb 2012 01:41:03 -0600
Joshua Isom <jrisom@gmail.com> wrote:

> I know that build cluster lists some ports that have problems with 
> clang, but it doesn't say if they're tested or not.  I set up a clang 
> jail to test out things before switching to clang for general use.
> When I try running mencoder to encode a file to x264, it seg faults. 
> Changing options doesn't change anything.  A gdb backtrace points to 
> x264 being the problem.  Everything compiles and installs, but the 
> build's useless.  Is clang ready for ports, or is it only safe for 
> kernel/world?

I've been using clang for ports for a while now, and many ports will
build and run just fine using it.

I've been gradually adding to two lists of exceptions in
my /etc/make.conf -- those that absolutely require the base system GNU
compiler (USE_GCC?=4.2) and those that simply need *some* version of
gcc (for which I use gcc46 from ports (USE_GCC?=4.6).  Before defining
CC and friends to use clang, I first list these exceptions (I use
the ?= operator so these can still be overridden from the command
line).  So, the general format is:

#
# default to using clang for all port builds, with the following exceptions
#

# ports which will only build with the base system GNU compiler (4.2)
#
# the "make index" target also needs this

.if target(index) | \
${.CURDIR:M*/graphics/ImageMagick* } | \
${.CURDIR:M*/graphics/opencv*}
USE_GCC?=4.2
.endif

# ports which need *some* version of the GNU compiler (won't build with clang)
# use the highest version of gcc we have installed from ports (4.6)

.if ${.CURDIR:M*/accessibility/jovie*} | \
${.CURDIR:M*/accessibility/kdeaccessibility4*} | \
${.CURDIR:M*/audio/grip*} | \
${.CURDIR:M*/audio/rosegarden*} | \
${.CURDIR:M*/deskutils/kdepimlibs4*} | \
${.CURDIR:M*/devel/icu*} | \
${.CURDIR:M*/games/kdegames4*} | \
${.CURDIR:M*/graphics/dri*} | \
${.CURDIR:M*/lang/gcc*} | \
${.CURDIR:M*/multimedia/avidemux2*} | \
${.CURDIR:M*/multimedia/kdemultimedia4*} | \
${.CURDIR:M*/multimedia/vlc*} | \
${.CURDIR:M*/multimedia/xbmc*} | \
${.CURDIR:M*/net/kdenetwork4*} | \
${.CURDIR:M*/net/opal3*} | \
${.CURDIR:M*/net-p2p/ktorrent*} | \
${.CURDIR:M*/sysutils/lsof*} | \
${.CURDIR:M*/x11/kde4-baseapps*} | \
${.CURDIR:M*/x11/kdelibs4*} | \
${.CURDIR:M*/x11/kde4-workspace*} | \
${.CURDIR:M*/x11/lxpanel*}
USE_GCC?=4.6+
.endif

#
# use clang unless gcc is explicitly required
#

.if !defined(USE_GCC)
.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
.endif

This, of course, doesn't fully address runtime issues, mainly just
build issues, but the same could be done for those, too.

For what it's worth.  :-)

-- 
Conrad J. Sabatier
conrads@cox.net



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