prove-rs / z3.rs

Rust bindings for the Z3 solver.
347 stars 110 forks source link

Build failure on Mac #286

Open GuanmingQiao opened 7 months ago

GuanmingQiao commented 7 months ago

Hi, thank you so much for this wonderful project.

I am trying to build z3-sys on my Mac, but it gives the following errors:

The C++ compiler "/usr/bin/c++" is not able to compile a simple test program. It fails with the following output: Change Dir: '/Users/guanmingqiao/Documents/GitHub/fuzzing/dev-container/target/debug/build/z3-sys-f13183a96b36c416/out/build/CMakeFiles/CMakeScratch/TryCompile-YEUaeW' Run Build Command(s): /usr/local/Cellar/cmake/3.27.8/bin/cmake -E env VERBOSE=1 /usr/bin/make -f Makefile cmTC_3f76d/fast /Library/Developer/CommandLineTools/usr/bin/make -f CMakeFiles/cmTC_3f76d.dir/build.make CMakeFiles/cmTC_3f76d.dir/build /usr/bin/c++ -ffunction-sections -fdata-sections -fPIC -m64 --target=x86_64-apple-darwin -mmacosx-version-min=10.7 -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk -MD -MT CMakeFiles/cmTC_3f76d.dir/testCXXCompiler.cxx.o -MF CMakeFiles/cmTC_3f76d.dir/testCXXCompiler.cxx.o.d -o CMakeFiles/cmTC_3f76d.dir/testCXXCompiler.cxx.o -c "/Users/guanmingqiao/Documents/GitHub/fuzzing/dev-container/target/debug/build/z3-sys-f13183a96b36c416/out/build/CMakeFiles/CMakeScratch/TryCompile-YEUaeW/testCXXCompiler.cxx" clang: warning: include path for libstdc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found] Linking CXX executable cmTC_3f76d /usr/local/Cellar/cmake/3.27.8/bin/cmake -E cmake_link_script CMakeFiles/cmTC_3f76d.dir/link.txt --verbose=1 /usr/bin/c++ -ffunction-sections -fdata-sections -fPIC -m64 --target=x86_64-apple-darwin -mmacosx-version-min=10.7 -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_3f76d.dir/testCXXCompiler.cxx.o -o cmTC_3f76d 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_3f76d] Error 1 make: [cmTC_3f76d/fast] Error 2 CMake will not be able to correctly generate this project.

It seems the core problems is ld: library not found for -lstdc++.

My environment is:

I tried to re-install XCode, but it didn't work. Any help would be much appreciated!

yqylovy commented 7 months ago

Had it solved? I got same error.

yqylovy commented 7 months ago

Hope it help:

sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install