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 ?

Try omitting -Ctarget-feature=crt-static. It should probably not be combined with -Cprefer-dynamic.

Thanks for reply.

I have tried your sulotion,but it dose not work with the same error.

I have tried another sulotion,changing -Ctarget-feature=crt-static to -Ctarget-feature=-crt-static ,then it gose run with error " 'calloc' undefine references".

Dose crt-static introduce the definition of calloc? So Confused!

I think this question is better suited for https://users.rust-lang.org

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