Re: USE_GCC and CC=clang

2012-01-09 Thread b. f.
 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 %


This problem only arises if the base compiler is gcc 4.2.x and
USE_GCC=4.2+. Otherwise CC will be set to the appropriate gcc
compiler.  Since Gerald (who maintains ports/Mk/bsd.gcc.mk) is trying
to retire lang/gcc42 anyway, it is not a good idea to set USE_GCC=4.2+
in a port.

 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 problem is due to a slight flaw in the implementation of the
USE_GCC=4.2+ case, which will be obviated soon by the removal of this
case. If in the meantime a change is made to bsd.gcc.mk, it should
address this flaw directly -- by setting CC=gcc explicitly where
needed, instead of relying upon the default setting of CC.  Another
knob is unnecessary.

Note that changes to bsd.gcc.mk, good or bad, won't address the cases
where a user sets CC on the command-line via make  CC= ..., or
adds it to MAKE_ARGS, or sets CC in the environment, and then calls
make with -e or -E CC.  So the right thing to do is to add
something like:

.if !empty(CC:M*clang*)
IGNORE= : clang cannot be used to build this port
.endif

to the port Makefile, after the inclusion of bsd.port.options.mk or
bsd.port.pre.mk (since a user may have set CC in Makefile.local,
Makefile.inc, etc).  Or, better yet, to patch the port so that it can
be built with clang (which may have to be done anyway...).

Regards,

b.
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: USE_GCC and CC=clang

2012-01-09 Thread Wesley Shields
On Mon, Jan 09, 2012 at 06:22:58PM +, b. f. wrote:
  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 %
 
 
 This problem only arises if the base compiler is gcc 4.2.x and
 USE_GCC=4.2+. Otherwise CC will be set to the appropriate gcc
 compiler.  Since Gerald (who maintains ports/Mk/bsd.gcc.mk) is trying
 to retire lang/gcc42 anyway, it is not a good idea to set USE_GCC=4.2+
 in a port.

Thanks for the pointer.

  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 problem is due to a slight flaw in the implementation of the
 USE_GCC=4.2+ case, which will be obviated soon by the removal of this
 case. If in the meantime a change is made to bsd.gcc.mk, it should
 address this flaw directly -- by setting CC=gcc explicitly where
 needed, instead of relying upon the default setting of CC.  Another
 knob is unnecessary.
 
 Note that changes to bsd.gcc.mk, good or bad, won't address the cases
 where a user sets CC on the command-line via make  CC= ..., or
 adds it to MAKE_ARGS, or sets CC in the environment, and then calls
 make with -e or -E CC.  So the right thing to do is to add
 something like:
 
 .if !empty(CC:M*clang*)
 IGNORE= : clang cannot be used to build this port
 .endif
 
 to the port Makefile, after the inclusion of bsd.port.options.mk or
 bsd.port.pre.mk (since a user may have set CC in Makefile.local,
 Makefile.inc, etc).  Or, better yet, to patch the port so that it can
 be built with clang (which may have to be done anyway...).

I was hoping to not have to set IGNORE if using clang. I'm also not
really interested in patching the port, since it's more about structural
changes than a simple fixes.

I guess I'll set the IGNORE line if using clang for now. No point in
wasting cycles on a port which won't compile for a long time, if ever.

-- WXS
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


USE_GCC and CC=clang

2012-01-08 Thread Wesley Shields
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@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@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@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@ack spamdyke % 

-- WXS
Index: bsd.gcc.mk
===
RCS file: /ncvs/ports/Mk/bsd.gcc.mk,v
retrieving revision 1.62
diff -u -r1.62 bsd.gcc.mk
--- bsd.gcc.mk	12 Nov 2011 22:03:55 -	1.62
+++ bsd.gcc.mk	9 Jan 2012 01:58:55 -
@@ -181,7 +181,7 @@
 # dependencies, CC, CXX, CPP, and flags.
 .for v in ${GCCVERSIONS}
 . if ${_USE_GCC} == ${_GCCVERSION_${v}_V}
-.  if ${OSVERSION}  ${_GCCVERSION_${v}_L} || ${OSVERSION}  ${_GCCVERSION_${v}_R}
+.  if ${OSVERSION}  ${_GCCVERSION_${v}_L} || ${OSVERSION}  ${_GCCVERSION_${v}_R} || defined(GCC_REQUIRED)
 V:=			${_GCCVERSION_${v}_V:S/.//}
 _GCC_BUILD_DEPENDS:=	gcc${V}
 _GCC_PORT_DEPENDS:=	gcc${V}
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org