Closed Bug 1828315 Opened 1 year ago Closed 1 year ago

glxtest gets underlinked with -Wl,--as-needed

Categories

(Core :: Widget: Gtk, defect, P3)

Desktop
Linux
defect

Tracking

()

RESOLVED FIXED
114 Branch
Tracking Status
firefox-esr102 --- unaffected
firefox112 --- unaffected
firefox113 --- unaffected
firefox114 --- fixed

People

(Reporter: heftig, Assigned: stransky)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

Arch Linux uses LDFLAGS containing -Wl,--as-needed to avoid overlinking binaries.

Unfortunately, the recently added glxtest binary instead gets underlinked, causing it to fail on Wayland.

> readelf -d /usr/lib/firefox-nightly/glxtest | grep NEEDED
 0x0000000000000001 (NEEDED)             Shared library: [libX11.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libXrandr.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

> /usr/lib/firefox-nightly/glxtest -w
PCI_VENDOR_ID
0x8086
PCI_DEVICE_ID
0x46a6
ERROR
Missing Wayland libraries

glxtest attempts to look up the Wayland symbols using dlsym without loading the Wayland library. It seems the binary expects to get linked against GTK, pulling in the Wayland libraries as transitive dependencies. However, since it does not actually need any of GTK's symbols, --as-needed eliminates the GTK library as unused.

This could be fixed by calling any of GTK's functions, e.g. gtk_check_version.

For comparison, the output of glxtest from an official nightly:

> readelf -d glxtest | grep NEEDED
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libxcb-shm.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libX11-xcb.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libX11.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libxcb.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libXext.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libXrandr.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libXcomposite.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libXcursor.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libXdamage.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libXfixes.so.3]
 0x0000000000000001 (NEEDED)             Shared library: [libXi.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libXtst.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgtk-3.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libgdk-3.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libpangocairo-1.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libpango-1.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libatk-1.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libcairo-gobject.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libcairo.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libgdk_pixbuf-2.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libgio-2.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libgobject-2.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libglib-2.0.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

> ./glxtest -w
PCI_VENDOR_ID
0x8086
PCI_DEVICE_ID
0x46a6
DRI_DRIVER
iris
VENDOR
Intel
RENDERER
Mesa Intel(R) Graphics (ADL GT2)
VERSION
4.6 (Compatibility Profile) Mesa 23.0.2
TFP
TRUE
DRM_RENDERDEVICE
/dev/dri/renderD128
MESA_VENDOR_ID
0x8086
MESA_DEVICE_ID
0x46a6
TEST_TYPE
EGL

Set release status flags based on info from the regressing bug 1787182

:stransky, since you are the author of the regressor, bug 1787182, could you take a look?

For more information, please visit auto_nag documentation.

Flags: needinfo?(stransky)
Assignee: nobody → stransky
Flags: needinfo?(stransky)
Priority: -- → P3
Attachment #9328939 - Attachment description: Bug 1828315 [Linux] Link glxtest with mozgtk r?heftig → Bug 1828315 [Linux] Link glxtest with gtk for MOZ_WAYLAND builds r?heftig
Pushed by stransky@redhat.com:
https://hg.mozilla.org/integration/autoland/rev/d81596574884
[Linux] Link glxtest with gtk for MOZ_WAYLAND builds r=heftig
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 114 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: