Skip to content
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

[Feature Request]: RUSTC_AR is missing #12183

Closed
lexi-the-cute opened this issue May 25, 2023 · 3 comments
Closed

[Feature Request]: RUSTC_AR is missing #12183

lexi-the-cute opened this issue May 25, 2023 · 3 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.

Comments

@lexi-the-cute
Copy link

Problem

RUSTC_AR is missing from the available build environment variables in build.rs.

This makes the below code not work.

    cc::Build::new()
        .compiler(PathBuf::from(env::var("RUSTC_LINKER").unwrap()))
        .archiver(PathBuf::from(env::var("RUSTC_AR").unwrap()))
        .file(lib_path.to_str().unwrap())
        .compile("browser");

Proposed Solution

I started work on lexi-the-cute@287fb2a and am currently compiling Cargo in order to make sure the variable works. 4 tests fail, so I temporarily disabled them. The 4 tests are listed below.

cargo test -j 8 build_script::custom_build_ar_bad_host
cargo test -j 8 build_script::custom_build_ar_bad_host_with_arch
cargo test -j 8 build_script::custom_build_ar_host_target_with_bad_host_config
cargo test -j 8 build_script::custom_build_env_var_rustc_ar_bad_host_target

Notes

I based my commit on #5394 and am waiting for approval to make a pull request to add this feature

@lexi-the-cute lexi-the-cute added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage. labels May 25, 2023
@weihanglo
Copy link
Member

Hello. As far as I can tell

Basically it does nothing on rustc/cargo side. I am not sure if this configuration is still useful. Could you elaborate more?

@weihanglo weihanglo added S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. and removed S-triage Status: This issue is waiting on initial triage. labels May 25, 2023
@lexi-the-cute
Copy link
Author

That's good to know. I've had my config.toml setup as:

[target.wasm32-unknown-emscripten]
ar = "$WORKSPACE/tools/emsdk/upstream/emscripten/emar"
linker = "$WORKSPACE/tools/emsdk/upstream/emscripten/emcc"
rustflags = ["-L$WORKSPACE/target/libs", "-lSDL2", "-lSDL2_image", "-lSDL2_ttf", "-lSDL2_mixer", "-lpthread"]

The $WORKSPACE variable is replaced by sed in my build script. I was using the ar variable thinking it was telling rust to use emar instead of the default ar tool.

@weihanglo
Copy link
Member

Thank you for letting us know.

Unless people are using an extremely old Rust, this should be a no-op. Going in close this out as we don't support archiver configuration anymore. Thanks.

@weihanglo weihanglo closed this as not planned Won't fix, can't repro, duplicate, stale May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.
Projects
None yet
Development

No branches or pull requests

2 participants