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

Unable to find libclang.so #731

Closed
NobodyXu opened this issue May 31, 2022 · 15 comments
Closed

Unable to find libclang.so #731

NobodyXu opened this issue May 31, 2022 · 15 comments

Comments

@NobodyXu
Copy link

NobodyXu commented May 31, 2022

When using cross to cross compiling crate zstd in PR cargo-bins/cargo-binstall#148, the CI that use-cross: true all failed with libclang.so not found.

Edit:

The PR enabled feature bindgen of zstd and bindgen uses libclang.so to parse C headers.

@Emilgardis
Copy link
Member

Emilgardis commented May 31, 2022

works kinda on the newest images, either pull the newest unreleased cross version to override whatever actions-rs does, or set

CARGO_TARGET_${TARGET}_IMAGE=ghcr.io/cross-rs/armv7-unknown-linux-gnueabihf:edge

seems like there's some more issues though, we're missing linux-libc-dev-<target>-cross on the linux images

@NobodyXu
Copy link
Author

NobodyXu commented May 31, 2022

We are using cross via actions-rs/cargo by setting use-cross: true.

Does changing env work for actions-rs/cargo?

Edit:

Seems like that we can adjust the image in Cross.toml

@Emilgardis
Copy link
Member

Yes, it works for everything using cross.
You can also install cross before invoking use-cross and if actions-rs finds the cross binary it won't/shouldn't override it

You can adjust the image in the Cross.toml too ofc :)

@NobodyXu
Copy link
Author

NobodyXu commented May 31, 2022

@Emilgardis The build still failed for armv7 glibc and aarch64 glibc:

  /usr/arm-linux-gnueabihf/include/limits.h:123:16: fatal error: 'limits.h' file not found

@Emilgardis
Copy link
Member

As mentioned, missing linux-libc-dev-<target>-cross @NobodyXu

We should include that, pr pending :)

@NobodyXu
Copy link
Author

As mentioned, missing linux-libc-dev--cross @NobodyXu

Ok, sorry I missed that part.

@Emilgardis
Copy link
Member

hmm, seems like that's not it

@Emilgardis
Copy link
Member

Emilgardis commented May 31, 2022

alright! Seems like you should enable pkg-config feature of the zstd crate, and then you'll need to install libzstd-dev and clang-3.9 (https://github.com/cross-rs/cross/wiki/FAQ#linking-external-libraries)

the zstd-sys crate doesn't have a valid discovery for cross compilation without that feature.

doing that however, we find that the version in ubuntu 16.04 is too old, which probably means you need this: https://github.com/cross-rs/cross/wiki/FAQ#newer-linux-versions / #591

ping #678 (this would be a great help for this scenario...)

@NobodyXu
Copy link
Author

@Emilgardis We need it to be statically linked so that it can run on everywhere, so we probably cannot use external version of libzstd that is dynamically linked.

@Emilgardis
Copy link
Member

of course, the issue is not with cross now however, you need to install zstd and clang-3.9 in the image that cross uses so that it/cargo/bindgen can find the relevant files.

@Emilgardis
Copy link
Member

doing that however, we find that the version in ubuntu 16.04 is too old, which probably means you need this: cross-rs/cross/wiki/FAQ#newer-linux-versions / #591

instead of this, you could manually get the files needed and place them in the normal places or make cargo understand where they live

@NobodyXu
Copy link
Author

@Emilgardis Is there anyway to fix

/usr/arm-linux-gnueabihf/include/limits.h:123:16: fatal error: 'limits.h' file not found, err: true

We can wait for the PR that fixes this.

Can you please point to me which PR fixes this issue so that we can subscribe and wait for it?

@Emilgardis
Copy link
Member

the fix for it is for you to enable the pkg-config feature in zstd

@Emilgardis
Copy link
Member

Emilgardis commented May 31, 2022

The other issues you'll encounter are solved with something like https://github.com/cross-rs/cross/wiki/Recipes and https://github.com/cross-rs/cross/wiki/FAQ#custom-images

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

No branches or pull requests

2 participants