Rust link musl cgo static library: segmentation fault

repository:GitHub - gngpp/opengpt: A Command-Line ChatGPT

git clone && cd opengpt
cd fficall/ffi
CGO_ENABLED=1 CC=musl-gcc GOOS=linux GOARCH=amd64 go build -tags lib --ldflags '-s -w'  -buildmode=c-archive -o libfficall.a
cd -
cargo zigbuild --release --target x86_64-unknown-linux-musl

## musl-gcc version: musl-1.2.0

How to diagnose the problem and package an x86 schema without this problem.

Try running it in a debugger and get a backtrace. That should show where the crash happens.

Thanks a lot, I ran a hello world example

Right now it seems to be on Github issue, where the problem is
: rustc 1.59/1.60 builds musl binaries that segfault, when compiling with musl-gcc wrappers, due to static-pie default · Issue #95926 · rust-lang/rust · GitHub

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.