-
Notifications
You must be signed in to change notification settings - Fork 16
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
smalloc-sys
- Allow libatomic
to be statically linked
#187
Comments
I remember |
@SchrodingerZhu I'm not actually sure designation is required. Currently I can remove dylib for everything I can test and the build work fine with new version. maybe we can make more liberal |
Revisiting the problem, I think it is correct NOT to enforce dynlib. If the platform ships The "potential non-static" requirement was actually something I was told years ago by a linux packager when I trying to make full static linkage, which made me give up my attempt. Indeed, archlinux distro only ships the shared library by default:
Ideally, I don't think we should even link against it if users know that their program is to run only on modern enough hardware.
I don't think any of the symbol is really needed for |
Problem
libatomic
is forced to link dynamically, preventing static builds. Is there a reason for this?Reproduction
Failure linking
libatomic.so
:libatomic.a
is available:Adding to the
RUSTFLAGS
ENV value with-C link-arg=/usr/lib/libatomic.a
,-L /usr/lib -l static=atomic
, or-C prefer-dynamic=no
all fail to get this library linked statically.Cause
This is also the case with snmalloc?
cc:
snmalloc-rs/snmalloc-sys/build.rs
Lines 131 to 137 in a564ef9
cmake:
snmalloc-rs/snmalloc-sys/build.rs
Line 290 in a564ef9
snmalloc-rs/snmalloc-sys/build.rs
Lines 295 to 298 in a564ef9
Reference -
mimalloc-sys
For the
mimalloc-sys
rust crate this was resolved with an additional conditional (related report, associated issue/PR was resolved in May 2024):However the use of
dylib
forced dynamically linking the library breaking support for static builds. That was fixed in June 2024.The text was updated successfully, but these errors were encountered: