[Mesa-dev] [PATCH 7/7] meson: fix deps and underlinkage of libGL
emil.l.velikov at gmail.com
Fri Dec 1 14:26:41 UTC 2017
On 1 December 2017 at 12:50, Jon Turney <jon.turney at dronecode.org.uk> wrote:
> On 30/11/2017 16:46, Emil Velikov wrote:
>> On 30 November 2017 at 15:13, Jon Turney wrote:
>>> On 29/11/2017 17:34, Dylan Baker wrote:
>>> Maybe it's me that's missing something...
>>> There are references to functions provided by these libraries (xcb_glx,
>>> x11_xcb) in common code.
>> Having a reference to those (as printed by the linker as it errors) should
>> There's a lot of macros guarding the different parts of GLX - the
>> obvious ones GLX_ seem there.
>> Another thing that comes to mind is the libloader_dri3_helper.
>> It should be a noop/empty for non-Linux/BSD but something is going wrong?
> Yes, as I wrote in the bit of my email you snipped, these dependencies come
> via libloader_dri3_helper.
The train of thought had left the station, apologies.
> When configured -Ddri3=false (which is always the case on non-linux
> targets), libGL is underlinked, so this patch is correct.
> Even with this patch applied, mesa fails to build for linux when configured
> with -Ddri3=false, due to various undefined references to libXext:
>> [3/3] Linking target src/glx/libGL.so.1.2.0.
>> FAILED: src/glx/libGL.so.1.2.0
>> cc -o src/glx/libGL.so.1.2.0 'src/glx/GL at sha/src_glx_dummy.c.o'
>> -Wl,--no-undefined -Wl,--as-needed -shared -fPIC -Wl,--start-group
>> -Wl,-soname,libGL.so.1 -Wl,--whole-archive src/glx/libglx.a
>> -Wl,--no-whole-archive src/mapi/glapi/libglapi_static.a
>> src/mapi/shared-glapi/libglapi.so.0.0.0 src/loader/libloader.a
>> src/util/libmesa_util.a src/util/libxmlconfig.a -pthread -Wl,-Bsymbolic
>> -Wl,--gc-sections -ldrm -ldl -lm -Wl,--end-group -lX11 -lxcb-glx -lxcb
>> -lX11-xcb -lX11 -lxcb -lxcb-dri2 -ldrm -lX11 -ldrm -lz -lexpat -lm
Hmm the command line seems rather iffy.
The LDFLAGS/linker flags should not be mixed with LIBADD/library dependencies.
In the above example -Wl,-Bsymbolic and -Wl,--gc-sections is thrown in
between the libraries while the whole thing is wrapped in
Even if that doesn't cause a problem now, it's something to cleanup.
Unrelated nitpick - there is a double "deps_xcb_dri3 = " in meson.build
>> src/glx/libglx.a(dri2.c.o): In function `DRI2CloseDisplay':
>> /home/jon/src/mesa/build/../src/glx/dri2.c:58: undefined reference to
After a lot of of head scratching I noticed what's wrong.
The dependencies of loader_dri3 are off:
dep_xshmfence, dep_xcb_present, dep_xcb_dri3, dep_xcb_sync, dep_x11_xcb,
dep_xext, dep_xdamage, dep_xcb_glx, dep_libdrm,
x11-xcb xcb xcb-dri3 xcb-xfixes xcb-present xcb-sync xshmfence libdrm
So one should really move the following to glx and (ideally) sort the
remaining more like autotools.
dep_xext, dep_xdamage, dep_xcb_glx,
More information about the mesa-dev