[AMBER] About the pthread error of installing the amber22(CUDA)

From: Yeng-Tseng Wang via AMBER <amber.ambermd.org>
Date: Tue, 3 Jan 2023 11:33:17 +0800

Dear all,
I have installed the pthreads lib (libpthreads.so and libpthread.so) in the
/usr/lib64 file.
But I still got the error message. I also tried and successed to compile
the test code (gcc -lpthreads test.c). Cloud you tell me how to fix problem
?
Thanks a lot
Yeng-Tseng Wang



test code: (test.c)
--------------------------------------------------------------------------------------------------
#include <pthread.h>

static void* test_func(void* data)
{
  return data;
}

int main(void)
{
  pthread_t thread;
  pthread_create(&thread, NULL, test_func, NULL);
  pthread_detach(thread);
  pthread_cancel(thread);
  pthread_join(thread, NULL);
  pthread_atfork(NULL, NULL, NULL);
  pthread_exit(NULL);

  return 0;
}




ERROR:
-------------------------------------------------------------------------------------------------------------
Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the
following output:
Change Dir: /home/c00jsw00/bin/amber22_src/build/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_99706/fast &&
/usr/bin/gmake -f CMakeFiles/cmTC_99706.dir/build.make
CMakeFiles/cmTC_99706.dir/build
gmake[1]: Entering directory
'/home/c00jsw00/bin/amber22_src/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_99706.dir/src.c.o
/usr/bin/gcc -DCMAKE_HAVE_LIBC_PTHREAD -fPIC -std=gnu99 -o
CMakeFiles/cmTC_99706.dir/src.c.o -c
/home/c00jsw00/bin/amber22_src/build/CMakeFiles/CMakeTmp/src.c
Linking C executable cmTC_99706
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_99706.dir/link.txt
--verbose=1
/usr/bin/gcc -fPIC CMakeFiles/cmTC_99706.dir/src.c.o -o cmTC_99706
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld:
CMakeFiles/cmTC_99706.dir/src.c.o: in function `main':
src.c:(.text+0x2f): undefined reference to `pthread_create'
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld:
src.c:(.text+0x3b): undefined reference to `pthread_detach'
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld:
src.c:(.text+0x47): undefined reference to `pthread_cancel'
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld:
src.c:(.text+0x58): undefined reference to `pthread_join'
collect2: error: ld returned 1 exit status
gmake[1]: *** [CMakeFiles/cmTC_99706.dir/build.make:99: cmTC_99706] Error 1
gmake[1]: Leaving directory
'/home/c00jsw00/bin/amber22_src/build/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:127: cmTC_99706/fast] Error 2

Source file was:

--------------------------------------------------------------
#include <pthread.h>

static void* test_func(void* data)
{
  return data;
}

int main(void)
{
  pthread_t thread;
  pthread_create(&thread, NULL, test_func, NULL);
  pthread_detach(thread);
  pthread_cancel(thread);
  pthread_join(thread, NULL);
  pthread_atfork(NULL, NULL, NULL);
  pthread_exit(NULL);

  return 0;
}
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Mon Jan 02 2023 - 20:00:03 PST
Custom Search