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: Entering directory
if gcc -DHAVE_CONFIG_H -I. -I. -I../../src -Wall -Wpointer-arith
-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
-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: *** [makekeys-makekeys.o] Error 1
make: Leaving directory
make: *** [../src/util/makekeys] Error 2
make: 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.
Phil, I believe this is your doing.
I know we talked about it once. What is the correct fix?
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.
Well, we already depend on some pretty recent versions of tools; if we
have to update one more, so be it.
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 @@
+# evil hack
+LIBTOOL = @LIBTOOL@ --tag=CC
-#override CC = gcc
-LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+# makekeys_CFLAGS=$(X11_CFLAGS) $(BIGREQS_CFLAGS)
This was fixed at some point since I know it works for me.