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

Cargo build failure caused by other crates with bindgen #29

Open
takkyu2 opened this issue Jul 19, 2021 · 2 comments
Open

Cargo build failure caused by other crates with bindgen #29

takkyu2 opened this issue Jul 19, 2021 · 2 comments

Comments

@takkyu2
Copy link

takkyu2 commented Jul 19, 2021

First things first, thank you for this nice crate!

This is not a problem of this crate per se, and this issue is just for your information.
If I include several crates which make use of bindgen, say this crate (vaaaaanquish/lightgbm-rs) and davechallis/rust-xgboost in Cargo.toml,

[package]
name = "xg_ls"
version = "0.1.0"
edition = "2018"

[dependencies]
lightgbm = "0.2.3"
xgboost = "0.1.4"

cargo build fails with the following error message:

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

package `clang-sys v0.22.0`
    ... which is depended on by `bindgen v0.36.1`
    ... which is depended on by `xgboost-sys v0.1.2`
    ... which is depended on by `xgboost v0.1.4`
    ... which is depended on by `xg_ls v0.1.0 (/home/kou/ws_code/xg_ls)`
links to native library `clang`

package `clang-sys v1.2.0`
    ... which is depended on by `bindgen v0.56.0`
    ... which is depended on by `lightgbm-sys v0.3.0`
    ... which is depended on by `lightgbm v0.2.3`
    ... which is depended on by `xg_ls v0.1.0 (/home/kou/ws_code/xg_ls)`
also links to native library `clang`

As is menthioned in this issue rust-lang/cargo#5237, it seems this failure occurs in the presence of the different versions of bindgen in the dependency.

If people want to do some ensembling (say xgboost & lightgbm just as above), or deploy some product with a complex data-processing pipeline, this may be a problem.

Having said that, I have no idea how to address the problem, since I do not know even a tiny bit of the cargo internals. Also, this seems to be a problem of the cargo build system itself, and it may be inappropriate to bring up this issue here, so please feel free to close this issue in case you find it unnecessary.

@leofidus
Copy link

leofidus commented Nov 1, 2021

The best solution I've found is to update all packages to a bindgen version of at least 0.55.0.

It looks like vaaaaanquish is doing god's work and upgrading the xgboost crate, so this specific instance should be solved soon.

@vaaaaanquish
Copy link
Owner

@takkyu2 @leofidus Thx.

As leofidus said, it was a problem with the bindgen version.
To make this possible, we did a very big job of upgrading the xgboost version.

Almost there. Please wait a moment. :)

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

No branches or pull requests

3 participants