Skip to content

problem of cmake  #74

@newExplore-hash

Description

@newExplore-hash

when run cmake , there are some errors ,tks for your reply

Performing C SOURCE FILE Test CMAKE_HAVE_LIBC_PTHREAD failed with the following output:
Change Dir: /data/zhuzikui/ExocortexCrate/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake cmTC_48f36/fast && /usr/bin/gmake -f CMakeFiles/cmTC_48f36.dir/build.make CMakeFiles/cmTC_48f36.dir/build
gmake[1]: Entering directory /data/zhuzikui/ExocortexCrate/build/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_48f36.dir/src.c.o /opt/rh/devtoolset-7/root/usr/bin/cc -fPIC -DCMAKE_HAVE_LIBC_PTHREAD -o CMakeFiles/cmTC_48f36.dir/src.c.o -c /data/zhuzikui/ExocortexCrate/build/CMakeFiles/CMakeTmp/src.c Linking C executable cmTC_48f36 /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_48f36.dir/link.txt --verbose=1 /opt/rh/devtoolset-7/root/usr/bin/cc -fPIC -DCMAKE_HAVE_LIBC_PTHREAD -rdynamic CMakeFiles/cmTC_48f36.dir/src.c.o -o cmTC_48f36 CMakeFiles/cmTC_48f36.dir/src.c.o: In function main':
src.c:(.text+0x2f): undefined reference to pthread_create' src.c:(.text+0x3b): undefined reference to pthread_detach'
src.c:(.text+0x47): undefined reference to pthread_cancel' src.c:(.text+0x58): undefined reference to pthread_join'
src.c:(.text+0x6c): undefined reference to pthread_atfork' collect2: error: ld returned 1 exit status gmake[1]: *** [cmTC_48f36] Error 1 gmake[1]: Leaving directory /data/zhuzikui/ExocortexCrate/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTC_48f36/fast] Error 2

Source file was:
#include <pthread.h>

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;
}

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /data/zhuzikui/ExocortexCrate/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake cmTC_67cfa/fast && /usr/bin/gmake -f CMakeFiles/cmTC_67cfa.dir/build.make CMakeFiles/cmTC_67cfa.dir/build
gmake[1]: Entering directory /data/zhuzikui/ExocortexCrate/build/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_67cfa.dir/CheckFunctionExists.c.o /opt/rh/devtoolset-7/root/usr/bin/cc -fPIC -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_67cfa.dir/CheckFunctionExists.c.o -c /usr/local/share/cmake-3.18/Modules/CheckFunctionExists.c Linking C executable cmTC_67cfa /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_67cfa.dir/link.txt --verbose=1 /opt/rh/devtoolset-7/root/usr/bin/cc -fPIC -DCHECK_FUNCTION_EXISTS=pthread_create -rdynamic CMakeFiles/cmTC_67cfa.dir/CheckFunctionExists.c.o -o cmTC_67cfa -lpthreads /opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld: cannot find -lpthreads collect2: error: ld returned 1 exit status gmake[1]: *** [cmTC_67cfa] Error 1 gmake[1]: Leaving directory /data/zhuzikui/ExocortexCrate/build/CMakeFiles/CMakeTmp'
gmake: *** [cmTC_67cfa/fast] Error 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions