Onega

a lot of VC++ posts, a few C# posts, and some miscellaneous stuff

Saturday, January 05, 2019

Build wxMac

CMake build wxWidgets library

ld: library not found for -lstdc++

cmake ../wxWidgets-3.1.2
-- 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 /Applications/CMake.app/Contents/share/cmake-3.13/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: ~/oss/bld/CMakeFiles/CMakeTmp
    
    Run Build Command:"/usr/bin/make" "cmTC_6d774/fast"
    /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_6d774.dir/build.make CMakeFiles/cmTC_6d774.dir/build
    Building CXX object CMakeFiles/cmTC_6d774.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.7   -o CMakeFiles/cmTC_6d774.dir/testCXXCompiler.cxx.o -c ~/oss/bld/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_6d774
    /Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/cmTC_6d774.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.7 -Wl,-search_paths_first -Wl,-headerpad_max_install_names   CMakeFiles/cmTC_6d774.dir/testCXXCompiler.cxx.o  -o cmTC_6d774 
    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)
    make[1]: *** [cmTC_6d774] Error 1
    make: *** [cmTC_6d774/fast] Error 2
    
  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:26 (project)

Solution:

LDFLAGS="-stdlib=libc++" cmake ../wxWidgets-3.1.2

CMake build wxWidgets application

cmake -DwxWidgets_CONFIG_EXECUTABLE=~/Downloads/wxWidgets-3.1.2/bld/wx-config ..

macOS version

sw_vers
ProductName: Mac OS X
ProductVersion: 10.13.6
BuildVersion: 17G2112

Labels: , , ,

0 Comments:

Post a Comment

<< Home