Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails with meson 1.2 #612

Closed
antonio-rojas opened this issue Jul 26, 2023 · 8 comments
Closed

Build fails with meson 1.2 #612

antonio-rojas opened this issue Jul 26, 2023 · 8 comments

Comments

@antonio-rojas
Copy link

 * Xreader version 3.8.2
 * Distribution - Arch Linux

Issue
Build fails with meson 1.2

FAILED: shell/xreader 
cc  -o shell/xreader shell/xreader.p/main.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,--whole-archive -Wl,--start-group shell/libshell.a -Wl,--no-whole-archive -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -g -ffile-prefix-map=/build/xreader/src=/usr/src/debug/xreader '-Wl,-rpath,$ORIGIN/../libview:$ORIGIN/../libdocument' -Wl,-rpath-link,/build/xreader/src/build/libview -Wl,-rpath-link,/build/xreader/src/build/libdocument libview/libxreaderview.so.3.0.0 libdocument/libxreaderdocument.so.3.0.0 /usr/lib/libgio-2.0.so /usr/lib/libgobject-2.0.so /usr/lib/libglib-2.0.so /usr/lib/libgtk-3.so /usr/lib/libgdk-3.so /usr/lib/libz.so /usr/lib/libpangocairo-1.0.so /usr/lib/libpango-1.0.so /usr/lib/libharfbuzz.so /usr/lib/libatk-1.0.so /usr/lib/libcairo-gobject.so /usr/lib/libcairo.so /usr/lib/libgdk_pixbuf-2.0.so /usr/lib/libsecret-1.so -lm /usr/lib/libxapp.so -Wl,--end-group
/usr/bin/ld: shell/../cut-n-paste/totem-screensaver/libtotemscrsaver.a.p/totem-scrsaver.c.o: undefined reference to symbol 'XUnlockDisplay'
/usr/bin/ld: /usr/lib/libX11.so.6: error adding symbols: DSO missing from command line

Steps to reproduce

meson xreader build --prefix=/usr -Dmathjax-directory=/usr/share/mathjax2
meson compile -C build

Expected behaviour
Builds

Other information

@mtwebster
Copy link
Member

Does adding this line help?

diff --git a/cut-n-paste/totem-screensaver/totem-scrsaver.c b/cut-n-paste/totem-screensaver/totem-scrsaver.c
index 92ea6bb..a508c76 100644
--- a/cut-n-paste/totem-screensaver/totem-scrsaver.c
+++ b/cut-n-paste/totem-screensaver/totem-scrsaver.c
@@ -32,6 +32,7 @@
 #ifdef GDK_WINDOWING_X11
 #include <gdk/gdkx.h>
 #include <X11/keysym.h>
+#include <X11/Xlib.h>
 
 #ifdef HAVE_XTEST
 #include <X11/extensions/XTest.h>

@antonio-rojas
Copy link
Author

Does adding this line help?

No

@antonio-rojas
Copy link
Author

This is the meson change that breaks it:

mesonbuild/meson@a78af23

From our meson maintainer: "They're using link_whole all over the place, which doesn't carry dependencies properly". Downstream report: https://bugs.archlinux.org/task/79203

@leigh123linux
Copy link
Contributor

It has missing link requirements.
It builds if I add -lX11 -lICE -lSM

%build
LDFLAGS+=' -lX11 -lICE -lSM'
%meson	\
 -Ddeprecated_warnings=false \
 -Ddjvu=true \
 -Ddvi=true \
 -Dt1lib=true \
 -Dpixbuf=true \
 -Dcomics=true \
 -Dintrospection=true \
 -Dhelp_files=true

%meson_build

@leigh123linux
Copy link
Contributor

leigh123linux commented Jul 26, 2023

meson-1.2.0



