-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
--extern mycrate=path/to/my/crate/with/random.suffix
fails with "file name should be lib*.rlib or lib*.so"
#131720
Comments
Thanks @jieyouxu for the label -- to provide some context: some kernel developers want to build Linux under macOS, but the kernel does not support that (the macOS support is maintained out-of-tree). So they may need something like this to minimize the differences with upstream. There may be other possible solutions (e.g. using symlinks, if that works, but it would require knowing the names in general). Perhaps this could help other projects to be ported to macOS too. |
The toy example I posted above doesn't exactly capture the kernel case. Running the kernel build with
which emits
Creating a symlink from
|
I suspect this isn't super easy to change, as it probably affects how deps are looked up in a non-trivial way. |
This is the source of the rejection: rust/compiler/rustc_metadata/src/locator.rs Lines 728 to 752 in f79fae3
The problem is that the compiler is trying to guess the type of the library; it isn't enough the the user gave the path because we also need to decide if it's an rlib, rmeta, or dylib, and we do that based on the file name. Later in the process we'll load the metadata from the file, but the implementations are quite divergent: rust/compiler/rustc_codegen_ssa/src/back/metadata.rs Lines 52 to 83 in f79fae3
Solving this would probably require finding a way to interrogate the files without relying on their filenames. |
…dy, r=lcnr rustc_metadata: minor tidying Cleaned up some code while investigating rust-lang#131720. See individual commits.
…dy, r=lcnr rustc_metadata: minor tidying Cleaned up some code while investigating rust-lang#131720. See individual commits.
Rollup merge of rust-lang#131743 - tamird:find_commandline_library-tidy, r=lcnr rustc_metadata: minor tidying Cleaned up some code while investigating rust-lang#131720. See individual commits.
macro.rs:
main.rs:
This works:
This doesn't:
This has come up in Rust-For-Linux where we'd like to always use the .so suffix, but this causes the build to fail on macOS. If we change the suffix to .dylib, it works on macOS, but not Linux.
The text was updated successfully, but these errors were encountered: