Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined reference to pthread_* #18

Closed
TimNN opened this issue May 25, 2015 · 3 comments
Closed

undefined reference to pthread_* #18

TimNN opened this issue May 25, 2015 · 3 comments

Comments

@TimNN
Copy link

TimNN commented May 25, 2015

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!!!

@DiamondLovesYou
Copy link
Owner

Hey, could you try another build, but this time using pepper_43 from the nacl_sdk? pthread_rwlock_* functions were a recent addition, though I'm not sure how recent TBH. Also, I've made another merge myself, so be sure to do a pull && checkout before trying.

Let me know how it goes!

@TimNN
Copy link
Author

TimNN commented May 29, 2015

Argh, I didn't even think about the possibility that the pepper version might be the problem.

Anyway, using pepper_43 and the latest version solved the problem and everything is building & running just fine!

@TimNN TimNN closed this as completed May 29, 2015
@DiamondLovesYou
Copy link
Owner

Sweet, and I'll update the README.md so others don't experience this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants