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

Build error because of different clang-sys/bindgen requirements #44

Closed
5jqk2ymwqd opened this issue Mar 23, 2018 · 6 comments · Fixed by #96
Closed

Build error because of different clang-sys/bindgen requirements #44

5jqk2ymwqd opened this issue Mar 23, 2018 · 6 comments · Fixed by #96
Assignees

Comments

@5jqk2ymwqd
Copy link

When I tried to build a project depending on this crate I get the following error:

error: multiple packages link to native library clang, but a native library can be linked only once

package clang-sys v0.21.2
... which is depended on by bindgen v0.31.3
... which is depended on by libffi-sys v0.6.0
... which is depended on by libffi v0.6.3
... which is depended on by mpi v0.5.2
... which is depended on by project-using-mpi v0.1.0 (file:///path/to/project-folder)
links to native library clang

package clang-sys v0.22.0
... which is depended on by bindgen v0.33.2
... which is depended on by mpi-sys v0.1.1
... which is depended on by mpi v0.5.2
... which is depended on by project-using-mpi v0.1.0 (file:///path/to/project-folder)
also links to native library clang

The project has only mpi as dependency (Cargo.toml):

[dependencies]
mpi = "*"

Maybe mpi-sys could depend on bindgen v0.31.3 (libffi-sys depends explicitly on bindgen = "0.31.3"), too. Or do you think it is better to wait for libffi-sys to update to the current bindgen?

Thanks a bunch for this crate, I am excited to try it.

@5jqk2ymwqd 5jqk2ymwqd changed the title Build error on clang-sys Build error because of different clang-sys/bindgen requirements Mar 23, 2018
@bsteinb
Copy link
Collaborator

bsteinb commented Mar 24, 2018

Hm, that is unfortunate, I will tie down the version of bindgen that mpi-sys uses and publish a new version to crates.io.

However, I suspect that cargo is being too cautious in this situation. bindgen and through it clang-sys is a build dependency of both mpi-sys and libffi-sys, so it will be linked to their build scripts, but not to the resulting libraries, so there will not be a mix of different versions of clang-sys or the native libclang in the resulting mpi library. I will open an issue for cargo and see what the developers think about this.

Thank you for the report and the encouraging words.

Edit: I have opened an issue here: rust-lang/cargo#5237

@bsteinb
Copy link
Collaborator

bsteinb commented Mar 24, 2018

All right, I have just released mpi-0.5.3 which should fix the issue.

@5jqk2ymwqd
Copy link
Author

Thank you very much.

@Eh2406
Copy link

Eh2406 commented Mar 24, 2018

Oddly I can not reproduce, I built a new project and added

[dependencies]
mpi = "=0.5.2"

And ran cargo +nightly generate-lockfile which ran without trouble.
That error message is from the resolver that is used in generate-lockfile, and was added recently (by me) so this must be on a nightly. I wonder if an outdated lock file is involved?

@bsteinb
Copy link
Collaborator

bsteinb commented Mar 24, 2018

Yes, this is on rustc 1.26.0-nightly (c08480fce 2018-03-23). I can confirm that cargo generate-lockfile works without reporting an error. I only run into the issue I reported when I try to cargo build.

Edit: I also deleted my Cargo.lock and ran cargo build and I am still seeing the issue.

@bsteinb bsteinb reopened this Mar 24, 2018
@Eh2406
Copy link

Eh2406 commented Mar 24, 2018

I was wrong. This is the older error message, not the one I just added. Sorry for the crossed wires.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants