Skip to content

CMake config fails on OS X #422

@fduxiao

Description

@fduxiao

I always get this:

-- The C compiler identification is AppleClang 10.0.0.10001145
-- The CXX compiler identification is AppleClang 10.0.0.10001145
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- broken
CMake Error at /usr/local/Cellar/cmake/3.12.2/share/cmake/Modules/CMakeTestCXXCompiler.cmake:45 (message):
  The C++ compiler

    "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /Users/xiao/Desktop/libui/build/CMakeFiles/CMakeTmp
    
    Run Build Command:"/usr/local/bin/gmake" "cmTC_806b4/fast"
    /usr/local/bin/gmake -f CMakeFiles/cmTC_806b4.dir/build.make CMakeFiles/cmTC_806b4.dir/build
    gmake[1]: Entering directory '/Users/xiao/Desktop/libui/build/CMakeFiles/CMakeTmp'
    Building CXX object CMakeFiles/cmTC_806b4.dir/testCXXCompiler.cxx.o
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++    -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.8   -o CMakeFiles/cmTC_806b4.dir/testCXXCompiler.cxx.o -c /Users/xiao/Desktop/libui/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
    warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
    1 warning generated.
    Linking CXX executable cmTC_806b4
    /usr/local/Cellar/cmake/3.12.2/bin/cmake -E cmake_link_script CMakeFiles/cmTC_806b4.dir/link.txt --verbose=1
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++    -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.8 -Wl,-search_paths_first -Wl,-headerpad_max_install_names   CMakeFiles/cmTC_806b4.dir/testCXXCompiler.cxx.o  -o cmTC_806b4 
    clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
    ld: library not found for -lstdc++
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    gmake[1]: *** [CMakeFiles/cmTC_806b4.dir/build.make:87: cmTC_806b4] Error 1
    gmake[1]: Leaving directory '/Users/xiao/Desktop/libui/build/CMakeFiles/CMakeTmp'
    gmake: *** [Makefile:121: cmTC_806b4/fast] Error 2
    

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:35 (project)


-- Configuring incomplete, errors occurred!
See also "/Users/xiao/Desktop/libui/build/CMakeFiles/CMakeOutput.log".
See also "/Users/xiao/Desktop/libui/build/CMakeFiles/CMakeError.log".

It seems that ld cannot find libstdc++ and if I follow the instruction switching to OS X 10.9 then everything works just well.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c7193fbb..39f8fd7f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,7 +16,7 @@ cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
 # TODO figure out what other variables must be set with CACHE
 # TODO figure out if FORCE is needed here
 # TODO figure out whether STRING "" is best or if something else is better; also what FORCE does because I forget and later I say it's needed
-set(CMAKE_OSX_DEPLOYMENT_TARGET "10.8" CACHE STRING "" FORCE)
+set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "" FORCE)
 
 # we want to disable incremental linking
 # see also:

It's really trivial but you could find it here if you think it a practical solution and need a pull request.
And I don't think this is the same as #302 since I get the error during configuring. Maybe you could find some further relation between them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cmake dumbnessfor a list of issues I will publish when I jettison this misengineered disaster

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions