I am having problems with building ports with CLANG, how do you default to GCC?
V/r
Derrick
FreeBSD 10.0-CURRENT #0: Tue Dec 18 11:40:52 EST 2012
V/r
Derrick
FreeBSD 10.0-CURRENT #0: Tue Dec 18 11:40:52 EST 2012
.if !empty(.CURDIR:M/usr/ports/*) && exists(/usr/local/bin/gcc47)
CC=gcc47
CXX=g++47
CPP=cpp47
.endif
USE_GCC=any
.if !empty(.CURDIR:M/usr/ports/*)
CCTESTPATH= ${.CURDIR:S/\/usr\/ports\/build//g}/basecc
PPTESTPATH= ${.CURDIR:S/\/usr\/ports\/build//g}/nopropolice
.endif
VPATH+=/
.if !exists(${PPTESTPATH}) && !empty(.CURDIR:M/usr/ports/*) && empty(.CURDIR:M*/work/*)
CFLAGS+= -fstack-protector-all
.endif
.if !exists(${CCTESTPATH}) && !empty(.CURDIR:M/usr/ports/*) && empty(.CURDIR:M*/work/*)
#.warning make thinks that ${CCTESTPATH} does not exist.
CPUTYPE=<replace with modern cputype for gcc47>
CFLAGS+=<replace with gcc47 specific cflags>
CC=gcc47
CPP=cpp47
CXX=g++47
.endif
Beeblebrox said:If you want a version > gcc42 (like lang/gcc47), then install it from ports and in /etc/make.conf:
Other adjustments needed, details here: http://www.freebsd.org/doc/en/articles/custom-gcc/article.htmlCode:.if !empty(.CURDIR:M/usr/ports/*) && exists(/usr/local/bin/gcc44) CC=gcc47 CXX=g++47 CPP=cpp47 .endif
If you just want to use gcc42 (from world) replace the number accordingly (42 instead of 47). Since clang is the default compiler for world in HEAD (10), I suspect you do not have gcc42 enabled for buildworld (you have no reason to). Since your default compiler is clang, it's better to install a higher version of gcc from ports.
kpa said:
USE_GCC?=any
&& exists(/usr/local/bin/gcc4[B][color="Red"]7[/color][/B])
Have a look at /usr/local/etc/buildflags.conf from sysutils/bsdadminscripts. There is also devel/pkgconf which aims to do the same thing: Per-port settings & preferences for variables to be passed to the build environment. I prefer to use buildflags.conf, but that's just me - so whatever floats your boat. Some example entries from that file:it will always use the default cc, otherwise it will use gcc47 if installed
# ---< general ports settings >-------------
/usr/ports | /usr/ports/*{
# Clustering
FORCE_MAKE_JOBS
MAKE_JOBS_NUMBER= 6
WITH_CPUFLAGS
BUILD_OPTIMIZED
# USE_DISTCC
USE_CCACHE
BUILDFLAGS_GCC= 4.6+
GCC_DEFAULT_VERSION= 4.6+
# USE_GCC= 4.6+ # breaks distcc
# Common settings that are applied to all ports in hope to do some good.
PERL_VERSION= 5.16
PERL_DEFAULT_VERSION= 5.16
PERL_PORT= perl5.16
WITHOUT_IPV6
WITH_GTK2
MYSQL_VERSION= 55
MYSQL_DEFAULT_VERSION= 55
JAVA_OS= native
JAVA_VENDOR= openjdk
JAVA_VERSION= 1.7+
OVERRIDE_JAVA_VERSION= 1.7+
JAVA_PREFERRED_PORTS= JAVA_PORT_NATIVE_OPENJDK_JDK_1_7
OVERRIDE_JAVA_PORT= java/openjdk7
# ---< per-port settings >-------------
GNUSTEP_WITH_GCC46= yes
*/some/port1 {!FORCE_MAKE_JOBS !USE_DISTCC !USE_CCACHE}
*/someother/port {BUILDFLAGS_GCC= 42} # If world has gcc42 compiled
*/yetother/port {BUILDFLAGS_GCC= CC} # If world uses clang AND has gcc42 disabled
Is as simple as placing in /etc/make.conf:setting workdir to /usr/ports/build
WRKDIRPREFIX= /pathto/dir
Beeblebrox said:@MINIKHOLM: Glad to help. I overlooked a small typo in my first post, but you have figured that out already. Should be:
@m6tt: There are some simpler ways of getting what you want done in FreeBSD.Code:&& exists(/usr/local/bin/gcc4[B][color="Red"]7[/color][/B])
Have a look at /usr/local/etc/buildflags.conf from sysutils/bsdadminscripts. There is also devel/pkgconf which aims to do the same thing: Per-port settings & preferences for variables to be passed to the build environment. I prefer to use buildflags.conf, but that's just me - so whatever floats your boat. Some example entries from that file:
...
A lot more settings also available. This way there is no need to create separate files in each port's folder. What are you going to do with all those files you created when you upgrade your version one day (say from 9 to 10) and you have to dump your old /usr/ports because you have to bring in the ports tree of the new version?
Is as simple as placing in /etc/make.conf:
...Code:WRKDIRPREFIX= /pathto/dir
Regards.
find /usr/ports -name 'basecc' -exec rm {} \;