USE_GCC and CC=clang

Wesley Shields wxs at FreeBSD.org
Mon Jan 9 02:22:29 UTC 2012


I'm trying to fix a port which absolutely will not build with clang,
since clang does not support the gcc extension used by this port. I set
USE_GCC=4.2+, which is the lowest version of GCC which will work, but it
doesn't properly override CC=clang.

wxs at ack spamdyke % env CC=clang make test-gcc | grep -E "^(CC|USE_GCC)"
USE_GCC=4.2+
CC=clang - CXX=c++ - CPP=cpp - CFLAGS="-O2 -pipe -fno-strict-aliasing"
wxs at ack spamdyke % 

I understand this is probably an acceptable behavior, since if the user
sets CC=clang they are explicitly asking to build with clang. However,
in the case of a port known to not work with clang, and more importantly
not able to be fixed, I was hoping there was a knob I could set that
would forcible override any compiler related environment variables which
may be set. I didn't find one, so I came up with this quick (and poorly
tested) patch to do so.

The patch allows ports to set GCC_REQUIRED=yes which will forcible
override the environment variables. Maybe it makes sense to spit out a
warning message saying "I know you asked me to use clang, but this port
is known to be broken with clang, and will never be fixed so I'm
altering your choice."

Here's the output with the patch applied:

wxs at ack spamdyke % env CC=clang make test-gcc | grep -E "^(CC|USE_GCC)"
USE_GCC=4.2+
CC=gcc42 - CXX=g++42 - CPP=cpp42 - CFLAGS="-O2 -pipe
-Wl,-rpath=/usr/local/lib/gcc42 -fno-strict-aliasing"
wxs at ack spamdyke % 

-- WXS
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bsd.gcc.mk.diff
Type: text/x-diff
Size: 681 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20120109/9750f15d/bsd.gcc.mk.bin


More information about the freebsd-ports mailing list