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

libc test builds two different versions of libc #3234

Closed
jessicah opened this issue May 5, 2023 · 7 comments · Fixed by #3236
Closed

libc test builds two different versions of libc #3234

jessicah opened this issue May 5, 2023 · 7 comments · Fixed by #3236
Labels
C-bug Category: bug

Comments

@jessicah
Copy link
Contributor

jessicah commented May 5, 2023

cd /Development/source/libc/libc-test
cargo test

In output:

Compiling libc v0.2.142
...
Compiling libc v0.2.142 (/Development/source/rust/libc)

At least on Haiku, this causes a linking error as the current libc on crates.io hasn't been updated with a fix to a linking issue, which has been fixed in my local repo (and has landed here, a new release hasn't been cut yet).

@jessicah jessicah added the C-bug Category: bug label May 5, 2023
@JohnTitor
Copy link
Member

0.2.143 will fix this.

@jessicah
Copy link
Contributor Author

jessicah commented May 6, 2023

Ah, I have more changes to make to the libc crate, but need to be able to test properly. Is there no way for cargo test to use the local libc instead of from crates.io?

@JohnTitor
Copy link
Member

JohnTitor commented May 6, 2023

I'm not sure if I understand your argument correctly, but wouldn't just cloning the repo and running the test on it be sufficient?

Like:

libc = { path = "../libc" }
# or, if you prefer using a remote repo
libc = { git = "https://your-fork/your-remote-repo.git" }

@jessicah
Copy link
Contributor Author

jessicah commented May 6, 2023

in libc/libc-test/Cargo.toml:

[dependencies.libc]
path = ".."
version = "0.2.142"
default-features = false

But during build, I'm assuming some dependency is pulling in libc, and cargo downloads a copy from crates.io, instead of using libc in the parent directory. Hence why when running cargo test, I get a link failure due to not using the local libc.

Is the libc-test sub-directory not meant to be used directly for cargo test?

@JohnTitor
Copy link
Member

You have to add them under [patch.crates-io]. See https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html if you're new to Cargo, it's quite helpful :)

@jessicah
Copy link
Contributor Author

jessicah commented May 6, 2023

I tried that in the sub directory, but it seemed to have no effect. Is that maybe because it's part of a workspace?

@JohnTitor
Copy link
Member

I don't have your workspace and cannot provide further directions, unfortunately :( I'd suggest reading the above docs more and investigating further (also, I think it's not a libc issue anymore but Cargo's usage).

@bors bors closed this as completed in a14853d May 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants