-
Notifications
You must be signed in to change notification settings - Fork 909
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
Support for musl #1818
Comments
Isn't it the case that Either way, I think it's an interesting idea to optionally allow regular (non- |
Hi, just a note for anyone having a problem with this, here is how I get around this: Either run your cargo commands like this: RUSTFLAGS="-C target-feature=-crt-static" cargo build Or put this in [build]
rustflags = ["-C", "target-feature=-crt-static"] |
That indeed does the job, thanks! In my case I didn't have this issue with rustc from my distro repositories but I did with the rustup toolchain. However the |
Winit works with musl for years, though you'd have to do |
I would like to see support for musl
|
what do you mean by that? clearly musl is supported (system install), e.g. alacritty works on alpine for years. |
it crashes on trying to open a window when using musl and attempting to use |
Do you have a system musl or you want to build a static binary with musl on glibc system? because you'd need to build in sysroot. |
I just spent a few hours bashing my head against musl support in wayland-rs, and my conclusion is: it's a mess right now, IMO. The problem, as I understand it:
This issue has been plaguing the Rust community for as long as it has existed. See the countless issues/threads on the interwebz regarding issues building openssl/zlib crates, for example. The openssl crate has mostly put this issue to bed by providing a crate feature to just build the whole damn thing. I think wayland-sys needs the same treatment. I'm going to open an issue upstream now. |
Yet alacritty is packaged on Alpine for like 4 years using all the said stack with zero patches. Please, use the alpine rust toolchain to build.
I never had this issue myself since I dynamically link to musl, if you want full static linking it's not what we support. |
Eh, I sorta alluded to this when I mentioned "full Alpine sysroot" above. The thing is, if your host machine is x86-64 and/or not Alpine Linux, then "use the alpine rust toolchain to build." makes for a pretty poor dev experience if you're iteratively building/testing an app for a musl target. At any rate, my understanding was faulty here. I thought even with FWIW, this does work fine for me:
Perhaps that's worth noting somewhere in docs/wiki? Also the requirement that musl targets will only work for dynamically linked binaries (and thus the RUSTFLAGS above are necessary). I'm happy to contribute some docs somewhere if it's wanted. |
I closed the upstream issue as well. Though I still can't help but wonder if a |
static linking is generally discouraged and keep in mind that you can't static link on Windows/macOS anyway. Keep in mind that a lots of winit based code deals with hardware linking which requires Also, wayland-rs can be used without system library, but you'll be limited in what you can do and winit doesn't support this mode of operation. Maybe static linking of wayland-rs could make sense, but I don't see why it should be done. it's just rust has poor musl support in general. |
Discouraged? By whom? :) I respectfully remind you that Rust statically links binaries by default for musl targets :)
This has not been my experience at all. For a tier 2 platform, I've found Rust support for x64 and arm7/8 musl targets to be rock solid. Its the rust ecosystem support that is often not so great. |
By all people who could package your software, because if e.g. security vulnerability happens dealing with self-build embeded library is really time consuming for everyone. Also, wayland/x11 stuff updates sometimes and you could benefit from certain fixes, but again you'll miss out on all of them. Just use flatpacks if you want to destribute yourself.
Yet they still embed musl during compilation process and force all the distros to patch out musl related stuff, roll their triplets, etc. It gets better, but a lot of distro people still thinks that rust is a bit hostile towards musl dynamic linking, which is default on all distros. |
I got the following error:
It was build using: |
At the moment, it appears that musl targets are not working: rust-windowing/winit#1818 To use gnu, it's necessary to use glib 2.27, for that, cross need to be installed manually from development branch: cross-rs/cross#1510 --------- Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
At the moment, it appears that musl targets are not working: rust-windowing/winit#1818 To use gnu, it's necessary to use glib 2.27, for that, cross need to be installed manually from development branch: cross-rs/cross#1510 --------- Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
The issue with musl is that it does not implement
dlopen
. I don't know how it works with X11, but on wayland,wayland-sys
tries to openlibwayland-client.so
which is not possible.The text was updated successfully, but these errors were encountered: