BelledonneCommunications / flexisip

Linphone.org mirror for flexisip (git://git.linphone.org/flexisip.git)
http://flexisip.org
GNU Affero General Public License v3.0
140 stars 68 forks source link

flexisip build fails with missing -lpthreads #117

Open M-Stenzel opened 3 years ago

M-Stenzel commented 3 years ago

Hallo team,

I want to build flexisip (ver 2.0.4) with cmake, as explained in the Installation document I left the default options when configuring:

./prepare.py -DENABLE_CONFERENCE=ON -DENABLE_JWE_AUTH_PLUGIN=ON -DENABLE_EXTERNAL_AUTH_PLUGIN=ON -DENABLE_PRESENCE=ON -DENABLE_PROTOBUF=ON -DENABLE_SNMP=ON -DENABLE_SOCI=ON -DENABLE_TRANSCODER=ON make -j8

However the build stops with


Determining if the pthread_create exist failed with the following output: Change Dir: /tmp/flexisip/WORK/flexisip/Build/flexisip/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/gmake" "cmTC_95546/fast" gmake[4]: Entering directory '/tmp/flexisip/WORK/flexisip/Build/flexisip/CMakeFiles/CMakeTmp' /usr/bin/gmake -f CMakeFiles/cmTC_95546.dir/build.make CMakeFiles/cmTC_95546.dir/build gmake[5]: Entering directory '/tmp/flexisip/WORK/flexisip/Build/flexisip/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_95546.dir/CheckSymbolExists.c.o /usr/bin/cc -o CMakeFiles/cmTC_95546.dir/CheckSymbolExists.c.o -c /tmp/flexisip/WORK/flexisip/Build/flexisip/CMakeFiles/CMakeTmp/CheckSymbolExists.c Linking C executable cmTC_95546 /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_95546.dir/link.txt --verbose=1 /usr/bin/cc -rdynamic CMakeFiles/cmTC_95546.dir/CheckSymbolExists.c.o -o cmTC_95546 /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: CMakeFiles/cmTC_95546.dir/CheckSymbolExists.c.o: in function main': CheckSymbolExists.c:(.text+0x1b): undefined reference topthread_create' collect2: error: ld returned 1 exit status gmake[5]: [CMakeFiles/cmTC_95546.dir/build.make:98: cmTC_95546] Error 1 gmake[5]: Leaving directory '/tmp/flexisip/WORK/flexisip/Build/flexisip/CMakeFiles/CMakeTmp' gmake[4]: [Makefile:126: cmTC_95546/fast] Error 2 gmake[4]: Leaving directory '/tmp/flexisip/WORK/flexisip/Build/flexisip/CMakeFiles/CMakeTmp'

File /tmp/flexisip/WORK/flexisip/Build/flexisip/CMakeFiles/CMakeTmp/CheckSymbolExists.c: / /

include

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: /tmp/flexisip/WORK/flexisip/Build/flexisip/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/gmake" "cmTC_08c61/fast" gmake[4]: Entering directory '/tmp/flexisip/WORK/flexisip/Build/flexisip/CMakeFiles/CMakeTmp' /usr/bin/gmake -f CMakeFiles/cmTC_08c61.dir/build.make CMakeFiles/cmTC_08c61.dir/build gmake[5]: Entering directory '/tmp/flexisip/WORK/flexisip/Build/flexisip/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_08c61.dir/CheckFunctionExists.c.o /usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_08c61.dir/CheckFunctionExists.c.o -c /usr/share/cmake/Modules/CheckFunctionExists.c Linking C executable cmTC_08c61 /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_08c61.dir/link.txt --verbose=1 /usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -rdynamic CMakeFiles/cmTC_08c61.dir/CheckFunctionExists.c.o -o cmTC_08c61 -lpthreads /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: cannot find -lpthreads collect2: error: ld returned 1 exit status gmake[5]: [CMakeFiles/cmTC_08c61.dir/build.make:98: cmTC_08c61] Error 1 gmake[5]: Leaving directory '/tmp/flexisip/WORK/flexisip/Build/flexisip/CMakeFiles/CMakeTmp' gmake[4]: [Makefile:126: cmTC_08c61/fast] Error 2 gmake[4]: Leaving directory '/tmp/flexisip/WORK/flexisip/Build/flexisip/CMakeFiles/CMakeTmp'


I added the option -DENABLE_CMAKE_CXX_FLAGS="-pthread" and I see that this option is being used, however, this does not help. Building stops at the very same point.

Where does the linker option "-lpthreads" does come from? I compiled many, many packages, including the ones making use of cmake, however, never ran into this problem. And I wonder why it is threads and not thread (additional "s" at the end).

Martin.

P. S. Compiler is gcc 7.5.0, cmake is 3.10.2 - if that matters.