Bug 10055

Summary: pthread.h is not found by CMake 3.4
Product: [Build System, Metadata & Runtime] OE-Core Reporter: tiktokoptik
Component: devtools / tool chainAssignee: tiktokoptik
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: Medium CC: bluelightning, maxin.john, meta.mr.watcher, meta.watcher, poky.bs.watcher, poky.watcher, randy.macleod, ross.burton, sgw
Version: unspecified   
Target Milestone: 2.2   
Hardware: x86   
OS: x86_64   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description tiktokoptik 2016-07-31 21:40:30 UTC
System:
BitBake Build Tool Core version 1.30.0
korogoth from git, July 18, commit f73006031ef8bca7b8851724832c6f37ed63ec89

The build fails finding pthread.h:

-- Looking for pthread.h
| -- Looking for pthread.h - not found
| CMake Error at /home/Build/embedded_distribution/poky/build/tmp/sysroots/x86_64-linux/usr/share/cmake-3.4/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
|   Could NOT find Threads (missing: Threads_FOUND)
| Call Stack (most recent call first):
|   /home/Build/embedded_distribution/poky/build/tmp/sysroots/x86_64-linux/usr/share/cmake-3.4/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
|   /home/Build/embedded_distribution/poky/build/tmp/sysroots/x86_64-linux/usr/share/cmake-3.4/Modules/FindThreads.cmake:223 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
|   /home/Build/embedded_distribution/poky/build/tmp/sysroots/x86_64-linux/usr/share/cmake-3.4/Modules/FindCUDA.cmake:755 (find_package)
|   CMakeLists.txt:36 (find_package)
| 
| 
| -- Configuring incomplete, errors occurred!
| See also "/home/Build/embedded_distribution/poky/build/tmp/work/aarch64-poky-linux/sensorpro/0.0.1-r0/build/CMakeFiles/CMakeOutput.log".
| See also "/home/Build/embedded_distribution/poky/build/tmp/work/aarch64-poky-linux/sensorpro/0.0.1-r0/build/CMakeFiles/CMakeError.log".
| WARNING: /home/Build/embedded_distribution/poky/build/tmp/work/aarch64-poky-linux/sensorpro/0.0.1-r0/temp/run.do_configure.20599:1 exit 1 from 'cmake ${OECMAKE_SITEFILE} /home/Build/embedded_distribution/poky/build/tmp/work/aarch64-poky-linux/sensorpro/0.0.1-r0/git -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_BINDIR:PATH=/usr/bin -DCMAKE_INSTALL_SBINDIR:PATH=/usr/sbin -DCMAKE_INSTALL_LIBEXECDIR:PATH=/usr/libexec -DCMAKE_INSTALL_SYSCONFDIR:PATH=/etc -DCMAKE_INSTALL_SHAREDSTATEDIR:PATH=/com -DCMAKE_INSTALL_LOCALSTATEDIR:PATH=/var -DCMAKE_INSTALL_LIBDIR:PATH=/usr/lib -DCMAKE_INSTALL_INCLUDEDIR:PATH=/usr/include -DCMAKE_INSTALL_DATAROOTDIR:PATH=/usr/share -DCMAKE_INSTALL_SO_NO_EXE=0 -DCMAKE_TOOLCHAIN_FILE=/home/Build/embedded_distribution/poky/build/tmp/work/aarch64-poky-linux/sensorpro/0.0.1-r0/toolchain.cmake -DCMAKE_VERBOSE_MAKEFILE=1 -DCUDA_TOOLKIT_ROOT_DIR=/home/Build/embedded_distribution/poky/build/tmp/sysroots/jetson-tx1/usr/local/cuda-7.0 ${PACKAGECONFIG_CONFARGS} -Wno-dev'
| ERROR: Function failed: do_configure (log file is located at /home/Build/embedded_distribution/poky/build/tmp/work/aarch64-poky-linux/sensorpro/0.0.1-r0/temp/log.do_configure.20599)
ERROR: Task 6 (/home/Build/embedded_distribution/poky/meta-sensition/recipes-sensition-apps/sensorpro/sensorpro_0.0.1.bb, do_configure) failed with exit code '1'
DEBUG: Teardown for bitbake-worker
NOTE: Tasks Summary: Attempted 2071 tasks of which 2070 didn't need to be rerun and 1 failed.
No currently running tasks (1772 of 2079)

Summary: 1 task failed:
  /home/Build/embedded_distribution/poky/meta-sensition/recipes-sensition-apps/sensorpro/sensorpro_0.0.1.bb, do_configure
Summary: There was 1 WARNING message shown.
Summary: There was 1 ERROR message shown, returning a non-zero exit code.


This is not related to earlier error concerning old-style-definition and main() as the function is now updated to main(void). Closer look at the error in poky/build/tmp/work/aarch64-poky-linux/sensorpro/0.0.1-r0/build/CMakeFiles/CMakeError.log shows:

Determining if the include file pthread.h exists failed with the following output:
Change Dir: /home/Build/embedded_distribution/poky/build/tmp/work/aarch64-poky-linux/sensorpro/0.0.1-r0/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/gmake" "cmTC_06107/fast"
make -f CMakeFiles/cmTC_06107.dir/build.make CMakeFiles/cmTC_06107.dir/build
make[1]: Entering directory '/home/Build/embedded_distribution/poky/build/tmp/work/aarch64-poky-linux/sensorpro/0.0.1-r0/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_06107.dir/CheckIncludeFile.c.o
/home/Build/embedded_distribution/poky/build/tmp/sysroots/x86_64-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc    -fPIC    -o CMakeFiles/cmTC_06107.dir/CheckIncludeFile.c.o   -c /home/Build/embedded_distribution/poky/build/tmp/work/aarch64-poky-linux/sensorpro/0.0.1-r0/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c
/home/Build/embedded_distribution/poky/build/tmp/work/aarch64-poky-linux/sensorpro/0.0.1-r0/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:21: fatal error: pthread.h: No such file or directory
compilation terminated.
CMakeFiles/cmTC_06107.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_06107.dir/CheckIncludeFile.c.o' failed
make[1]: *** [CMakeFiles/cmTC_06107.dir/CheckIncludeFile.c.o] Error 1
make[1]: Leaving directory '/home/Build/embedded_distribution/poky/build/tmp/work/aarch64-poky-linux/sensorpro/0.0.1-r0/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_06107/fast' failed
gmake: *** [cmTC_06107/fast] Error 2
Comment 1 Maxin B. John 2016-08-01 09:04:41 UTC
Hi,

Is it possible to share the meta-sensition layer location or sensorpro recipe to recreate this error ? It will be great if we had access to "MakeFiles/CMakeError.log" error log for debugging as well..

Thanks,
Maxin
Comment 2 tiktokoptik 2016-08-10 21:04:16 UTC
Hi
The issue was solved by adding TARGET_CC_ARCH += "-pthread"