-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
Description
I have found these related issues/pull requests
The only similar issue that I found related to cross compilation to musl was this previous task, but is not the same one.
Description
Trying to compile the project with cross compilation from Debian docker image sharing the code in a volume from Ubuntu 24.04.2 OS to target x86_64-unknown-linux-musl I have the error:
Currently using clang as linker for this target.
error: linking with `clang` failed: exit status: 1
|
= note: LC_ALL="C" PATH="/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin:/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/self-contained:/root/.cargo/bin:/snap/bin:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.cargo/bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/home/runner/.dotnet/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" VSLANG="1033" "clang" "-m64" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/rcrt1.o" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crti.o" "/root/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtbeginS.o" "/tmp/rustcD5iCV2/symbols.o" "<1 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "/tmp/rustcD5i
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: /usr/bin/ld: /tmp/rustcD5iCV2/liblibsqlite3_sys-e9e42eb6f2b48f5c.rlib(c877a2978823c39d-sqlite3.o):(.data.aSyscall+0xb0): undefined reference to `fcntl64’
clang: error: linker command failed with exit code 1 (use -v to see invocation)
= note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
= note: use the `-l` flag to specify native libraries to link
Installed the packages dependecies libsqlite3-dev, musl-tools and musl-dev but the error is still happening.
Reproduction steps
- Reference sqlx version 0.8.3
- Enable the features runtime-tokio-native-tls and sqlite
- Install clang, llvm, musl-tools and musl-dev packages
- Define linker = “clang”
- Define archiver ar = "llvm-ar”
- Define rustflags rustflags = ["-C", "target-feature=+crt-static"]
- Run cross compilation to x86_64-unknown-linux-musl target
[target.x86_64-unknown-linux-musl]
linker = "clang"
ar = "llvm-ar"
rustflags = ["-C", "target-feature=+crt-static"]
cargo build --target x86_64-unknown-linux-musl
SQLx version
0.8.3
Enabled SQLx features
runtime-tokio-native-tls, sqlite
Database server and version
Sqlite
Operating system
Ubuntu 24.04.2
Rust version
1.85.0
p2d0, ElhamAryanpur and HarrisonHall