Follow

/ / static linking question: is it possible to make a statically linked X11 application? Every time I've used a library that uses X11, it has linked to it dynamically or with dlopen, which makes it not possible to use musl (afaik, please educate me if this is not the case).

/usr/lib/libX11.so: undefined reference to `dlopen@GLIBC_2.2.5'

X11 seems *really* married to glibc, damn.

@neon What prevents you from using musl in that case?

@caseyp Well I could statically link with just musl (I think?), but I'm not sure how useful that would be if I'm dynamically linking to other stuff. I suppose the less dynamic linking the better, but I'd just really like to not dynamically link anything.

@neon Not dynamically linking anything gets rough with X, but I know you definitely can. Couldn't tell you how though unfortunately

@caseyp That's good to hear, I won't give up now then 😄

@neon i guess you mean not possible to use musl for it on a glibc system (because x11 libraries are glibc)? afaik dynamic linking itself is possible with musl

@pea Last time I tried compiling a Rust program where I used glutin, which uses dlopen, it threw up an error about using dlopen, so I kinda assumed that musl doesn't support that.

@neon
@pea

musl definitely supports that. not sure what could've gone wrong there.

@ky0ko @pea Oh! I'll defintely try more along those lines then.

@neon ... and get static libs of the whole X11 implementation ? Am I wrong?

@jsa I suppose yeah, I guess the question is more "is that legit?"

@neon re: "X11 seems really married to glibc" — it's most definitely not.

X11 the protocol itself does not care (nor does the overall "X window system") about what libraries you use.

libX11, aka Xlib, may care, but I don't think it does.

/usr/lib/libX11.so, your system's build of Xlib as a shared library linked against glibc, of course does. Precisely because it's your system's build of Xlib as a shared library linked against glibc.

Sign in to participate in the conversation
Neon/Mastodon

@neon's personal instance.