Skip to content

Instantly share code, notes, and snippets.

@jonas-hagen
Created April 18, 2019 09:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonas-hagen/8bdc17bc80d340293530fc84b147003e to your computer and use it in GitHub Desktop.
Save jonas-hagen/8bdc17bc80d340293530fc84b147003e to your computer and use it in GitHub Desktop.
RUSTFLAGS='-C target-feature=-crt-static' cargo build --target x86_64-unknown-linux-musl --verbose
user@host:~/rust/hello$ RUSTFLAGS='-C target-feature=-crt-static' cargo build --target x86_64-unknown-linux-musl --verbose
Compiling hello v0.1.0 (/home/user/rust/hello)
Running `rustc --edition=2018 --crate-name hello src/main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=3f62c9b72a7eac0b -C extra-filename=-3f62c9b72a7eac0b --out-dir /home/user/rust/hello/target/x86_64-unknown-linux-musl/debug/deps --target x86_64-unknown-linux-musl -C incremental=/home/user/rust/hello/target/x86_64-unknown-linux-musl/debug/incremental -L dependency=/home/user/rust/hello/target/x86_64-unknown-linux-musl/debug/deps -L dependency=/home/user/rust/hello/target/debug/deps -C target-feature=-crt-static`
error: linking with `cc` failed: exit code: 1
|
= note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-Wl,--eh-frame-hdr" "-m64" "-L" "/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib" "/home/user/rust/hello/target/x86_64-unknown-linux-musl/debug/deps/hello-3f62c9b72a7eac0b.1fdvtkcac9ltglrv.rcgu.o" "/home/user/rust/hello/target/x86_64-unknown-linux-musl/debug/deps/hello-3f62c9b72a7eac0b.3ecjf9a3juoekr0f.rcgu.o" "/home/user/rust/hello/target/x86_64-unknown-linux-musl/debug/deps/hello-3f62c9b72a7eac0b.3zyxunxn3450ttu3.rcgu.o" "/home/user/rust/hello/target/x86_64-unknown-linux-musl/debug/deps/hello-3f62c9b72a7eac0b.47u1ju8z3bebakvk.rcgu.o" "/home/user/rust/hello/target/x86_64-unknown-linux-musl/debug/deps/hello-3f62c9b72a7eac0b.4gocfck0l8011cue.rcgu.o" "/home/user/rust/hello/target/x86_64-unknown-linux-musl/debug/deps/hello-3f62c9b72a7eac0b.v8f1ilfg5afb5pr.rcgu.o" "-o" "/home/user/rust/hello/target/x86_64-unknown-linux-musl/debug/deps/hello-3f62c9b72a7eac0b" "/home/user/rust/hello/target/x86_64-unknown-linux-musl/debug/deps/hello-3f62c9b72a7eac0b.5cb8ppa7pn0ghg4s.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/home/user/rust/hello/target/x86_64-unknown-linux-musl/debug/deps" "-L" "/home/user/rust/hello/target/debug/deps" "-L" "/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib" "-Wl,--start-group" "-Wl,-Bstatic" "/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-b7bb6e71134c511a.rlib" "/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libpanic_unwind-9c2fff323171a4ed.rlib" "/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libbacktrace_sys-b0bea738882d79e2.rlib" "/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_demangle-4bff9a3b3b6ba3ea.rlib" "/tmp/rustcUvIuWu/libunwind-ffb1469c220391d3.rlib" "/tmp/rustcUvIuWu/liblibc-f2d3728c0c41ab7f.rlib" "/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc-0429fee8594f810b.rlib" "/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_core-a8a62c942473b9ac.rlib" "/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libcore-7ebbee0e600cbe29.rlib" "-Wl,--end-group" "/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libcompiler_builtins-96e9e812c111eadd.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lc"
= note: /usr/bin/ld: /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-b7bb6e71134c511a.rlib(std-b7bb6e71134c511a.std.98ukvmop-cgu.0.rcgu.o): in function `resolve_symname<closure>':
/rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/backtrace/printing/dladdr.rs:14: undefined reference to `dladdr'
/usr/bin/ld: /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-b7bb6e71134c511a.rlib(std-b7bb6e71134c511a.std.98ukvmop-cgu.0.rcgu.o): in function `init':
/rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/mutex.rs:44: undefined reference to `pthread_mutexattr_init'
/usr/bin/ld: /rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/mutex.rs:46: undefined reference to `pthread_mutexattr_settype'
/usr/bin/ld: /rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/mutex.rs:50: undefined reference to `pthread_mutexattr_destroy'
/usr/bin/ld: /rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/mutex.rs:97: undefined reference to `pthread_mutexattr_init'
/usr/bin/ld: /rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/mutex.rs:99: undefined reference to `pthread_mutexattr_settype'
/usr/bin/ld: /rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/mutex.rs:104: undefined reference to `pthread_mutexattr_destroy'
/usr/bin/ld: /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-b7bb6e71134c511a.rlib(std-b7bb6e71134c511a.std.98ukvmop-cgu.0.rcgu.o): in function `resolve_symname<closure>':
/rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/backtrace/printing/dladdr.rs:14: undefined reference to `dladdr'
/usr/bin/ld: /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-b7bb6e71134c511a.rlib(std-b7bb6e71134c511a.std.98ukvmop-cgu.0.rcgu.o): in function `create':
/rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/thread_local.rs:10: undefined reference to `pthread_key_create'
/usr/bin/ld: /rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/thread_local.rs:10: undefined reference to `pthread_key_create'
/usr/bin/ld: /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-b7bb6e71134c511a.rlib(std-b7bb6e71134c511a.std.98ukvmop-cgu.0.rcgu.o): in function `destroy':
/rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/thread_local.rs:27: undefined reference to `pthread_key_delete'
/usr/bin/ld: /rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/thread_local.rs:27: undefined reference to `pthread_key_delete'
/usr/bin/ld: /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-b7bb6e71134c511a.rlib(std-b7bb6e71134c511a.std.98ukvmop-cgu.0.rcgu.o): in function `create':
/rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/thread_local.rs:10: undefined reference to `pthread_key_create'
/usr/bin/ld: /rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/thread_local.rs:10: undefined reference to `pthread_key_create'
/usr/bin/ld: /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-b7bb6e71134c511a.rlib(std-b7bb6e71134c511a.std.98ukvmop-cgu.0.rcgu.o): in function `destroy':
/rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/thread_local.rs:27: undefined reference to `pthread_key_delete'
/usr/bin/ld: /rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/thread_local.rs:27: undefined reference to `pthread_key_delete'
/usr/bin/ld: /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-b7bb6e71134c511a.rlib(std-b7bb6e71134c511a.std.98ukvmop-cgu.0.rcgu.o): in function `get':
/rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/thread_local.rs:22: undefined reference to `pthread_getspecific'
/usr/bin/ld: /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-b7bb6e71134c511a.rlib(std-b7bb6e71134c511a.std.98ukvmop-cgu.0.rcgu.o): in function `create':
/rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/thread_local.rs:10: undefined reference to `pthread_key_create'
/usr/bin/ld: /rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/thread_local.rs:10: undefined reference to `pthread_key_create'
/usr/bin/ld: /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-b7bb6e71134c511a.rlib(std-b7bb6e71134c511a.std.98ukvmop-cgu.0.rcgu.o): in function `destroy':
/rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/thread_local.rs:27: undefined reference to `pthread_key_delete'
/usr/bin/ld: /rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/thread_local.rs:27: undefined reference to `pthread_key_delete'
/usr/bin/ld: /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-b7bb6e71134c511a.rlib(std-b7bb6e71134c511a.std.98ukvmop-cgu.0.rcgu.o): in function `set':
/rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/thread_local.rs:16: undefined reference to `pthread_setspecific'
/usr/bin/ld: /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-b7bb6e71134c511a.rlib(std-b7bb6e71134c511a.std.98ukvmop-cgu.0.rcgu.o): in function `create':
/rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/thread_local.rs:10: undefined reference to `pthread_key_create'
/usr/bin/ld: /rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/thread_local.rs:10: undefined reference to `pthread_key_create'
/usr/bin/ld: /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-b7bb6e71134c511a.rlib(std-b7bb6e71134c511a.std.98ukvmop-cgu.0.rcgu.o): in function `destroy':
/rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/thread_local.rs:27: undefined reference to `pthread_key_delete'
/usr/bin/ld: /rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/thread_local.rs:27: undefined reference to `pthread_key_delete'
/usr/bin/ld: /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-b7bb6e71134c511a.rlib(std-b7bb6e71134c511a.std.98ukvmop-cgu.0.rcgu.o): in function `get':
/rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/thread_local.rs:22: undefined reference to `pthread_getspecific'
/usr/bin/ld: /rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/thread_local.rs:22: undefined reference to `pthread_getspecific'
/usr/bin/ld: /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-b7bb6e71134c511a.rlib(std-b7bb6e71134c511a.std.98ukvmop-cgu.0.rcgu.o): in function `create':
/rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/thread_local.rs:10: undefined reference to `pthread_key_create'
/usr/bin/ld: /rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/thread_local.rs:10: undefined reference to `pthread_key_create'
/usr/bin/ld: /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-b7bb6e71134c511a.rlib(std-b7bb6e71134c511a.std.98ukvmop-cgu.0.rcgu.o): in function `destroy':
/rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/thread_local.rs:27: undefined reference to `pthread_key_delete'
/usr/bin/ld: /rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/thread_local.rs:27: undefined reference to `pthread_key_delete'
/usr/bin/ld: /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-b7bb6e71134c511a.rlib(std-b7bb6e71134c511a.std.98ukvmop-cgu.0.rcgu.o): in function `set':
/rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/thread_local.rs:16: undefined reference to `pthread_setspecific'
/usr/bin/ld: /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-b7bb6e71134c511a.rlib(std-b7bb6e71134c511a.std.98ukvmop-cgu.0.rcgu.o): in function `read':
/rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/rwlock.rs:23: undefined reference to `pthread_rwlock_rdlock'
/usr/bin/ld: /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-b7bb6e71134c511a.rlib(std-b7bb6e71134c511a.std.98ukvmop-cgu.0.rcgu.o): in function `raw_unlock':
/rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/rwlock.rs:102: undefined reference to `pthread_rwlock_unlock'
/usr/bin/ld: /rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/rwlock.rs:102: undefined reference to `pthread_rwlock_unlock'
/usr/bin/ld: /home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-b7bb6e71134c511a.rlib(std-b7bb6e71134c511a.std.98ukvmop-cgu.0.rcgu.o): in function `std::sys::unix::condvar::Condvar::init':
/rustc/2975a3c4befa8ad610da2e3c5f5de351d6d70a2b//src/libstd/sys/unix/condvar.rs:47: undefined reference to `pthread_condattr_setclock'
/usr/bin/ld: /usr/bin/ld generated: undefined reference to `pthread_getspecific'
/usr/bin/ld: /usr/bin/ld generated: undefined reference to `pthread_key_create'
/usr/bin/ld: /usr/bin/ld generated: undefined reference to `pthread_setspecific'
collect2: error: ld returned 1 exit status
error: aborting due to previous error
error: Could not compile `hello`.
Caused by:
process didn't exit successfully: `rustc --edition=2018 --crate-name hello src/main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=3f62c9b72a7eac0b -C extra-filename=-3f62c9b72a7eac0b --out-dir /home/user/rust/hello/target/x86_64-unknown-linux-musl/debug/deps --target x86_64-unknown-linux-musl -C incremental=/home/user/rust/hello/target/x86_64-unknown-linux-musl/debug/incremental -L dependency=/home/user/rust/hello/target/x86_64-unknown-linux-musl/debug/deps -L dependency=/home/user/rust/hello/target/debug/deps -C target-feature=-crt-static` (exit code: 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment