-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Unable to link rust static lib to C code on 1.57.0 #91974
Comments
I am using the i686-pc-windows-msvc target. Is that causing this issue? |
You need to link Bcrypt.lib as well. When using a static library outside of Rust, the required import libraries won't be linked automatically. |
A EvaluationObjects object was added to store all required nodes for evaluation, rather than using 'rust::Vec' in C++ because it appears it wont link to the library. Link against 'Bcrypt' library because from Rust 1.57+ it's now required. rust-lang/rust#91974 Issue #114.
As of Rust 1.57, we need to make sure to link to bcrypt.lib: rust-lang/rust#91974
…|shared_library` (#1299) A Rust `staticlib` or `cdylib` doesn't need to propagate linker inputs of its dependencies, except for shared libraries. - The tests are currently disabled on osx because the CI [Toolchain does not support dynamic linking]( https://buildkite.com/bazel/rules-rust-rustlang/builds/6126#a83dbb56-50b0-4a95-bb39-09e3a78ed0d0). - I also had to link to `Bcrypt.lib` => rust-lang/rust#91974
If you compile the staticlib with |
It looks like bcrypt is no longer included in Rust 1.77.2: https://github.com/lab-cosmo/metatensor/actions/runs/8907669658/job/24461939439
( Rust 1.78.0: https://github.com/lab-cosmo/metatensor/actions/runs/8925096694/job/24512982693?pr=605
I am getting this list in CMake by calling |
I believe instead of referencing an external import library for bcrypt we now embed one inside the staticlib we output, thus avoiding the need to specify it as linker arg. |
Yes std no longer uses bcrypt. If another crate is relying on it then |
I am working on ccextractor, and recently the tests failed on rustc 1.57.0, with the error:-
Error relates to an undefined symbol
__imp_BCryptGenRandom
referenced instd:: thread::localfastkey::try_initialize
Switching to rustc 1.56.0 or below does not cause any errors
Here are the logs for 1.57.0 test run, and here for 1.56.0 test run.
Looking into the static libraries, only the lib built with 1.57.0 has the symbol specified in the error
The text was updated successfully, but these errors were encountered: