View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014836CMakeCMakepublic2014-03-25 13:102014-10-06 10:33
ReporterMichael Priestman 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformApple MacOSOS XOS Version10.4.10
Product VersionCMake 2.8.12 
Target VersionCMake 2.8.12.2Fixed in VersionCMake 2.8.12.2 
Summary0014836: find_package(Threads) fails on Mac OS X with Xcode 5.1.
DescriptionWhen CMake tries to find the threading libraries using find_package(Threads), it will fail on Mac OS X and Xcode 5.1.

It works fine with Xcode 5.0.
Steps To ReproduceTo reproduce, put the following in a basic CMakeLists.txt file:

--- Begin CMakeLists.txt ---
cmake_minimum_required(VERSION 2.8)
project(Test)
find_package(Threads REQUIRED)
--- End CMakeLists.txt ---

then run:

cmake -G "Xcode"

You get the following output:

-- The C compiler identification is Clang 5.1.0
-- The CXX compiler identification is Clang 5.1.0
-- Looking for include file pthread.h
CMake Error at /Applications/CMake 2.8-12.app/Contents/share/cmake-2.8/Modules/CMakeCInformation.cmake:37 (get_filename_component):
  get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
  CMakeLists.txt:2 (PROJECT)


CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Looking for include file pthread.h - not found
CMake Error at /Applications/CMake 2.8-12.app/Contents/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
  Could NOT find Threads (missing: Threads_FOUND)
Call Stack (most recent call first):
  /Applications/CMake 2.8-12.app/Contents/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)
  /Applications/CMake 2.8-12.app/Contents/share/cmake-2.8/Modules/FindThreads.cmake:166 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:3 (find_package)


-- Configuring incomplete, errors occurred!
Additional InformationThis was working fine for us up until we upgraded to Xcode 5.1. Could it be just looking in the wrong place for pthread.h?

The strange thing is that if you just create a basic C file that includes <pthread.h>, it compiles fine in Xcode, so just sure what is going wrong here.
TagsNo tags attached.
Attached Fileszip file icon CMakeTryCompileError.zip [^] (49,291 bytes) 2014-03-25 16:31

 Relationships
related to 0014635closedBrad King CMake with Xcode generator breaks with Xcode 5.1 DP due to brittle regex in CMakeDetermineCompilerId.cmake 

  Notes
(0035507)
Rolf Eike Beer (developer)
2014-03-25 15:12

I suspect that this is a deeper problem. Please put this in a CMakeLists.txt, run it with cmake --debug-trycompile and attach the whole build folder here:

cmake_minimum_required(VERSION 2.8)
include (CheckIncludeFiles)
CHECK_INCLUDE_FILES("pthread.h" CMAKE_HAVE_PTHREAD_H)
(0035511)
Michael Priestman (reporter)
2014-03-25 16:32

Please find the output from the command attached to the bug. The CMake console output was:

[priestm@shfc02h60mwdhjq build]$ cmake -G "Xcode" --debug-trycompile ..
debug trycompile on
-- The C compiler identification is Clang 5.1.0
-- The CXX compiler identification is Clang 5.1.0
-- Looking for include file pthread.h
CMake Error at /Applications/CMake 2.8-12.app/Contents/share/cmake-2.8/Modules/CMakeCInformation.cmake:37 (get_filename_component):
  get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
  CMakeLists.txt:2 (PROJECT)


CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Looking for include file pthread.h - not found
-- Configuring incomplete, errors occurred!
See also "/users/priestm/Git/temp/build/CMakeFiles/CMakeOutput.log".
See also "/users/priestm/Git/temp/build/CMakeFiles/CMakeError.log".
(0035520)
Brad King (manager)
2014-03-26 08:49

Are you using CMake 2.8.12.2? It had this fix for Xcode 5.1 since 2.8.12.1:

 CMakeDetermineCompilerId: Fix compiler line match for Xcode 5.1
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=65ee85d0 [^]
(0035521)
Michael Priestman (reporter)
2014-03-26 08:58

Ahh, no, I was using 2.8.12. Just upgraded to latest version, and all appears well.

Cheers Brad. You can mark this bug as fixed.
(0036955)
Robert Maynard (manager)
2014-10-06 10:33

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2014-03-25 13:10 Michael Priestman New Issue
2014-03-25 15:12 Rolf Eike Beer Note Added: 0035507
2014-03-25 16:31 Michael Priestman File Added: CMakeTryCompileError.zip
2014-03-25 16:32 Michael Priestman Note Added: 0035511
2014-03-26 08:49 Brad King Note Added: 0035520
2014-03-26 08:51 Brad King Relationship added related to 0014635
2014-03-26 08:58 Michael Priestman Note Added: 0035521
2014-03-26 09:41 Rolf Eike Beer Status new => resolved
2014-03-26 09:41 Rolf Eike Beer Resolution open => fixed
2014-03-26 09:41 Rolf Eike Beer Fixed in Version => CMake 2.8.12.2
2014-03-26 09:41 Rolf Eike Beer Target Version => CMake 2.8.12.2
2014-10-06 10:33 Robert Maynard Note Added: 0036955
2014-10-06 10:33 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team