Skip to content

undefined reference to pthread_* #18

@TimNN

Description

@TimNN

I'm currently trying to get a minimal example (TimNN/nacl-rust-min) to work but linking fails due to undefined pthread symbols:

error: linking with `/home/logic/tmp/nacl_sdk/pepper_42/toolchain/linux_pnacl/bin/le32-nacl-ld.gold` failed: exit code: 1
note: "/home/logic/tmp/nacl_sdk/pepper_42/toolchain/linux_pnacl/bin/le32-nacl-ld.gold" "--oformat=elf32-i386-nacl" "-plugin=/home/logic/tmp/rust_nacl/lib/rustlib/x86_64-unknown-linux-gnu/lib/LLVMgold.so" "-plugin-opt=emit-llvm" "-nostdlib" "--undef-sym-check" "-static" "--allow-unresolved=memcpy" "--allow-unresolved=memset" "--allow-unresolved=memmove" "--allow-unresolved=setjmp" "--allow-unresolved=longjmp" "--allow-unresolved=__nacl_tp_tls_offset" "--allow-unresolved=__nacl_tp_tdb_offset" "--allow-unresolved=__nacl_get_arch" "--undefined=__pnacl_eh_stack" "--undefined=__pnacl_eh_resume" "--allow-unresolved=__pnacl_eh_type_table" "--allow-unresolved=__pnacl_eh_action_table" "--allow-unresolved=__pnacl_eh_filter_table" "--undefined=main" "--undefined=exit" "--undefined=_exit" "-o" "nacl_rust_min.post-link.bc" "-L" "/home/logic/tmp/rust_nacl/lib/rustlib/le32-unknown-nacl/lib" "--start-group" "nacl_rust_min.0.bc" "nacl_rust_min.r-ppapi_stub-ppapi_plugin_main_399d0cf7.o-0.bc" "nacl_rust_min.r-ppapi_stub-plugin_main_irt_21ce9d26.o-1.bc" "nacl_rust_min.r-ppapi_stub-ppapi_plugin_start_8da67623.o-2.bc" "nacl_rust_min.r-ppapi_stub-thread_creator_ccf263e1.o-3.bc" "/home/logic/tmp/rust_nacl/lib/rustlib/le32-unknown-nacl/lib/libstd-d8ace771.rlib" "/home/logic/tmp/rust_nacl/lib/rustlib/le32-unknown-nacl/lib/libcollections-d8ace771.rlib" "/home/logic/tmp/rust_nacl/lib/rustlib/le32-unknown-nacl/lib/librustc_unicode-d8ace771.rlib" "/home/logic/tmp/rust_nacl/lib/rustlib/le32-unknown-nacl/lib/librand-d8ace771.rlib" "/home/logic/tmp/rust_nacl/lib/rustlib/le32-unknown-nacl/lib/liballoc-d8ace771.rlib" "/home/logic/tmp/rust_nacl/lib/rustlib/le32-unknown-nacl/lib/liblibc-d8ace771.rlib" "/home/logic/tmp/rust_nacl/lib/rustlib/le32-unknown-nacl/lib/libcore-d8ace771.rlib" "--end-group"
note: /home/logic/tmp/rust_nacl/lib/rustlib/le32-unknown-nacl/lib/libstd-d8ace771.rlib: error: undefined reference to 'pthread_rwlock_destroy'
/home/logic/tmp/rust_nacl/lib/rustlib/le32-unknown-nacl/lib/libstd-d8ace771.rlib: error: undefined reference to 'pthread_rwlock_unlock'
/home/logic/tmp/rust_nacl/lib/rustlib/le32-unknown-nacl/lib/libstd-d8ace771.rlib: error: undefined reference to 'pthread_rwlock_trywrlock'
/home/logic/tmp/rust_nacl/lib/rustlib/le32-unknown-nacl/lib/libstd-d8ace771.rlib: error: undefined reference to 'pthread_rwlock_wrlock'
/home/logic/tmp/rust_nacl/lib/rustlib/le32-unknown-nacl/lib/libstd-d8ace771.rlib: error: undefined reference to 'pthread_rwlock_tryrdlock'
/home/logic/tmp/rust_nacl/lib/rustlib/le32-unknown-nacl/lib/libstd-d8ace771.rlib: error: undefined reference to 'pthread_rwlock_rdlock'

error: aborting due to previous error

Rust version: rustc 1.2.0-dev (2ab1e7955 2015-05-25) (built 2015-05-25)
Configured with: ./configure --target=le32-unknown-nacl --nacl-cross-path=$NACL_SDK_ROOT --prefix=/home/logic/tmp/rust_nacl --enable-ccache --disable-valgrind-rpass
Nacl SDK version: 42

Note that I did merge rust-lang/rust/master into DiamondLovesYou/rust/master because make install failed otherwise (rust-lang#25699) which worked without conflicts (You can find the result at TimNN/rust/upstream-tracking).

I'm not sure if the issue was caused by my merge or not, but I will try again tomorrow without my merge. (However, seeing as the diff from the merge does not include the word pthread I think it is unlikely that this would fix the problem.

Anyway, thank you for the great work!!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions