<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>I updated to CMake 3.11.0, but still got the same error. I have gotten around the problem by removing the find_package and forcing -pthread on the C/C++ command line, however this is an unsatisfying resolution to the problem.</div><div><br>On Mar 30, 2018, at 12:06 PM, Andrew Brownsword <<a href="mailto:andrew.e.brownsword@gmail.com">andrew.e.brownsword@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div>I have an Ubuntu 16.04 ARMv7 system upon which I have built CLang 7.0 and am now trying to use it to build my CMake-based project that was previously working with the CLang 3.8.0 that I had installed via apt-get. The new compiler does appear to be selected correctly when I run cmake. The run fails when it tries this find_package call:<div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">set(THREADS_PREFER_PTHREAD_FLAG ON)</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">find_package(Threads REQUIRED)</div></div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class="">With this error:</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><font face="Menlo" size="4" class="">CMake Error at /usr/local/share/cmake-3.8/Modules/FindPackageHandleStandardArgs.cmake:137 (message):<br class=""> Could NOT find Threads (missing: Threads_FOUND)<br class="">Call Stack (most recent call first):<br class=""> /usr/local/share/cmake-3.8/Modules/FindPackageHandleStandardArgs.cmake:377 (_FPHSA_FAILURE_MESSAGE)<br class=""> /usr/local/share/cmake-3.8/Modules/FindThreads.cmake:212 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)<br class=""> src/libraries/civetweb/CMakeLists.txt:8 (find_package)<br class=""></font><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class="">The libpthread.so resides in /usr/lib/arm-linux-gnueabihf/ on this system. I am *not* cross-compiling, and I built CLang on the system itself. I’ve looked at the REGEX that CMake is supposed to use to find this subdirectory and it looks correct (and it did work with CLang 3.8.0).</div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class="">Any suggestions?</div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class="">The CMakeError.log file contains this:</div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">Determining if the pthread_create exist failed with the following output:</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">Change Dir: ~/CMakeFiles/CMakeTmp</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Helvetica; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">Run Build Command:"/usr/bin/make" "cmTC_1d4b8/fast"</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">/usr/bin/make -f CMakeFiles/cmTC_1d4b8.dir/build.make CMakeFiles/cmTC_1d4b8.dir/build</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">make[1]: Entering directory '~/CMakeFiles/CMakeTmp'</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">Building C object CMakeFiles/cmTC_1d4b8.dir/CheckSymbolExists.c.o</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">/usr/bin/clang -Wall -fno-strict-aliasing -o CMakeFiles/cmTC_1d4b8.dir/CheckSymbolExists.c.o -c ~/CMakeFiles/CMakeTmp/CheckSymbolExists.c</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">Linking C executable cmTC_1d4b8</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">/usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_1d4b8.dir/link.txt --verbose=1</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">/usr/bin/clang -Wall -fno-strict-aliasing CMakeFiles/cmTC_1d4b8.dir/CheckSymbolExists.c.o -o cmTC_1d4b8 </div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">CMakeFiles/cmTC_1d4b8.dir/CheckSymbolExists.c.o: In function `main':</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">~/CMakeFiles/CMakeTmp/CheckSymbolExists.c:(.text+0x4): undefined reference to `pthread_create'</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">~/CMakeFiles/CMakeTmp/CheckSymbolExists.c:(.text+0x8): undefined reference to `pthread_create'</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">~/CMakeFiles/CMakeTmp/CheckSymbolExists.c:(.text+0x24): undefined reference to `pthread_create'</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">~/CMakeFiles/CMakeTmp/CheckSymbolExists.c:(.text+0x28): undefined reference to `pthread_create'</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">clang: error: linker command failed with exit code 1 (use -v to see invocation)</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">CMakeFiles/cmTC_1d4b8.dir/build.make:97: recipe for target 'cmTC_1d4b8' failed</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">make[1]: *** [cmTC_1d4b8] Error 1</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">make[1]: Leaving directory '~/CMakeFiles/CMakeTmp'</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">Makefile:126: recipe for target 'cmTC_1d4b8/fast' failed</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">make: *** [cmTC_1d4b8/fast] Error 2</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Helvetica; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">File ~/CMakeFiles/CMakeTmp/CheckSymbolExists.c:</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">/* */</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">#include <pthread.h></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Helvetica; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">int main(int argc, char** argv)</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">{</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class=""> (void)argv;</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">#ifndef pthread_create</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class=""> return ((int*)(&pthread_create))[argc];</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">#else</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class=""> (void)argc;</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class=""> return 0;</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">#endif</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">}</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Helvetica; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">Determining if the function pthread_create exists in the pthreads failed with the following output:</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">Change Dir: ~/CMakeFiles/CMakeTmp</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Helvetica; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">Run Build Command:"/usr/bin/make" "cmTC_81507/fast"</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">/usr/bin/make -f CMakeFiles/cmTC_81507.dir/build.make CMakeFiles/cmTC_81507.dir/build</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">make[1]: Entering directory '~/CMakeFiles/CMakeTmp'</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">Building C object CMakeFiles/cmTC_81507.dir/CheckFunctionExists.c.o</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">/usr/bin/clang -Wall -fno-strict-aliasing -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_81507.dir/CheckFunctionExists.c.o -c /usr/local/share/cmake-3.8/Modules/CheckFunctionExists.c</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">Linking C executable cmTC_81507</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">/usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_81507.dir/link.txt --verbose=1</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">/usr/bin/clang -Wall -fno-strict-aliasing -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTC_81507.dir/CheckFunctionExists.c.o -o cmTC_81507 -lpthreads </div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">/usr/bin/ld: cannot find -lpthreads</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">clang: error: linker command failed with exit code 1 (use -v to see invocation)</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">CMakeFiles/cmTC_81507.dir/build.make:97: recipe for target 'cmTC_81507' failed</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">make[1]: *** [cmTC_81507] Error 1</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">make[1]: Leaving directory '~/CMakeFiles/CMakeTmp'</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">Makefile:126: recipe for target 'cmTC_81507/fast' failed</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">make: *** [cmTC_81507/fast] Error 2</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Helvetica; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Helvetica; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">Determining if the include file pthread.h exists failed with the following output:</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">Change Dir: ~/CMakeFiles/CMakeTmp</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Helvetica; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">Run Build Command:"/usr/bin/make" "cmTC_83cc7/fast"</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">/usr/bin/make -f CMakeFiles/cmTC_83cc7.dir/build.make CMakeFiles/cmTC_83cc7.dir/build</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">make[1]: Entering directory '~/CMakeFiles/CMakeTmp'</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">Building C object CMakeFiles/cmTC_83cc7.dir/CheckIncludeFile.c.o</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">/usr/local/bin/clang -Wall -fno-strict-aliasing -o CMakeFiles/cmTC_83cc7.dir/CheckIncludeFile.c.o -c ~/CMakeFiles/CMakeTmp/CheckIncludeFile.c</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">In file included from ~/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">In file included from /usr/include/pthread.h:23:</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">/usr/include/sched.h:28:10: fatal error: 'stddef.h' file not found</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">#include <stddef.h></div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class=""> ^~~~~~~~~~</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">1 error generated.</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">CMakeFiles/cmTC_83cc7.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_83cc7.dir/CheckIncludeFile.c.o' failed</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">make[1]: *** [CMakeFiles/cmTC_83cc7.dir/CheckIncludeFile.c.o] Error 1</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">make[1]: Leaving directory '~/CMakeFiles/CMakeTmp'</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">Makefile:126: recipe for target 'cmTC_83cc7/fast' failed</div><div style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; font-family: Menlo;" class="">make: *** [cmTC_83cc7/fast] Error 2</div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Helvetica; min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Helvetica; min-height: 14px;" class=""><br class=""></div></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(255, 255, 255);" class=""><br class=""></div></div></blockquote></body></html>