pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Pkgsrc fails to use system compiler if locale is set



* On 2012-07-16 at 18:10 BST, Emmanuel Kasper wrote:

> On my (Ubuntu Linux 12.04, gcc-4.6, pkgsrc-2012Q2), I noticed that
> many many programms, but not all, where trying to force me to
> boostrap gcc-3 although I had a perfectly working compiler.
> 
> I pinpointed the problem to all makefiles which contains
> "../../mk/compiler.mk"
> 
> After some research I found this mail
> http://mail-index.netbsd.org/pkgsrc-users/2009/07/30/msg010316.html
> which mentions setting LC_ALL=C.
> 
> I did that and suddenly pkgsrc started to use my system compiler.

Please try the attached patch, the problem with packages which include
compiler.mk is that a bunch of variables are not set up at that point,
and so it was not setting LC_ALL=C - thus the grep for 'gcc version'
was dependant upon your locale.

Anyone see a problem with committing this?  _CC has already been set
to the full path to the compiler, so there are no PATH issues, and I
don't see that anything else in ALL_ENV is relevant for this test so
we might as well simplify it.

Regards,

-- 
Jonathan Perkin  -  Joyent, Inc.  -  www.joyent.com
Index: gcc.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/compiler/gcc.mk,v
retrieving revision 1.124
diff -u -r1.124 gcc.mk
--- gcc.mk      13 Jul 2012 16:11:29 -0000      1.124
+++ gcc.mk      16 Jul 2012 19:42:32 -0000
@@ -144,17 +144,8 @@
 .endif
 
 .if !defined(_GCC_VERSION)
-# FIXME: ALL_ENV is not set at this point, so LC_ALL must be set
-# explicitly. In the show-all and show-var targets, it appears
-# nevertheless because "References to undefined variables are not
-# expanded" when using the := operator.
-.  if defined(SETENV)
 _GCC_VERSION_STRING!=  \
-       ( ${PKGSRC_SETENV} ${ALL_ENV} LC_ALL=C ${_CC} -v 2>&1 | ${GREP} 'gcc 
version') 2>/dev/null || ${ECHO} 0
-.  else
-_GCC_VERSION_STRING!=  \
-       ( ${_CC} -v 2>&1 | ${GREP} 'gcc version') 2>/dev/null || ${ECHO} 0
-.  endif
+       ( env LC_ALL=C ${_CC} -v 2>&1 | ${GREP} 'gcc version') 2>/dev/null || 
${ECHO} 0
 .  if !empty(_GCC_VERSION_STRING:Megcs*)
 _GCC_VERSION=  2.8.1           # egcs is considered to be gcc-2.8.1.
 .  elif !empty(_GCC_VERSION_STRING:Mgcc*)


Home | Main Index | Thread Index | Old Index