From owner-freebsd-questions@FreeBSD.ORG Sun Apr 1 13:05:53 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A792106566C for ; Sun, 1 Apr 2012 13:05:53 +0000 (UTC) (envelope-from conrads@cox.net) Received: from eastrmfepo102.cox.net (eastrmfepo102.cox.net [68.230.241.214]) by mx1.freebsd.org (Postfix) with ESMTP id E51F38FC0A for ; Sun, 1 Apr 2012 13:05:52 +0000 (UTC) Received: from eastrmimpo110.cox.net ([68.230.241.223]) by eastrmfepo103.cox.net (InterMail vM.8.01.04.00 201-2260-137-20101110) with ESMTP id <20120401123532.LFRZ8874.eastrmfepo103.cox.net@eastrmimpo110.cox.net>; Sun, 1 Apr 2012 08:35:32 -0400 Received: from serene.no-ip.org ([98.164.83.206]) by eastrmimpo110.cox.net with bizsmtp id scbX1i0054T5sES02cbXyT; Sun, 01 Apr 2012 08:35:31 -0400 X-CT-Class: Clean X-CT-Score: 0.00 X-CT-RefID: str=0001.0A020208.4F784B93.00E8,ss=1,re=0.000,fgs=0 X-CT-Spam: 0 X-Authority-Analysis: v=1.1 cv=9p1evl5cAK1ZYNWAcfn8X6IfAmCGuOPdFgneQpdUexw= c=1 sm=1 a=RcyhSEpB3QQA:10 a=G8Uczd0VNMoA:10 a=kj9zAlcOel0A:10 a=cRs4AX/51puMaUeRAuoQtw==:17 a=OA2lqS22AAAA:8 a=kviXuzpPAAAA:8 a=zk04QdkTAEZw2nSELvAA:9 a=dYxtzAdCW02grK6ZAiAA:7 a=CjuIK1q_8ugA:10 a=ZZAfTtC2Ym4A:10 a=4vB-4DCPJfMA:10 a=mvgvl5KWo_qByEJ_:21 a=eWmc9Qwu1fPlpH_p:21 a=cRs4AX/51puMaUeRAuoQtw==:117 X-CM-Score: 0.00 Authentication-Results: cox.net; none Received: from cox.net (localhost [127.0.0.1]) by serene.no-ip.org (8.14.5/8.14.5) with ESMTP id q31CZUfv043453; Sun, 1 Apr 2012 07:35:31 -0500 (CDT) (envelope-from conrads@cox.net) Date: Sun, 1 Apr 2012 07:35:25 -0500 From: "Conrad J. Sabatier" To: Robert Huff Message-ID: <20120401073525.1c05bc0f@cox.net> In-Reply-To: <20343.7837.796535.407848@jerusalem.litteratus.org> References: <4F76DD24.4060104@herveybayaustralia.com.au> <20120331135624.GA46283@ozzmosis.com> <20343.7837.796535.407848@jerusalem.litteratus.org> X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.6; amd64-portbld-freebsd10.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: FreeBSD Questions Subject: Re: using clang (was: Re: ps, clang and make variables) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Apr 2012 13:05:53 -0000 On Sat, 31 Mar 2012 11:11:25 -0400 Robert Huff wrote: > > As long as we're talking about clang, I have two questions. > 1) Is there any generic reason why a port compiled with clang > won't work on a world compiled with gcc? No, none that I'm aware of. I've occasionally seen mention of this-or-that port causing problems if built with clang, not always directly, but sometimes affecting other ports that depend on it. > 2) If not, how do I set that up? The "standard" method is to include the following in your /etc/make.conf (also see the comments after this): # # 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 Over a span of several months, I've gradually amassed a list of ports I use myself which either won't build successfully with clang, or have some sort of runtime issues when built with clang (these have a tendency to change over time with new releases of a given port). For these, I've added some "exception" lines to force them to be built either with the base system gcc (4.2) or the lang/gcc port (4.6). Note that these exceptions have to *precede* the previous lines in order for them to override the above clang settings. You can also override the clang settings at the command line by doing "make USE_GCC=4.2 (or 4.2+)" or "make USE_GCC=4.6 (or 4.6+)", for example. If you do do this from the command line, just be sure to be consistent with it, i.e., you don't want to do a "make USE_GCC=4.6 configure" followed by a plain "make" or "make install". Pretty much sure to lead to trouble. :-) Note, too, that none of these exceptions have anything to do with my /usr/src builds. I've been using clang for buildworld and buildkernel for quite some time now. ############################################################### # (need to put this up here before the following clang stuff) # # ports which either won't build using clang, or that have # runtime issues when built with clang # ############################################################## # # 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 seems to need this, for some reason .if target(index) | \ ${.CURDIR:M*/devel/antlr*} | \ ${.CURDIR:M*/devel/google-perftools* } | \ ${.CURDIR:M*/graphics/ImageMagick* } | \ ${.CURDIR:M*/graphics/opencv*} | \ ${.CURDIR:M*/www/libxul*} | \ ${.CURDIR:M*/x11/kdelibs4*} | \ ${.CURDIR:M*/x11-toolkits/swt-devel*} USE_GCC?=4.2 .endif # ports which need *some* version of the GNU compiler (won't build with # clang or have runtime issues if built 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/mpg123*} | \ ${.CURDIR:M*/audio/rosegarden*} | \ ${.CURDIR:M*/databases/virtuoso*} | \ ${.CURDIR:M*/deskutils/kdepimlibs4*} | \ ${.CURDIR:M*/devel/apache-ant*} | \ ${.CURDIR:M*/devel/binutils*} | \ ${.CURDIR:M*/devel/icu*} | \ ${.CURDIR:M*/devel/kdevelop-kde4*} | \ ${.CURDIR:M*/devel/kdevplatform*} | \ ${.CURDIR:M*/devel/log4j*} | \ ${.CURDIR:M*/games/kdegames4*} | \ ${.CURDIR:M*/graphics/tonicpoint-viewer*} | \ ${.CURDIR:M*/java/* } | \ ${.CURDIR:M*/lang/gcc*} | \ ${.CURDIR:M*/math/fftw3*} | \ ${.CURDIR:M*/multimedia/avidemux2*} | \ ${.CURDIR:M*/multimedia/kdemultimedia4*} | \ ${.CURDIR:M*/multimedia/vlc*} | \ ${.CURDIR:M*/multimedia/xbmc*} | \ ${.CURDIR:M*/net/kdenetwork4*} | \ ${.CURDIR:M*/net/mpich2*} | \ ${.CURDIR:M*/net/opal3*} | \ ${.CURDIR:M*/net-p2p/ktorrent*} | \ ${.CURDIR:M*/net-p2p/vuze*} | \ ${.CURDIR:M*/sysutils/lsof*} | \ ${.CURDIR:M*/textproc/docbook-xsl*} | \ ${.CURDIR:M*/textproc/fop*} | \ ${.CURDIR:M*/www/firefox*} | \ ${.CURDIR:M*/x11/kde4-baseapps*} | \ ${.CURDIR:M*/x11/kde4-workspace*} | \ ${.CURDIR:M*/x11/lxpanel*} | \ ${.CURDIR:M*/x11-toolkits/swt*} USE_GCC?=4.6+ .endif Hope this helps somewhat. :-) -- Conrad J. Sabatier conrads@cox.net