Sedat Dilek wrote:
This patch was already sent to <[email protected]>.
Forgot to CC mesa3d-dev ML (thanks Julien Cristau for the hint on IRC).

- Sedat -

Hi,

I had some discussion on #grml about using GNU-gold linker instead of
GNU-ld the last days and remembered a problem with mesa.
Some xdemos programs fail to build.

Unfortunately, I found a very old broken build-log from radeon-rewrite
GIT branch:

$ grep glsync 
BROKEN_mesa_7.5+radeon~rewrite+git20090320.407e8ae-1~dileX+1_i386.build
gcc -I../../include  -Wall -g -O2 -Wall -Wmissing-prototypes -std=c99
-ffast-math -fno-strict-aliasing  -fPIC  -DUSE_X86_ASM -DUSE_MMX_ASM
-DUSE_3DNOW_ASM -DUSE_SSE_ASM -D_GNU_SOURCE -DPTHREADS
-DHAVE_POSIX_MEMALIGN -DGLX_USE_TLS -DPTHREADS
-DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DGLX_DIRECT_RENDERING
-DGLX_INDIRECT_RENDERING -DHAVE_ALIAS  glsync.c -L../../glx -lGL  -lm
-o glsync
/usr/bin/ld: /tmp/ccER1LYv.o: in function main:glsync.c:157: error:
undefined reference to 'XOpenDisplay'
/usr/bin/ld: /tmp/ccER1LYv.o: in function main:glsync.c:203: error:
undefined reference to 'XCreateColormap'
/usr/bin/ld: /tmp/ccER1LYv.o: in function main:glsync.c:208: error:
undefined reference to 'XCreateWindow'
/usr/bin/ld: /tmp/ccER1LYv.o: in function main:glsync.c:217: error:
undefined reference to 'XInternAtom'
/usr/bin/ld: /tmp/ccER1LYv.o: in function main:glsync.c:218: error:
undefined reference to 'XSetWMProtocols'
/usr/bin/ld: /tmp/ccER1LYv.o: in function main:glsync.c:220: error:
undefined reference to 'XSetStandardProperties'
/usr/bin/ld: /tmp/ccER1LYv.o: in function main:glsync.c:223: error:
undefined reference to 'XMapRaised'
make[3]: *** [glsync] Error 1

While discovering the changelog of Debian's binutils package and
digging deeper, I came to a link in Debians QA wiki:
Title "2009-11-02 Packages failing because binutils-gold/indirect
linking" (see [1]).

[1] says:
"...A common problem seems to be calls to XOpenDisplay without
directly linking to -lX11, but to a library like Xtst..."

Programs like glthreads.c seems to need "-lpthread" as extra linking-option.

Furthermore, I remember I had a discussion with the debian-x team, but
cannot remember why I did not send this patch earlier.
[1] encouraged me I was on the right track :-).

Could you please comment on this patch?

Here's a revised version.  OK?

-Brian

diff --git a/progs/xdemos/Makefile b/progs/xdemos/Makefile
index 53e1c54..77f6679 100644
--- a/progs/xdemos/Makefile
+++ b/progs/xdemos/Makefile
@@ -8,6 +8,9 @@ INCDIR = $(TOP)/include
 
 LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
 
+# Add X11 and pthread libs to satisfy GNU gold.
+APP_LIB_DEPS += -lX11 -lpthread
+
 LIBS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(APP_LIB_DEPS)
 
 PROGS = \
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to