This patch was already sent to <dri-de...@lists.sourceforge.net>.
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?
Thank you.

Kind Regards,
- Sedat -

P.S.:
The maintainer of fdm Debian package pointed me to his patch on #grml.

[1] 
http://wiki.debian.org/qa.debian.org/FTBFS#A2009-11-02Packagesfailingbecausebinutils-gold.2BAC8-indirectlinking
[2] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=554767
[3] 
http://github.com/ft/debian_fdm/blob/master/debian/patches/04support_gold.diff
From cfad25a602520b872171ed36b16780308d548813 Mon Sep 17 00:00:00 2001
From: Sedat Dilek <sedat.di...@gmail.com>
Date: Thu, 12 Nov 2009 11:24:45 +0100
Subject: [PATCH] xdemos: Add X11 and pthread linking options to satisfy GNU gold

---
 progs/xdemos/Makefile |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/progs/xdemos/Makefile b/progs/xdemos/Makefile
index 53e1c54..5ffe271 100644
--- a/progs/xdemos/Makefile
+++ b/progs/xdemos/Makefile
@@ -8,6 +8,9 @@ INCDIR = $(TOP)/include
 
 LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME)
 
+# WorksForMe: Add X11 and pthread (glthreads.c) linking options to satisfy GNU gold. -dileX
+APP_LIB_DEPS = -lX11 -lpthread
+
 LIBS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(APP_LIB_DEPS)
 
 PROGS = \
-- 
1.6.3.1

------------------------------------------------------------------------------
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
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to