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

Cannot build rust std with llvm-libc #117180

Open
SchrodingerZhu opened this issue Nov 21, 2024 · 3 comments
Open

Cannot build rust std with llvm-libc #117180

SchrodingerZhu opened this issue Nov 21, 2024 · 3 comments
Labels

Comments

@SchrodingerZhu
Copy link
Contributor

Tracking what is needed:

  = note: /usr/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000001000
          /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o): in function `version_lock_lock_exclusive':
          (.text+0x6d2): undefined reference to `pthread_cond_wait'
          /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o): in function `btree_allocate_node':
          (.text+0x1b1b): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: (.text+0x1b47): undefined reference to `malloc'
          /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o): in function `btree_remove':
          (.text+0x295d): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: (.text+0x2c56): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: (.text+0x3a28): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: (.text+0x42b2): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: (.text+0x4327): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o):(.text+0x4356): more undefined references to `pthread_cond_broadcast' follow
          /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o): in function `__deregister_frame_info_bases.part.0':
          (.text+0x4938): undefined reference to `free'
          /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o): in function `btree_insert.isra.0':
          (.text+0x4f19): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: (.text+0x58b6): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: (.text+0x5900): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: (.text+0x5937): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: (.text+0x5999): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o):(.text+0x5aa9): more undefined references to `pthread_cond_broadcast' follow
          /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o): in function `btree_insert.isra.0':
          (.text+0x5b28): undefined reference to `malloc'
          /usr/bin/ld: (.text+0x5c7b): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: (.text+0x5eb1): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o): in function `__register_frame':
          (.text+0x62db): undefined reference to `malloc'
          /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o): in function `__register_frame_table':
          (.text+0x637f): undefined reference to `malloc'
          /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o): in function `__deregister_frame':
          (.text+0x6412): undefined reference to `free'
          /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o): in function `_Unwind_Find_FDE':
          (.text+0x645d): undefined reference to `_dl_find_object'
          /usr/bin/ld: (.text+0x6650): undefined reference to `_dl_find_object'
          /usr/bin/ld: (.text+0x6c84): undefined reference to `malloc'
          /usr/bin/ld: (.text+0x6ca1): undefined reference to `malloc'
          /usr/bin/ld: (.text+0x6d69): undefined reference to `free'
          /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o): in function `btree_release_tree_recursively':
          (.text.exit+0x4fa): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: (.text.exit+0x53a): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: (.text.exit+0x57a): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: (.text.exit+0x5ba): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: (.text.exit+0x5f9): undefined reference to `pthread_cond_broadcast'
          /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o):(.text.exit+0x63a): more undefined references to `pthread_cond_broadcast' follow
          /usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/14.2.1/libgcc_eh.a(unwind-dw2-fde-dip.o): in function `btree_destroy':
          (.text.exit+0x739): undefined reference to `free'
          /usr/bin/ld: /home/schrodingerzy/Documents/rust-linux-llvm/target/x86_64-llvm-linux-gnu/release/build/llvmlibc-src-88805f0fbbe903d2/out/build/lib/libc.a(dir.cpp.o): in function `__llvm_libc::internal::convert_clock(timespec, int, int)':
          dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0x42): undefined reference to `__llvm_libc::vdso::Symbol::once_flag'
          /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0x4e): undefined reference to `__llvm_libc::vdso::Symbol::once_flag'
          /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0x55): undefined reference to `__llvm_libc::vdso::Symbol::initialize_vdso_global_cache()'
          /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0x61): undefined reference to `__llvm_libc::vdso::Symbol::global_cache'
          /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0x70): undefined reference to `__llvm_libc::vdso::Symbol::once_flag'
          /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0x7c): undefined reference to `__llvm_libc::vdso::Symbol::once_flag'
          /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0x83): undefined reference to `__llvm_libc::vdso::Symbol::initialize_vdso_global_cache()'
          /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0x8f): undefined reference to `__llvm_libc::vdso::Symbol::global_cache'
          /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0x9f): undefined reference to `__llvm_libc::vdso::Symbol::once_flag'
          /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0xab): undefined reference to `__llvm_libc::vdso::Symbol::once_flag'
          /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0xb2): undefined reference to `__llvm_libc::vdso::Symbol::initialize_vdso_global_cache()'
          /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0xbe): undefined reference to `__llvm_libc::vdso::Symbol::global_cache'
          /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0xc9): undefined reference to `__llvm_libc::vdso::Symbol::once_flag'
          /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0xd5): undefined reference to `__llvm_libc::vdso::Symbol::once_flag'
          /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0xdc): undefined reference to `__llvm_libc::vdso::Symbol::initialize_vdso_global_cache()'
          /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0xe8): undefined reference to `__llvm_libc::vdso::Symbol::global_cache'
          /usr/bin/ld: dir.cpp:(.text._ZN11__llvm_libc8internal13convert_clockE8timespecii[_ZN11__llvm_libc8internal13convert_clockE8timespecii]+0x106): undefined reference to `__llvm_libc::vdso::Symbol::once_flag'
          /usr/bin/ld: /home/schrodingerzy/Documents/rust-linux-llvm/target/x86_64-llvm-linux-gnu/release/examples/hello-5fd76d54e23d8ded: hidden symbol `_ZN11__llvm_libc4vdso6Symbol9once_flagE' isn't defined
          /usr/bin/ld: final link failed: bad value
          collect2: error: ld returned 1 exit status
@github-actions github-actions bot added the libc label Nov 21, 2024
@SchrodingerZhu
Copy link
Contributor Author

@SchrodingerZhu
Copy link
Contributor Author

I can fix the malloc stuff but pthread_cond_* is really missing.

@nickdesaulniers
Copy link
Member

nickdesaulniers commented Nov 21, 2024

pthread_cond_* is tracked in #85282. I started this with #88580 as it seems we have most (all?) of c11 condition variable support, so it should be possible to reuse that between C11 threads and pthreads.

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

No branches or pull requests

2 participants