Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 4,164
    • Issues 4,164
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 19
    • Merge requests 19
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMakeCMake
  • CMakeCMake
  • Issues
  • #19885
Closed
Open
Issue created Oct 27, 2019 by Craig Scott@craig.scottMaintainer

FindPackageModeMakefileTest fails on more recent macOS/Xcode releases

When using a Makefiles generator on macOS, the FindPackageModeMakefileTest test case fails with all Xcode versions I have available to me (tested with Xcode 9.4.1, 10.3 and 11.1). You can also see these failures in a number of the RogueResearch CDash builds (been happening for a long time now). The output from the failures look something like this:

1: Test command: /usr/bin/make "-f" "/Users/craig/Projects/build/cmake-make/Tests/FindPackageModeMakefileTest/ConfMakefile"
1: Test timeout computed to be: 10000000
1: rm -f tmp.txt *.o pngtest
1: "/Applications/Xcode-9.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++"  -I/Users/craig/Projects/cmake/Tests/FindPackageModeMakefileTest -I"/some/path/with a space/include"   -c main.cpp
1: In file included from main.cpp:2:
1: /Applications/Xcode-9.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/stdio.h:108:15: fatal error: 'stdio.h' file not found
1: #include_next <stdio.h>
1:               ^~~~~~~~~
1: 1 error generated.

If you remove the path to the compiler and just let it find the compiler on the PATH, it works fine, but CMake always uses this sort of full path for the compiler so it should work. After searching online and testing various suggestions, it appears the problem is related to changes that are part of (preparing for) Calalina. The best solution I've been able to find is that there is a missing -isysroot flag (the reference that got me there was here). If you add that with the path to the MacOSX.sdk developer dir, it works. You can verify it with a command line this:

"/Applications/Xcode-9.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++"  -I/Users/craig/Projects/cmake/Tests/FindPackageModeMakefileTest -I"/some/path/with a space/include" -isysroot "/Applications/Xcode-9.4.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" -c main.cpp

I'm recording this issue here first before putting up a fix because I also see further warnings in the test after adding a fix for the above. These linker warnings suggest there's going to be more problems related to this area:

1: "/Applications/Xcode-9.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++"  -isysroot /Applications/Xcode-9.4.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -I/Users/craig/Projects/cmake/Tests/FindPackageModeMakefileTest -I"/some/path/with a space/include"   -c main.cpp
1: "/Applications/Xcode-9.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++"   -o pngtest main.o libfoo.a 
1: ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libSystem.dylib) built for (unknown). Note: This will be an error in the future.
1: ld: warning: URGENT: building for OSX, but linking against dylib (/usr/lib/libc++.dylib) built for (unknown). Note: This will be an error in the future.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking