Installation of Rust with x86_64-unknown-linux-musl target

I have installed Rust and I also downloaded the musl Compiler and installed it.
The musl Compiler already works but does not produce static libraries by default:

$ musl-gcc memcpy.c
$ ldd a.out
	linux-vdso.so.1 =>  (0x00007fffcf7d7000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f47defe9000)
	/usr/share/musl/lib/ld-musl-x86_64.so.1 => /lib64/ld-linux-x86-64.so.2 (0x00007f47df3b7000)
$ objdump -T a.out

a.out:     formato del fichero elf64-x86-64

DYNAMIC SYMBOL TABLE:
0000000000000000  w   D  *UND*	0000000000000000              _ITM_deregisterTMCloneTable
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 strlen
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 printf
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.2.5 __libc_start_main
0000000000000000  w   D  *UND*	0000000000000000              __gmon_start__
0000000000000000      DF *UND*	0000000000000000  GLIBC_2.14  memcpy
0000000000000000  w   D  *UND*	0000000000000000              _Jv_RegisterClasses
0000000000000000  w   D  *UND*	0000000000000000              _ITM_registerTMCloneTable
0000000000000000  w   DF *UND*	0000000000000000  GLIBC_2.2.5 __cxa_finalize

Moreover this is problematic due to its incompatibilty with older Operating System Versions like documented in this issue:


And thus becomes a crucial roadblock for any Rust Development to go into production.

When I try to use the -static flag on musl-gcc it gives an error:

$ musl-gcc -static memcpy.c
/usr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status

I could not find any information about this error and also wonder whether this will affect the ablity of Rust to build a static transportable binary.

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

You also have to install the musl libc itself. For example sudo apt install musl musl-dev on Debian. (not sure if musl-dev is necessary) Otherwise the linker is not able to find libc.a to link into your program. I then ran rustup target add x86_64-unknown-linux-musl once to install a libstd for musl. After that echo 'fn main() { println!("Hello World!"); }' | rustc - --target x86_64-unknown-linux-musl works fine. I didn't even need musl-gcc. The resulting executable was statically linked:

$ bingrep ./rust_out
ELF EXEC X86_64-little-endian @ 0x401290:

[...]

Dynamic: None


Libraries(0):

Soname: None
Interpreter: None
is_64: true
is_lib: false
little_endian: true
entry: 401290
1 Like

The code example to test the musl library I got from this source:
http://www.cplusplus.com/reference/cstring/memcpy/

/* memcpy example */
#include <stdio.h>
#include <string.h>

struct {
  char name[40];
  int age;
} person, person_copy;

int main ()
{
  char myname[] = "Pierre de Fermat";

  /* using memcpy to copy string: */
  memcpy ( person.name, myname, strlen(myname)+1 );
  person.age = 46;

  /* using memcpy to copy structure: */
  memcpy ( &person_copy, &person, sizeof(person) );

  printf ("person_copy: %s, %d \n", person_copy.name, person_copy.age );

  return 0;
}

This came up because the Rust hello-world Application was detected to use glibc which made it incompatible with older systems without recompiling.

Thank you for looking into this issue.

I downloaded the musl library and built a RPM Package and installed it:

$ rpm -q --filesbypkg musl
musl                      /usr/bin/musl-gcc
musl                      /usr/share/musl
musl                      /usr/share/musl/bin
musl                      /usr/share/musl/bin/musl-gcc
musl                      /usr/share/musl/doc
musl                      /usr/share/musl/doc/COPYRIGHT
musl                      /usr/share/musl/doc/INSTALL
musl                      /usr/share/musl/doc/README
musl                      /usr/share/musl/doc/VERSION
musl                      /usr/share/musl/doc/WHATSNEW
musl                      /usr/share/musl/lib
musl                      /usr/share/musl/lib/Scrt1.o
musl                      /usr/share/musl/lib/crt1.o
musl                      /usr/share/musl/lib/crti.o
musl                      /usr/share/musl/lib/crtn.o
musl                      /usr/share/musl/lib/ld-musl-x86_64.so.1
musl                      /usr/share/musl/lib/libc.a
musl                      /usr/share/musl/lib/libc.so
musl                      /usr/share/musl/lib/libcrypt.a
musl                      /usr/share/musl/lib/libdl.a
musl                      /usr/share/musl/lib/libm.a
musl                      /usr/share/musl/lib/libpthread.a
musl                      /usr/share/musl/lib/libresolv.a
musl                      /usr/share/musl/lib/librt.a
musl                      /usr/share/musl/lib/libutil.a
musl                      /usr/share/musl/lib/libxnet.a
musl                      /usr/share/musl/lib/musl-gcc.specs
musl                      /usr/share/musl/lib/rcrt1.o
musl                      /usr/share/musl/src
musl                      /usr/share/musl/src/include
musl                      /usr/share/musl/src/include/aio.h
musl                      /usr/share/musl/src/include/alloca.h
musl                      /usr/share/musl/src/include/ar.h
musl                      /usr/share/musl/src/include/arpa
musl                      /usr/share/musl/src/include/arpa/ftp.h
musl                      /usr/share/musl/src/include/arpa/inet.h
musl                      /usr/share/musl/src/include/arpa/nameser.h
musl                      /usr/share/musl/src/include/arpa/nameser_compat.h
musl                      /usr/share/musl/src/include/arpa/telnet.h
musl                      /usr/share/musl/src/include/arpa/tftp.h
musl                      /usr/share/musl/src/include/assert.h
musl                      /usr/share/musl/src/include/bits
musl                      /usr/share/musl/src/include/bits/alltypes.h
musl                      /usr/share/musl/src/include/bits/dirent.h
musl                      /usr/share/musl/src/include/bits/errno.h
musl                      /usr/share/musl/src/include/bits/fcntl.h
musl                      /usr/share/musl/src/include/bits/fenv.h
musl                      /usr/share/musl/src/include/bits/float.h
musl                      /usr/share/musl/src/include/bits/hwcap.h
musl                      /usr/share/musl/src/include/bits/io.h
musl                      /usr/share/musl/src/include/bits/ioctl.h
musl                      /usr/share/musl/src/include/bits/ioctl_fix.h
musl                      /usr/share/musl/src/include/bits/ipc.h
musl                      /usr/share/musl/src/include/bits/ipcstat.h
musl                      /usr/share/musl/src/include/bits/kd.h
musl                      /usr/share/musl/src/include/bits/limits.h
musl                      /usr/share/musl/src/include/bits/link.h
musl                      /usr/share/musl/src/include/bits/mman.h
musl                      /usr/share/musl/src/include/bits/msg.h
musl                      /usr/share/musl/src/include/bits/poll.h
musl                      /usr/share/musl/src/include/bits/posix.h
musl                      /usr/share/musl/src/include/bits/ptrace.h
musl                      /usr/share/musl/src/include/bits/reg.h
musl                      /usr/share/musl/src/include/bits/resource.h
musl                      /usr/share/musl/src/include/bits/sem.h
musl                      /usr/share/musl/src/include/bits/setjmp.h
musl                      /usr/share/musl/src/include/bits/shm.h
musl                      /usr/share/musl/src/include/bits/signal.h
musl                      /usr/share/musl/src/include/bits/socket.h
musl                      /usr/share/musl/src/include/bits/soundcard.h
musl                      /usr/share/musl/src/include/bits/stat.h
musl                      /usr/share/musl/src/include/bits/statfs.h
musl                      /usr/share/musl/src/include/bits/stdint.h
musl                      /usr/share/musl/src/include/bits/syscall.h
musl                      /usr/share/musl/src/include/bits/termios.h
musl                      /usr/share/musl/src/include/bits/user.h
musl                      /usr/share/musl/src/include/bits/vt.h
musl                      /usr/share/musl/src/include/byteswap.h
musl                      /usr/share/musl/src/include/complex.h
musl                      /usr/share/musl/src/include/cpio.h
musl                      /usr/share/musl/src/include/crypt.h
musl                      /usr/share/musl/src/include/ctype.h
musl                      /usr/share/musl/src/include/dirent.h
musl                      /usr/share/musl/src/include/dlfcn.h
musl                      /usr/share/musl/src/include/elf.h
musl                      /usr/share/musl/src/include/endian.h
musl                      /usr/share/musl/src/include/err.h
musl                      /usr/share/musl/src/include/errno.h
musl                      /usr/share/musl/src/include/fcntl.h
musl                      /usr/share/musl/src/include/features.h
musl                      /usr/share/musl/src/include/fenv.h
musl                      /usr/share/musl/src/include/float.h
musl                      /usr/share/musl/src/include/fmtmsg.h
musl                      /usr/share/musl/src/include/fnmatch.h
musl                      /usr/share/musl/src/include/ftw.h
musl                      /usr/share/musl/src/include/getopt.h
musl                      /usr/share/musl/src/include/glob.h
musl                      /usr/share/musl/src/include/grp.h
musl                      /usr/share/musl/src/include/iconv.h
musl                      /usr/share/musl/src/include/ifaddrs.h
musl                      /usr/share/musl/src/include/inttypes.h
musl                      /usr/share/musl/src/include/iso646.h
musl                      /usr/share/musl/src/include/langinfo.h
musl                      /usr/share/musl/src/include/lastlog.h
musl                      /usr/share/musl/src/include/libgen.h
musl                      /usr/share/musl/src/include/libintl.h
musl                      /usr/share/musl/src/include/limits.h
musl                      /usr/share/musl/src/include/link.h
musl                      /usr/share/musl/src/include/locale.h
musl                      /usr/share/musl/src/include/malloc.h
musl                      /usr/share/musl/src/include/math.h
musl                      /usr/share/musl/src/include/memory.h
musl                      /usr/share/musl/src/include/mntent.h
musl                      /usr/share/musl/src/include/monetary.h
musl                      /usr/share/musl/src/include/mqueue.h
musl                      /usr/share/musl/src/include/net
musl                      /usr/share/musl/src/include/net/ethernet.h
musl                      /usr/share/musl/src/include/net/if.h
musl                      /usr/share/musl/src/include/net/if_arp.h
musl                      /usr/share/musl/src/include/net/route.h
musl                      /usr/share/musl/src/include/netdb.h
musl                      /usr/share/musl/src/include/netinet
musl                      /usr/share/musl/src/include/netinet/ether.h
musl                      /usr/share/musl/src/include/netinet/icmp6.h
musl                      /usr/share/musl/src/include/netinet/if_ether.h
musl                      /usr/share/musl/src/include/netinet/igmp.h
musl                      /usr/share/musl/src/include/netinet/in.h
musl                      /usr/share/musl/src/include/netinet/in_systm.h
musl                      /usr/share/musl/src/include/netinet/ip.h
musl                      /usr/share/musl/src/include/netinet/ip6.h
musl                      /usr/share/musl/src/include/netinet/ip_icmp.h
musl                      /usr/share/musl/src/include/netinet/tcp.h
musl                      /usr/share/musl/src/include/netinet/udp.h
musl                      /usr/share/musl/src/include/netpacket
musl                      /usr/share/musl/src/include/netpacket/packet.h
musl                      /usr/share/musl/src/include/nl_types.h
musl                      /usr/share/musl/src/include/paths.h
musl                      /usr/share/musl/src/include/poll.h
musl                      /usr/share/musl/src/include/pthread.h
musl                      /usr/share/musl/src/include/pty.h
musl                      /usr/share/musl/src/include/pwd.h
musl                      /usr/share/musl/src/include/regex.h
musl                      /usr/share/musl/src/include/resolv.h
musl                      /usr/share/musl/src/include/sched.h
musl                      /usr/share/musl/src/include/scsi
musl                      /usr/share/musl/src/include/scsi/scsi.h
musl                      /usr/share/musl/src/include/scsi/scsi_ioctl.h
musl                      /usr/share/musl/src/include/scsi/sg.h
musl                      /usr/share/musl/src/include/search.h
musl                      /usr/share/musl/src/include/semaphore.h
musl                      /usr/share/musl/src/include/setjmp.h
musl                      /usr/share/musl/src/include/shadow.h
musl                      /usr/share/musl/src/include/signal.h
musl                      /usr/share/musl/src/include/spawn.h
musl                      /usr/share/musl/src/include/stdalign.h
musl                      /usr/share/musl/src/include/stdarg.h
musl                      /usr/share/musl/src/include/stdbool.h
musl                      /usr/share/musl/src/include/stdc-predef.h
musl                      /usr/share/musl/src/include/stddef.h
musl                      /usr/share/musl/src/include/stdint.h
musl                      /usr/share/musl/src/include/stdio.h
musl                      /usr/share/musl/src/include/stdio_ext.h
musl                      /usr/share/musl/src/include/stdlib.h
musl                      /usr/share/musl/src/include/stdnoreturn.h
musl                      /usr/share/musl/src/include/string.h
musl                      /usr/share/musl/src/include/strings.h
musl                      /usr/share/musl/src/include/stropts.h
musl                      /usr/share/musl/src/include/sys
musl                      /usr/share/musl/src/include/sys/acct.h
musl                      /usr/share/musl/src/include/sys/auxv.h
musl                      /usr/share/musl/src/include/sys/cachectl.h
musl                      /usr/share/musl/src/include/sys/dir.h
musl                      /usr/share/musl/src/include/sys/epoll.h
musl                      /usr/share/musl/src/include/sys/errno.h
musl                      /usr/share/musl/src/include/sys/eventfd.h
musl                      /usr/share/musl/src/include/sys/fanotify.h
musl                      /usr/share/musl/src/include/sys/fcntl.h
musl                      /usr/share/musl/src/include/sys/file.h
musl                      /usr/share/musl/src/include/sys/fsuid.h
musl                      /usr/share/musl/src/include/sys/inotify.h
musl                      /usr/share/musl/src/include/sys/io.h
musl                      /usr/share/musl/src/include/sys/ioctl.h
musl                      /usr/share/musl/src/include/sys/ipc.h
musl                      /usr/share/musl/src/include/sys/kd.h
musl                      /usr/share/musl/src/include/sys/klog.h
musl                      /usr/share/musl/src/include/sys/membarrier.h
musl                      /usr/share/musl/src/include/sys/mman.h
musl                      /usr/share/musl/src/include/sys/mount.h
musl                      /usr/share/musl/src/include/sys/msg.h
musl                      /usr/share/musl/src/include/sys/mtio.h
musl                      /usr/share/musl/src/include/sys/param.h
musl                      /usr/share/musl/src/include/sys/personality.h
musl                      /usr/share/musl/src/include/sys/poll.h
musl                      /usr/share/musl/src/include/sys/prctl.h
musl                      /usr/share/musl/src/include/sys/procfs.h
musl                      /usr/share/musl/src/include/sys/ptrace.h
musl                      /usr/share/musl/src/include/sys/quota.h
musl                      /usr/share/musl/src/include/sys/random.h
musl                      /usr/share/musl/src/include/sys/reboot.h
musl                      /usr/share/musl/src/include/sys/reg.h
musl                      /usr/share/musl/src/include/sys/resource.h
musl                      /usr/share/musl/src/include/sys/select.h
musl                      /usr/share/musl/src/include/sys/sem.h
musl                      /usr/share/musl/src/include/sys/sendfile.h
musl                      /usr/share/musl/src/include/sys/shm.h
musl                      /usr/share/musl/src/include/sys/signal.h
musl                      /usr/share/musl/src/include/sys/signalfd.h
musl                      /usr/share/musl/src/include/sys/socket.h
musl                      /usr/share/musl/src/include/sys/soundcard.h
musl                      /usr/share/musl/src/include/sys/stat.h
musl                      /usr/share/musl/src/include/sys/statfs.h
musl                      /usr/share/musl/src/include/sys/statvfs.h
musl                      /usr/share/musl/src/include/sys/stropts.h
musl                      /usr/share/musl/src/include/sys/swap.h
musl                      /usr/share/musl/src/include/sys/syscall.h
musl                      /usr/share/musl/src/include/sys/sysinfo.h
musl                      /usr/share/musl/src/include/sys/syslog.h
musl                      /usr/share/musl/src/include/sys/sysmacros.h
musl                      /usr/share/musl/src/include/sys/termios.h
musl                      /usr/share/musl/src/include/sys/time.h
musl                      /usr/share/musl/src/include/sys/timeb.h
musl                      /usr/share/musl/src/include/sys/timerfd.h
musl                      /usr/share/musl/src/include/sys/times.h
musl                      /usr/share/musl/src/include/sys/timex.h
musl                      /usr/share/musl/src/include/sys/ttydefaults.h
musl                      /usr/share/musl/src/include/sys/types.h
musl                      /usr/share/musl/src/include/sys/ucontext.h
musl                      /usr/share/musl/src/include/sys/uio.h
musl                      /usr/share/musl/src/include/sys/un.h
musl                      /usr/share/musl/src/include/sys/user.h
musl                      /usr/share/musl/src/include/sys/utsname.h
musl                      /usr/share/musl/src/include/sys/vfs.h
musl                      /usr/share/musl/src/include/sys/vt.h
musl                      /usr/share/musl/src/include/sys/wait.h
musl                      /usr/share/musl/src/include/sys/xattr.h
musl                      /usr/share/musl/src/include/syscall.h
musl                      /usr/share/musl/src/include/sysexits.h
musl                      /usr/share/musl/src/include/syslog.h
musl                      /usr/share/musl/src/include/tar.h
musl                      /usr/share/musl/src/include/termios.h
musl                      /usr/share/musl/src/include/tgmath.h
musl                      /usr/share/musl/src/include/threads.h
musl                      /usr/share/musl/src/include/time.h
musl                      /usr/share/musl/src/include/uchar.h
musl                      /usr/share/musl/src/include/ucontext.h
musl                      /usr/share/musl/src/include/ulimit.h
musl                      /usr/share/musl/src/include/unistd.h
musl                      /usr/share/musl/src/include/utime.h
musl                      /usr/share/musl/src/include/utmp.h
musl                      /usr/share/musl/src/include/utmpx.h
musl                      /usr/share/musl/src/include/values.h
musl                      /usr/share/musl/src/include/wait.h
musl                      /usr/share/musl/src/include/wchar.h
musl                      /usr/share/musl/src/include/wctype.h
musl                      /usr/share/musl/src/include/wordexp.h

It includes the ld-musl-x86_64.so.1 library therefore the musl Compiler works and the Executable runs too.

I would like to test the Rust hello-world Application from your example but how can I add the x86_64-unknown-linux-musl target without rustup since I am using the Centos7 rust Packages?

I installed musl-tools v1.1.19-1 in Ubuntu 18. The memcpy example compiled and be linked statically.

% musl-gcc -static memcpy.c
% ldd a.out
	not a dynamic executable
% file a.out
a.out: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, with debug_info, not stripped

There is no need to compile crates in Centos 7 if you build statically with musl.
The statically linked binary should run on Centos 6.

Searching around I found this Post that helped me to sort out the Problem
Statically Linking glibc

The linker cannot find the C libraries required for statically linking your library. You can try and see if libc.a already exists on your system

The Envrionment Variable LD_LIBRARY_PATH did not help:

$ export LD_LIBRARY_PATH=/usr/share/musl/lib/
$ musl-gcc -static memcpy.c
/usr/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status

So I searched in the Repositorio which Package provides that file:

# yum provides */libc.a
glibc-static-2.17-307.el7.1.x86_64 : C library static libraries for -static linking.
Repo        : base
Matched from:
Filename    : /usr/lib64/libc.a

musl-1.2.0-1.x86_64 : Implementation of the C standard library on top of the Linux system call API
Repo        : installed
Matched from:
Filename    : /usr/share/musl/lib/libc.a

After installing the glibc-static Package I could successfully complile the Test Application:

$ musl-gcc -static memcpy.c
$ ldd a.out
	not a dynamic executable
$ objdump -T a.out

a.out:     file format elf64-x86-64

objdump: a.out: not a dynamic object
DYNAMIC SYMBOL TABLE:
no symbols

So, the musl Compiler works but still I cannot cross-compile Rust Applications with it.
I found this information:
Cross Compiling with Cargo

But it does not explain how I can install the missing Static std Library to be able to statically compile the Rust Application without using the rustup tool.

I'm not really sure, you could try to download and extract https://static.rust-lang.org/dist/rust-std-1.45.2-x86_64-unknown-linux-musl.tar.gz to lib dir of rust package. Replace "1.45.2" in the URL with your desired Rust version.

Edit: You could find the URL of the tarball in https://forge.rust-lang.org/infra/other-installation-methods.html#standalone-installers

Do you contact to package maintainer of musl on Centos ? If I were you, I would do that.

On Centos there is no musl Package so I built the musl Package myself from the Official Source Code Release.

I thought "rust-std-1.43.0-x86_64-unknown-linux-musl.tar.gz" would be matching with my Rust Compiler

$ rustc --version
rustc 1.43.0

but the Binaries produced an incompatibilty error:

