Why can't I build cdylib on the ‘mips64-unknown-linux-muslabi64’ target?

I tried to build the cdylib of'mips64-unknown-linux-muslabi64' on the'x86_64' computer, but the compiler prompted me "mips64-unknown-linux-muslabi64 does not support these crate types".
This troubles me very much, what should I do?

Why do you want to build a cdylib bundled with its own musl libc, not using the one provided by the end binary, either glibc or musl?

Would -Ctarget-feature=-crt-static work?

My configuration in cargo.toml:
[lib]
crate-type = ["cdylib"]
I want to use rust to make a dynamic-link library for my "mips64" machine for C call

My English is not good, I don’t know if I understood your words correctly..

But thank you for your reply :wink:

It is not possible to mix multiple libc implementations inside a single process. Your OS is probably using glibc instead of musl as libc. This means that you will have to compile your shared library for glibc too. You can do this by using mips64-unknown-linux-gnuabi64 instead. Musl is normally only used when you want to statically link an executable. In this case, the executable doesn't support dynamically linking into it.

By the way, you may want to statically link the library into your C executable. You can do this by using staticlib as crate type. You will still have to use mips64-unknown-linux-gnuabi64 as target though.

I understand! thanks for your help! :smiling_face_with_three_hearts:

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.