[361/361] gcc  -o shell/xreader shell/xreader.p/main.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,--whole-archive -Wl,--start-group shell/libshell.a -Wl,--no-whole-archive -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer '-Wl,-rpath,$ORIGIN/../libview:$ORIGIN/../libdocument' -Wl,-rpath-link,/home/leigh/rpmbuild/BUILD/xreader-3.8.1/redhat-linux-build/libview -Wl,-rpath-link,/home/leigh/rpmbuild/BUILD/xreader-3.8.1/redhat-linux-build/libdocument libview/libxreaderview.so.3.0.0 libdocument/libxreaderdocument.so.3.0.0 /usr/lib64/libgio-2.0.so /usr/lib64/libgobject-2.0.so /usr/lib64/libglib-2.0.so /usr/lib64/libgtk-3.so /usr/lib64/libgdk-3.so /usr/lib64/libz.so /usr/lib64/libpangocairo-1.0.so /usr/lib64/libpango-1.0.so /usr/lib64/libharfbuzz.so /usr/lib64/libatk-1.0.so /usr/lib64/libcairo-gobject.so /usr/lib64/libcairo.so /usr/lib64/libgdk_pixbuf-2.0.so /usr/lib64/libsecret-1.so -lm /usr/lib64/libxapp.so -Wl,--end-group

Old meson (includes paths for /usr/lib64/libX11.so /usr/lib64/libICE.so /usr/lib64/libSM.so)

[359/361] gcc  -o shell/xreader shell/xreader.p/main.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,--whole-archive -Wl,--start-group shell/libshell.a -Wl,--no-whole-archive -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer '-Wl,-rpath,$ORIGIN/../libview:$ORIGIN/../libdocument' -Wl,-rpath-link,/builddir/build/BUILD/xreader-3.8.1/redhat-linux-build/libview -Wl,-rpath-link,/builddir/build/BUILD/xreader-3.8.1/redhat-linux-build/libdocument libview/libxreaderview.so.3.0.0 libdocument/libxreaderdocument.so.3.0.0 libmisc/libmisc.a cut-n-paste/totem-screensaver/libtotemscrsaver.a cut-n-paste/smclient/libsmclient.a cut-n-paste/zoom-control/liblibephyzoom.a /usr/lib64/libgio-2.0.so /usr/lib64/libgobject-2.0.so /usr/lib64/libglib-2.0.so /usr/lib64/libgtk-3.so /usr/lib64/libgdk-3.so /usr/lib64/libz.so /usr/lib64/libatk-1.0.so /usr/lib64/libpangocairo-1.0.so /usr/lib64/libharfbuzz.so /usr/lib64/libgdk_pixbuf-2.0.so /usr/lib64/libcairo-gobject.so /usr/lib64/libpango-1.0.so /usr/lib64/libcairo.so /usr/lib64/libsecret-1.so -lm /usr/lib64/libxapp.so /usr/lib64/libX11.so /usr/lib64/libICE.so /usr/lib64/libSM.so -Wl,--end-group

@heftig
Copy link

heftig commented Jul 27, 2023

https://pkgbuild.com/~heftig/xreader.diff replaces a lot of uses of link_whole with declared dependencies, which fixes this FTBFS and is IMO a better approach to structuring the build because deps can also carry information about needed include directories and flags.

@mtwebster
Copy link
Member

That patch breaks xreader (at runtime) in Mint 21, I'll have a look when I get some time.

[01:52:16 PM] mtwebster@mintbox3:~/bin> xreader
**
ERROR:../shell/ev-window.c:7699:ev_window_init: assertion failed (error == NULL): The resource at “/org/x/reader/shell/ui/xreader.xml” does not exist (g-resource-error-quark, 0)
Bail out! ERROR:../shell/ev-window.c:7699:ev_window_init: assertion failed (error == NULL): The resource at “/org/x/reader/shell/ui/xreader.xml” does not exist (g-resource-error-quark, 0)
Aborted (core dumped)

@heftig
Copy link

heftig commented Jul 29, 2023

I've updated the patch to use link_whole for the one dependency (on libshell) where this seems to matter, since GResource digs through the symbol table at runtime and we need to ensure the unused-at-link-time gresources are not skipped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants