Skip to content

Compile Error #4

@willamhou

Description

@willamhou

I try to compile this source code, it always have error~~such as this~

And I read the cmakeList, I found there are lack of codes for cmakelist. such as third_party directory~

Determining if the pthread_create exist failed with the following output:
Change Dir: /mnt/e/360downloads/brpc_faiss_server-master/brpc_faiss_server-master/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_f78cc/fast"
/usr/bin/make -f CMakeFiles/cmTC_f78cc.dir/build.make CMakeFiles/cmTC_f78cc.dir/build
make[1]: Entering directory '/mnt/e/360downloads/brpc_faiss_server-master/brpc_faiss_server-master/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_f78cc.dir/CheckSymbolExists.c.o
/usr/bin/cc -o CMakeFiles/cmTC_f78cc.dir/CheckSymbolExists.c.o -c /mnt/e/360downloads/brpc_faiss_server-master/brpc_faiss_server-master/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTC_f78cc
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_f78cc.dir/link.txt --verbose=1
/usr/bin/cc CMakeFiles/cmTC_f78cc.dir/CheckSymbolExists.c.o -o cmTC_f78cc
CMakeFiles/cmTC_f78cc.dir/CheckSymbolExists.c.o: In function main': CheckSymbolExists.c:(.text+0x1b): undefined reference to pthread_create'
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_f78cc.dir/build.make:97: recipe for target 'cmTC_f78cc' failed
make[1]: *** [cmTC_f78cc] Error 1
make[1]: Leaving directory '/mnt/e/360downloads/brpc_faiss_server-master/brpc_faiss_server-master/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_f78cc/fast' failed
make: *** [cmTC_f78cc/fast] Error 2

File /mnt/e/360downloads/brpc_faiss_server-master/brpc_faiss_server-master/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>

int main(int argc, char** argv)
{
(void)argv;
#ifndef pthread_create
return ((int*)(&pthread_create))[argc];
#else
(void)argc;
return 0;
#endif
}

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /mnt/e/360downloads/brpc_faiss_server-master/brpc_faiss_server-master/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_3ad94/fast"
/usr/bin/make -f CMakeFiles/cmTC_3ad94.dir/build.make CMakeFiles/cmTC_3ad94.dir/build
make[1]: Entering directory '/mnt/e/360downloads/brpc_faiss_server-master/brpc_faiss_server-master/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_3ad94.dir/CheckFunctionExists.c.o
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_3ad94.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.10/Modules/CheckFunctionExists.c
Linking C executable cmTC_3ad94
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_3ad94.dir/link.txt --verbose=1
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTC_3ad94.dir/CheckFunctionExists.c.o -o cmTC_3ad94 -lpthreads
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_3ad94.dir/build.make:97: recipe for target 'cmTC_3ad94' failed
make[1]: *** [cmTC_3ad94] Error 1
make[1]: Leaving directory '/mnt/e/360downloads/brpc_faiss_server-master/brpc_faiss_server-master/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_3ad94/fast' failed
make: *** [cmTC_3ad94/fast] Error 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions