Build and install glog port with clang, not gcc

I'm trying to install the port for Google's glog tool on my FreeBSD 10 system, and it appears to be insisting that gcc be used for compiling, not clang, even though I'm insisting that clang be used in my /etc/make.conf:

Code:
CPUTYPE=pentium4
CC=clang
CXX=clang++
CPP=clang-cpp
CXXFLAGS+= -stdlib=libc++
CFLAGS= -O2 -pipe -funroll-loops
COPTFLAGS= -O2 -pipe -funroll-loops
WITH_LIBCPLUSPLUS=yes
WITH_PKGNG=yes
# added by use.perl 2013-05-18 14:46:36
PERL_VERSION=5.16.2

I want to use clang because I'm trying to ensure that libc++ is used when building my ports, not libstdc++. I was able to use clang for installing the gflags port, on which glog depends.

I tried renaming /usr/bin/gcc to /usr/bin/gcc.bak so that the install process wouldn't find gcc and choose to use clang. Instead, the process chose to install the port for gcc, and this install failed when building dependency port binutils.

Is there any way to force the install process to use clang?
 
I'd start by removing these lines
Code:
CXXFLAGS+= -stdlib=libc++
CFLAGS= -O2 -pipe -funroll-loops
COPTFLAGS= -O2 -pipe -funroll-loops
Port maintainers know which flags should (not) be used.
 
kkaos said:
I tried renaming /usr/bin/gcc to /usr/bin/gcc.bak so that the install process wouldn't find gcc and choose to use clang. Instead, the process chose to install the port for gcc, and this install failed when building dependency port binutils.

Is there any way to force the install process to use clang?

Don't do that dirty hack. Instead, set these variables in /etc/make.conf
Code:
WITH_CLANG=yes
WITH_CLANG_EXTRAS=yes
WITH_CLANG_IS_CC=yes
WITHOUT_GCC=yes

See src.conf(5)() for more details.
 
Line 18 in the Makefile forces the port to compile with GCC. That is done as workaround for ports that fail (or at some point failed) to compile with clang. To try anyway use make -DFORCE_BASE_CC_FOR_TESTING install ... which will cause it to respect your CC setting or default to /usr/bin/cc.
 
marwis said:
I'd start by removing these lines
Code:
CXXFLAGS+= -stdlib=libc++
CFLAGS= -O2 -pipe -funroll-loops
COPTFLAGS= -O2 -pipe -funroll-loops
Port maintainers know which flags should (not) be used.

Ok, but I want to make sure libc++ is used for the build, not libstdc++.
 
Back
Top