Bug 175 - a libX11 Makefile overrides CC variable
Summary: a libX11 Makefile overrides CC variable
Alias: None
Product: xorg
Classification: Unclassified
Component: Lib/Xlib (show other bugs)
Version: unspecified
Hardware: All All
: high normal
Assignee: Jim Gettys
QA Contact:
Depends on:
Reported: 2004-02-02 10:01 UTC by J.P. Larocque
Modified: 2011-10-15 17:23 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Description J.P. Larocque 2004-02-02 10:01:11 UTC
In the process of following the X server build instructions at
http://www.freedesktop.org/Software/XserverInstallGuide , I tried compiling
libX11 from a CVS checkout I made this morning.  I'm attempting this on a Debian
Woody system, with both gcc 2.95.4 (named 'gcc') and 3.0.4 (named 'gcc-3.0')
installed.  I'd previously set and exported the variable 'CC' to 'gcc-3.0' in my
shell, before running autogen.sh.  Shortly into executing 'make', this was printed:

cd util; make 
make[2]: Entering directory
if gcc -DHAVE_CONFIG_H -I. -I. -I../../src    -Wall -Wpointer-arith
-Wstrict-prototypes         -Wmissing-prototypes -Wmissing-declarations        
-Wnested-externs -fno-strict-aliasing   
-I/usr/local/stow/fdo-Xproto-cvs20040202/include   -g -O2 -MT
makekeys-makekeys.o -MD -MP -MF ".deps/makekeys-makekeys.Tpo" \                
  -c -o makekeys-makekeys.o `test -f 'makekeys.c' || echo './'`makekeys.c; \ 
then mv -f ".deps/makekeys-makekeys.Tpo" ".deps/makekeys-makekeys.Po"; \    
else rm -f ".deps/makekeys-makekeys.Tpo"; exit 1; \ 
gcc: cannot specify -o with -c or -S and multiple compilations 
make[2]: *** [makekeys-makekeys.o] Error 1 
make[2]: Leaving directory
make[1]: *** [../src/util/makekeys] Error 2 
make[1]: Leaving directory
make: *** [all-recursive] Error 1 

The syntax for the gcc command seemed incorrect, according to the gcc 2.95 man
page.  I noticed one option ('-MT' perhaps) was not mentioned in the gcc 2.95
man page, but was in the gcc 3.0 man page.  I tried running the
previously-failed gcc command with gcc-3.0, and it succeeded.  I commented out
the line 'override CC = gcc' in src/util/Makefile, which seemed to be forcing
the use of 'gcc', and re-ran make.  As far as I can tell, the build completed
successfully--make returned 0 on exit, after several minutes of compiling--but
being new to compiling components of the X11 system myself, I won't be confident
in that conclusion until I'm done building and can run the freedesktop.org X server.

Not being a developer, I have no idea why that line was in the Makefile.in.  If
there isn't a reason for it to be there, I recommend removing it.
Comment 1 Jim Gettys 2004-02-06 09:05:38 UTC
Phil, I believe this is your doing.

I know we talked about it once.  What is the correct fix?
Comment 2 Phil Blundell 2004-02-06 09:41:19 UTC
Yes, this was indeed my doing.  The issue here is that, when cross-compiling, 
the stuff in the "util" directory needs to be built with the host compiler 
rather than the target one.

I gather from the autotools people that, with a sufficiently new version of 
automake, writing "host_PROGRAM" in the Makefile.am ought to cause everything 
to just work.  I'll try this out and see if it does the right thing; if so, the 
offending override of CC can certainly be removed.
Comment 3 Jim Gettys 2004-02-06 10:23:36 UTC
Well, we already depend on some pretty recent versions of tools; if we
have to update one more, so be it.  
Comment 4 Benedikt Spranger 2005-10-09 16:31:09 UTC
This BUG bites me once more while crosscompiling (add to PTXdist)
Maybe the following patch is a acceptable workaraound:
diff -ruN libX11-0.99.0.orig/src/util/Makefile.am libX11-0.99.0/src/util/Makefil
--- libX11-0.99.0.orig/src/util/Makefile.am     2005-08-01 22:15:26.000000000 +0
+++ libX11-0.99.0/src/util/Makefile.am  2005-10-10 01:00:38.836860355 +0200
@@ -1,8 +1,12 @@
 # $XdotOrg$
+# evil hack
-#override CC = gcc
Comment 5 Jeremy Huddleston Sequoia 2011-09-24 20:59:04 UTC
This was fixed at some point since I know it works for me.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.