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

Cross compilation error #239

Open
raui100 opened this issue Nov 27, 2023 · 4 comments
Open

Cross compilation error #239

raui100 opened this issue Nov 27, 2023 · 4 comments

Comments

@raui100
Copy link

raui100 commented Nov 27, 2023

Hello! The compilation crashes when compiling with cross from Linux x86 to aarch64.
The bug can be reproduced with:

# Setup
cargo install cross
cargo new cross_bug
cd cross_bug
cargo add duckdb -F bundled
# Cross compilation
cross build --release --target=aarch64-unknown-linux-gnu

And produces the following log, which exceeds the GitHub character limit.
ERROR_DUCKDB.txt

EDIT: It works with cross build --release --target=aarch64-unknown-linux-musl

@maxpowel
Copy link

I am getting the same error. I tried to compile it manually inside the container with docker run -ti ghcr.io/cross-rs/aarch64-unknown-linux-gnu /bin/bash and duck-db compiles (this one https://github.com/duckdb/duckdb/tree/3c695d7ba94d95d9facee48d395f46ed0bd72b46) so I guess that it is not duckdb but something in the crate.

@maxpowel
Copy link

maxpowel commented Dec 27, 2023

I found the issue and it is not related at all with duckdb-rs.
The default image for aarch64-unknown-linux-gnu (ghcr.io/cross-rs/aarch64-unknown-linux-gnu:latest) is very old and the gcc version is 5.4.

Luckily the cross repository provides the Dockerfile so the workaround is just to build an updated cross image locally and then use it.

git clone https://github.com/cross-rs/cross
cd cross/docker
docker buildx build -t cross-arm64 -f Dockerfile.aarch64-unknown-linux-gnu . --load

Then in your cargo.toml add the following

[package.metadata.cross.target.aarch64-unknown-linux-gnu]
image = "cross-arm64"

And finally run cross build --target aarch64-unknown-linux-gnu --release. Now cross will use your updated docker image with gcc 9.4.0

Looks that something similar already happened here numpy/numpy#16576

@maxpowel
Copy link

I just found out that from cross version 0.2.5 the image used is ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main instead of ghcr.io/cross-rs/aarch64-unknown-linux-gnu:latest.

I had 0.2.4 and just by updating to 0.2.5 the build succeded (because the newer image is fetched and used) so just update cross and everything will be fine

@raui100
Copy link
Author

raui100 commented Mar 12, 2024

It's still not working for me. I'm using cross 0.2.5 and cargo 1.78.0-nightly

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

2 participants