Skip to content

[libc][test] adds LINK_LIBRARIES pthread to pthreads test cmake #89262

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

Closed
wants to merge 2 commits into from

Conversation

Flandini
Copy link
Contributor

Fixes #89261.

cc @nickdesaulniers

fixes this for me. seems like others might not have the same issue, so lmk if i'm just building this wrong.

@llvmbot llvmbot added the libc label Apr 18, 2024
@llvmbot
Copy link
Member

llvmbot commented Apr 18, 2024

@llvm/pr-subscribers-libc

Author: Michael Flanders (Flandini)

Changes

Fixes #89261.

cc @nickdesaulniers

fixes this for me. seems like others might not have the same issue, so lmk if i'm just building this wrong.


Full diff: https://github.com/llvm/llvm-project/pull/89262.diff

1 Files Affected:

  • (modified) libc/test/src/pthread/CMakeLists.txt (+6)
diff --git a/libc/test/src/pthread/CMakeLists.txt b/libc/test/src/pthread/CMakeLists.txt
index 51954a5babd2c5..53a7a14f8d558c 100644
--- a/libc/test/src/pthread/CMakeLists.txt
+++ b/libc/test/src/pthread/CMakeLists.txt
@@ -19,6 +19,8 @@ add_libc_unittest(
     libc.src.pthread.pthread_attr_setguardsize
     libc.src.pthread.pthread_attr_setstacksize
     libc.src.pthread.pthread_attr_setstack
+  LINK_LIBRARIES
+    -lpthread
 )
 
 add_libc_unittest(
@@ -38,6 +40,8 @@ add_libc_unittest(
     libc.src.pthread.pthread_mutexattr_setpshared
     libc.src.pthread.pthread_mutexattr_setrobust
     libc.src.pthread.pthread_mutexattr_settype
+  LINK_LIBRARIES
+    -pthread
 )
 
 add_libc_unittest(
@@ -56,4 +60,6 @@ add_libc_unittest(
     libc.src.pthread.pthread_condattr_init
     libc.src.pthread.pthread_condattr_setclock
     libc.src.pthread.pthread_condattr_setpshared
+  LINK_LIBRARIES
+    -pthread
   )

@michaelrj-google
Copy link
Contributor

This shouldn't be necessary, since -lpthread just tells the compiler to link in the system's pthread library. If this test is actually using our library it shouldn't have any effect since we don't build a separate libpthread. Maybe try cleaning your build directory (with rm -r build/projects/libc) and rebuilding?

@nickdesaulniers
Copy link
Member

Do you have eefee38 on your branch?

nickdesaulniers added a commit to nickdesaulniers/llvm-project that referenced this pull request Apr 18, 2024
- use namespaced identifiers
- add corresponding headers for namespaced declarations
- replace time.h and errno.h with finer grain includes
- update cmake

Fixes: llvm#88987
Fixes: llvm#89261
Link: llvm#88997
Link: llvm#89262
@nickdesaulniers
Copy link
Member

Please let us know if #89308 helps resolve this issue for you? Sorry for my mistake creating a problem!

@Flandini
Copy link
Contributor Author

Please let us know if #89308 helps resolve this issue for you? Sorry for my mistake creating a problem!

Yup, that fixed it, thanks!

@Flandini Flandini closed this Apr 19, 2024
@Flandini Flandini deleted the pthreads-test-link-error branch April 19, 2024 14:55
nickdesaulniers added a commit that referenced this pull request Apr 19, 2024
- use namespaced identifiers
- add corresponding headers for namespaced declarations
- replace time.h and errno.h with finer grain includes
- update cmake

Fixes: #88987
Fixes: #89261
Link: #88997
Link: #89262
aniplcc pushed a commit to aniplcc/llvm-project that referenced this pull request Apr 21, 2024
- use namespaced identifiers
- add corresponding headers for namespaced declarations
- replace time.h and errno.h with finer grain includes
- update cmake

Fixes: llvm#88987
Fixes: llvm#89261
Link: llvm#88997
Link: llvm#89262
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[libc][test] link error running pthreads tests on linux, x86_64
4 participants