Glxgears and glxinfo will no longer build in my static-linked environment. I don't know what's changed to cause this since I last updated current (quite some time ago, around about 8.99.32 for both src and xsrc) and built everything, but something has, and I can't quite figure out what to do about it.
Perhaps common "global" variables in TLS aren't being merged by the
linker? Maybe I can/should just turn off -DGLX_USE_TLS for libGL and
libglapi? But why do both libraries define these same variables in
objects that are pulled in? (see below for symbols in likely modules)
$ mynbmake dependall
link glxgears/glxgears
/build/woods/future/current-amd64-amd64-tools/lib/gcc/x86_64--netbsd/8.4.0/../../../../x86_64--netbsd/bin/ld:
/build/woods/future/current-amd64-destdir/usr/X11R7/lib/libglapi.a(u_current.o):(.tbss+0x0):
multiple definition of `_glapi_tls_Context';
/build/woods/future/current-amd64-destdir/usr/X11R7/lib/libGL.a(glxcurrent.o):(.tbss+0x0):
first defined here
/build/woods/future/current-amd64-amd64-tools/lib/gcc/x86_64--netbsd/8.4.0/../../../../x86_64--netbsd/bin/ld:
/build/woods/future/current-amd64-destdir/usr/X11R7/lib/libglapi.a(u_current.o):(.tbss+0x8):
multiple definition of `_glapi_tls_Dispatch';
/build/woods/future/current-amd64-destdir/usr/X11R7/lib/libGL.a(glxcurrent.o):(.tbss+0x8):
first defined here
collect2: error: ld returned 1 exit status
*** Failed target: glxgears
*** Failed command:
/build/woods/future/current-amd64-amd64-tools/bin/x86_64--netbsd-gcc
--sysroot=/build/woods/future/current-amd64-destdir -Wl,-z,relro
-L/build/woods/future/current-amd64-destdir/usr/X11R7/lib
-Wl,-rpath-link,/build/woods/future/current-amd64-destdir/usr/X11R7/lib
-Wl,-rpath,/usr/X11R7/lib -static -o glxgears glxgears.o -lGL -lXxf86vm
-lXfixes -lXdamage -lglapi -ldrm -lpci -lX11-xcb -lxcb-dri2 -lxcb-glx -lXext
-lX11 -lxcb -lXau -lXdmcp -lexpat -lpthread -lm
*** Error code 1
Stop.
nbmake[1]: stopped in
/more/work/woods/m-NetBSD-current/external/mit/xorg/bin/glxgears
*** Failed target: dependall
*** Failed command: cd
"/more/work/woods/m-NetBSD-current/external/mit/xorg/bin/glxgears";
/build/woods/future/current-amd64-amd64-tools/bin/nbmake realall
*** Error code 1
Stop.
nbmake: stopped in
/more/work/woods/m-NetBSD-current/external/mit/xorg/bin/glxgears
Below is the patch for static-linking glxgears/Makefile (the same is
needed for glxinfo, and many similar patches are required throughout
xorg). I had to add -lexpat since the update as well -- it was not
required for 8.99.32.
Index: external/mit/xorg/bin/glxgears/Makefile
===================================================================
RCS file:
/cvs/master/m-NetBSD/main/src/external/mit/xorg/bin/glxgears/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- external/mit/xorg/bin/glxgears/Makefile 18 Dec 2014 06:24:28 -0000
1.4
+++ external/mit/xorg/bin/glxgears/Makefile 2 Jun 2020 03:55:37 -0000
@@ -8,8 +8,8 @@
CPPFLAGS+=${X11FLAGS.THREADS}
-LDADD+= -lGL -lXext -lX11 -lpthread -lm
-DPADD+= ${LIBGL} ${LIBXEXT} ${LIBX11} ${LIBPTHREAD} ${LIBM}
+LDADD+= -lGL -lXxf86vm -lXfixes -lXdamage -lglapi -ldrm -lpci -lX11-xcb
-lxcb-dri2 -lxcb-glx -lXext -lX11 -lxcb -lXau -lXdmcp -lexpat -lpthread -lm
+DPADD+= ${LIBGL} ${LIBXF86VM} ${LIBXFIXES} ${LIBXDAMAGE} ${LIBGLAPI}
${LIBDRM} ${LIBPCI} ${LIBX11_XCB} ${LIBXCB_DRI} ${LIBXCB_GLX} ${LIBXEXT}
${LIBX11} ${LIBXCB} ${LIBXAU} ${LIBXDMCP} ${LIBEXPAT} ${LIBPTHREAD} ${LIBM}
.PATH: ${X11SRCDIR.mesa-demos}/src/xdemos
FYI, here's what's in each module that I think is causing the problems:
libGL.a(glxcurrent.o):
00000000000000a2 t MakeContextCurrent
U _GLOBAL_OFFSET_TABLE_
U __glXInitVertexArrayState
U __glXSendError
0000000000000000 T __glXSetCurrentContext
0000000000000021 T __glXSetCurrentContextNull
0000000000000010 B __glX_tls_Context
0000000000000000 D __glXmutex
U __libc_mutex_lock
U __libc_mutex_unlock
U _glapi_check_multithread
U _glapi_set_context
U _glapi_set_dispatch
0000000000000000 B _glapi_tls_Context
0000000000000008 B _glapi_tls_Dispatch
0000000000000060 b dummyBuffer
0000000000000040 D dummyContext
0000000000000000 b dummyVtable
U glGetString
000000000000004f T glXGetCurrentContext
0000000000000074 T glXGetCurrentDrawable
00000000000000a2 T glXMakeContextCurrent
0000000000000367 T glXMakeCurrent
00000000000000a2 T glXMakeCurrentReadSGI
libglapi.a(u_current.o):
U _GLOBAL_OFFSET_TABLE_
0000000000000017 T _glapi_get_context
0000000000000057 T _glapi_get_dispatch
0000000000000000 B _glapi_tls_Context
0000000000000008 B _glapi_tls_Dispatch
U stub_init_once
U table_noop_array
0000000000000000 T u_current_destroy
0000000000000001 T u_current_init
0000000000000002 T u_current_set_context
000000000000002c T u_current_set_table
--
Greg A. Woods <[email protected]>
Kelowna, BC +1 250 762-7675 RoboHack <[email protected]>
Planix, Inc. <[email protected]> Avoncote Farms <[email protected]>
pgp1N2lyf8yFs.pgp
Description: OpenPGP Digital Signature
