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

Failed to link with rustc-link-arg #12843

Closed
ghost opened this issue Oct 18, 2023 · 3 comments
Closed

Failed to link with rustc-link-arg #12843

ghost opened this issue Oct 18, 2023 · 3 comments
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.

Comments

@ghost
Copy link

ghost commented Oct 18, 2023

Problem

[dependencies]
libwebp2 = { version = "0.0.2", features = ["download"] }

cargo build failed

I can successfully build test for libwebp2, but it fails to build when it is used as a dependency for other crates.

Steps

No response

Possible Solution(s)

No response

Notes

No response

Version

No response

@ghost ghost added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Oct 18, 2023
@ghost
Copy link
Author

ghost commented Oct 18, 2023

The build.rs file of the libwebp2 crate uses the code to link to a static library with an absolute path.

println!("cargo:rustc-link-arg={}", libpath.display());

@ghost
Copy link
Author

ghost commented Oct 18, 2023

#9557 (comment)

@arlosi
Copy link
Contributor

arlosi commented Oct 20, 2023

This looks like an issue with the libwebp2 crate, which appears to have all versions yanked.

cargo:rustc-link-arg causes rustc to pass an additional raw argument to the linker. Passing an absolute path alone here is likely incorrect.

The correct solution is to use cargo:rustc-link-lib=LIB to link the native library.

@arlosi arlosi closed this as completed Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

1 participant