Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error building in OSX Mojave. #442

Closed
NfNitLoop opened this issue Dec 9, 2018 · 3 comments
Closed

Error building in OSX Mojave. #442

NfNitLoop opened this issue Dec 9, 2018 · 3 comments

Comments

@NfNitLoop
Copy link

I've been trying to use libui (via libui-rs) but I'm getting build errors. So I tried just downloading the C version of the library and building that.

steps:

brew install cmake
git clone https://github.com/andlabs/libui.git
cd libui
mkdir build
cd build
cmake ..

Output:

-- 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.13.1/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/codyc/programs/rust/libui/build/CMakeFiles/CMakeTmp
    
    Run Build Command:"/usr/bin/make" "cmTC_d7a8a/fast"
    /Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cmTC_d7a8a.dir/build.make CMakeFiles/cmTC_d7a8a.dir/build
    Building CXX object CMakeFiles/cmTC_d7a8a.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_d7a8a.dir/testCXXCompiler.cxx.o -c /Users/codyc/programs/rust/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_d7a8a
    /usr/local/Cellar/cmake/3.13.1/bin/cmake -E cmake_link_script CMakeFiles/cmTC_d7a8a.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_d7a8a.dir/testCXXCompiler.cxx.o  -o cmTC_d7a8a 
    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_d7a8a] Error 1
    make: *** [cmTC_d7a8a/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/codyc/programs/rust/libui/build/CMakeFiles/CMakeOutput.log".
See also "/Users/codyc/programs/rust/libui/build/CMakeFiles/CMakeError.log".

I installed cmake from Homebrew, and I'm using XCode 10.1. The README.md says that the requirements for macOS are "nothing specific, as long as you can build Cocoa programs." Is XCode not enough for that?

@mischnic
Copy link
Contributor

mischnic commented Dec 9, 2018

CMake doesn't seem to support Xcode 10 under specific circumstances.
This is a duplicate of #422

@NfNitLoop
Copy link
Author

Oh, thanks! I'd searched but didn't find that one. I'm fine closing this one as a duplicate. Thanks for the quick response! 👍

@mischnic
Copy link
Contributor

mischnic commented Dec 9, 2018

@NfNitLoop If you only want to build libui locally, then this change might make CMake work.

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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants