vaptu opened issue #3731:
I tried changing the type of build c-api library to make it a static library.
sed -i '14c crate-type=["staticlib"]' crates/c-api/Cargo.toml
(.text+0x3c): relocation truncated to fit: R_AARCH64_LD64_GOTPAGE_LO15 against symbol `__environ' defined in .bss section in /usr/lib/gcc/aarch64-linux-gnu/10/../../../aarch64-linux-gnu/libc.a(environ.o)
vaptu edited issue #3731:
I tried changing the type of build c-api library to make it a static library.
sed -i '14c crate-type=["staticlib"]' crates/c-api/Cargo.toml export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc export CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc cargo build --target aarch64-unknown-linux-gnu --release --manifest-path crates/c-api/Cargo.toml
ld
(.text+0x3c): relocation truncated to fit: R_AARCH64_LD64_GOTPAGE_LO15 against symbol `__environ' defined in .bss section in /usr/lib/gcc/aarch64-linux-gnu/10/../../../aarch64-linux-gnu/libc.a(environ.o)
When I used it, I was prompted for such an error. After my investigation, I found that it was caused by linking the wasmtime library. What is the reason for this and how can I fix it
vaptu edited issue #3731:
I tried changing the type of build c-api library to make it a static library.
sed -i '14c crate-type=["staticlib"]' crates/c-api/Cargo.toml export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc export CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc cargo build --target aarch64-unknown-linux-gnu --release --manifest-path crates/c-api/Cargo.toml
When I use
gcc -static
static link all library,ld return the error(.text+0x3c): relocation truncated to fit: R_AARCH64_LD64_GOTPAGE_LO15 against symbol `__environ' defined in .bss section in /usr/lib/gcc/aarch64-linux-gnu/10/../../../aarch64-linux-gnu/libc.a(environ.o)
When I used it, I was prompted for such an error. After my investigation, I found that it was caused by linking the wasmtime library. What is the reason for this and how can I fix it
alexcrichton commented on issue #3731:
This looks like a generic linker error which is related to a platform-specific limitation. This is probably related to your use of
-static
on the linker command line, and this may go away if such an option is removed. I don't personally have any experience building static glibc-based binaries but it may be the case that wasmtime is blowing some sort of size limit to prevent linking.Otherwise though this issue generally doesn't look related to Wasmtime itself but rather just trying to link static Rust executables in general with glibc.
vaptu commented on issue #3731:
I see that the c-api in the release version is a dynamic link library. Can you provide a static library for the target platform? Or how to compile a library that can be statically linked. xthanks
vaptu commented on issue #3731:
This problem does not exist on x86_64 machines
alexcrichton commented on issue #3731:
My own personal experience of building static binaries with Rust for Linux systems only involves using musl, which is a target that we do not provide precompiled binaries for (and a few things don't work like trap backtraces I think). We do provide
libwasmtime.a
for the glibc target but I don't know whether it works to build into a static library. My guess would be no but I do not have any experience building static glibc binaries. If you're able to get it working though we could evaluate whether it makes sense to build artifacts for that as well.
vaptu commented on issue #3731:
Thank you so much
vaptu closed issue #3731:
I tried changing the type of build c-api library to make it a static library.
sed -i '14c crate-type=["staticlib"]' crates/c-api/Cargo.toml export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc export CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc cargo build --target aarch64-unknown-linux-gnu --release --manifest-path crates/c-api/Cargo.toml
When I use
gcc -static
static link all library,ld return the error(.text+0x3c): relocation truncated to fit: R_AARCH64_LD64_GOTPAGE_LO15 against symbol `__environ' defined in .bss section in /usr/lib/gcc/aarch64-linux-gnu/10/../../../aarch64-linux-gnu/libc.a(environ.o)
When I used it, I was prompted for such an error. After my investigation, I found that it was caused by linking the wasmtime library. What is the reason for this and how can I fix it
vaptu commented on issue #3731:
I solved this problem by switching from Debian distribution to fedora. Static linking no longer prompts this problem, but I don't know why. I guess it is caused by the fact that Glibc does not use the
-mcmodel=large
compile option on some distributions
Last updated: Dec 23 2024 at 12:05 UTC