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/" -C target-feature=crt-static

It builds sucessfully,but runs failed.

It looks like 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 in the compilation environment. Could rust links 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

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