$ echo 'fn main() { println!("Hello World!"); }' | rustc - --target x86_64-unknown-linux-musl
error[E0514]: found crate `std` compiled by an incompatible version of rustc
  |
  = help: please recompile that crate using this compiler (rustc 1.43.0)
  = note: the following crate versions were found:
          crate `std` compiled by rustc 1.43.0 (4fb7144ed 2020-04-20): /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-e8c0e82ceeca10f6.rlib
          crate `std` compiled by rustc 1.43.0 (4fb7144ed 2020-04-20): /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-e8c0e82ceeca10f6.so

error: aborting due to previous error

I installed the Binaries matching the already existing Static Binaries of the Standard Library:

$ rpm -q --filesbypkg -p rust-std-musl-static-1.43.0-1.x86_64.rpm
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/crt1.o
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/crti.o
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/crtn.o
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc-dcb2ca9bba0dcaf0.rlib
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libbacktrace-411a6d2a665669d4.rlib
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libbacktrace_sys-8f130c3eb2699b97.rlib
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libcfg_if-50fc5111220e69d4.rlib
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libcompiler_builtins-a21c5fd116c0905d.rlib
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libcore-29f38bedcf39ca34.rlib
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libgetopts-0a776824252e0326.rlib
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libhashbrown-5cf36915c9ac79cb.rlib
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/liblibc-44803ddf94d24647.rlib
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libpanic_abort-baea1b1ae0bebffb.rlib
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libpanic_unwind-4c27f610666d2beb.rlib
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libproc_macro-c359b3e5ef721fa5.rlib
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_demangle-e7fdfc5b83acfa20.rlib
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_alloc-fbedac6f456b9e49.rlib
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_core-e63ab8b56a25a562.rlib
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_std-51f70eaabb85cdc3.rlib
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-e8c0e82ceeca10f6.rlib
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-e8c0e82ceeca10f6.so
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libterm-c5778cf33005183e.rlib
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libtest-d8118bf764659a15.rlib
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libtest-d8118bf764659a15.so
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libunicode_width-338cbe2c4d727dc7.rlib
rust-std-musl-static      /usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libunwind-c390e07732dc7180.rlib
rust-std-musl-static      /usr/share/doc/rust-1.43.0/x86_64-unknown-linux-musl/install.sh
rust-std-musl-static      /usr/share/doc/rust-1.43.0/x86_64-unknown-linux-musl/manifest.in
rust-std-musl-static      /usr/share/doc/rust-1.43.0/x86_64-unknown-linux-musl/rust-installer-version

Sorry, my mistake there. I guess your rustc is from CentOS repository. Which mean that it might be compiled by different environment (including LLVM) than Rust CI infrastructure. So musl target you downloaded might be incompatible with rustc you are using.

Since you don't want to use rustup, and CentOS doesn't provide musl package and rust-musl std.
You will have to:

  1. Build rustc and std yourself, and cach the artifacts for your CI pipelines.
  2. (unlikely) Ask for musl and rust-musl std package from CentOS or find an alternative repository that provide it.
  3. Use rustup.