Help! Libc dynamic library problem

Libc dynamic library problem:

rustc -C prefer-dynamic -C linker="aarch64-linux-gnu-gccc" --target=aarch64-unknown-linux-musl -C link-args="--sysroot=/tmp/sysroots/aarch64-linux-gun-elf/ -Wl,-Bdynamic -lc -lulibs -lsrv_fs -lsrv_net -lgcc -Wl,--dynamic-linker=/lib/ld.so.elf" -C target-feature=crt-static hello.rs

It builds sucessfully,but runs failed.

It looks like libc.so is dynamically linked, but the function"calloc"(which is a member of libc) is statically linked. This caused libc to fail to call calloc during loading. How to solve this problem?

ps:There are both libc.a and libc.so in the compilation environment. Could rust links libc.so only, without libc.a linked ?

What happens when you use the -C target-feature=-crt-static (notice the leading - before crt-static) instead?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.