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

Static build fails on linux #245

Open
bog-dan-ro opened this issue Mar 18, 2021 · 2 comments
Open

Static build fails on linux #245

bog-dan-ro opened this issue Mar 18, 2021 · 2 comments

Comments

@bog-dan-ro
Copy link

I tried to build epoxy as a static library (-Ddefault_library=static) but it fails to link:

$ ninja 
[31/56] Compiling C object test/glx_static.p/glx_static.c.o
../test/glx_static.c: In function ‘main’:
../test/glx_static.c:58:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   58 |     Display *dpy = get_display_or_skip();
      |     ^~~~~~~
[40/56] Linking target test/glx_static
FAILED: test/glx_static 
cc  -o test/glx_static test/glx_static.p/glx_static.c.o -Wl,--as-needed -Wl,--no-undefined -Wl,--start-group test/libglx_common.a src/libepoxy.a -static -ldl /usr/lib/x86_64-linux-gnu/libX11.so -Wl,--end-group
/usr/bin/ld: src/libepoxy.a(dispatch_common.c.o): in function `get_dlopen_handle':
/home/bogdan/work/gtk/gtk/subprojects/libepoxy/b/../src/dispatch_common.c:312: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: attempted static link of dynamic object `/usr/lib/x86_64-linux-gnu/libX11.so'
collect2: error: ld returned 1 exit status
[56/56] Linking target test/glx_beginend
ninja: build stopped: subcommand failed.
@rubyFeedback
Copy link

I sometimes have this problem specifically with meson/ninja. Not sure if this is related to the issue here
but I remember having had projects with GNU configure that could be built static, but the meson/ninja
way failed.

@m3t4f1v3
Copy link

m3t4f1v3 commented Mar 12, 2022

add "static: true" to the dependency lines eg.
gl_dep = dependency('gl', required: false, static: true)

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

3 participants