cmake_template icon indicating copy to clipboard operation
cmake_template copied to clipboard

Verify VSCode Experience (MacOS)

Open lefticus opened this issue 2 years ago • 3 comments

This is the "out of the box" experience.

When you open this project in VSCode does it Just Work?

related #17

lefticus avatar Apr 19 '23 23:04 lefticus

On a 2020 M1 MacBook Air, running macOS Ventura 13.3.1a, I used setup-cpp to install dependencies, but it was using the wrong path for homebrew, so I had to install some dependencies manually.

With everything set up, I get the following error when trying to configure the project through cmake:

[main] Configuring project: robco-term-game 
[proc] Executing command: /Users/james/cmake/cmake-3.26.4-macos-universal/CMake.app/Contents/bin/cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/Users/james/repos/robco-term-game/out/install/unixlike-clang-debug -S/Users/james/repos/robco-term-game -B/Users/james/repos/robco-term-game/out/build/unixlike-clang-debug -G Ninja
[cmake] -- The CXX compiler identification is AppleClang 14.0.3.14030022
[cmake] -- The C compiler identification is AppleClang 14.0.3.14030022
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - failed
[cmake] -- Check for working CXX compiler: /usr/bin/clang++
[cmake] -- Check for working CXX compiler: /usr/bin/clang++ - broken
[cmake] CMake Error at /Users/james/cmake/cmake-3.26.4-macos-universal/CMake.app/Contents/share/cmake-3.26/Modules/CMakeTestCXXCompiler.cmake:60 (message):
[cmake]   The C++ compiler
[cmake] 
[cmake]     "/usr/bin/clang++"
[cmake] 
[cmake]   is not able to compile a simple test program.
[cmake] 
[cmake]   It fails with the following output:
[cmake] 
[cmake]     Change Dir: /Users/james/repos/robco-term-game/out/build/unixlike-clang-debug/CMakeFiles/CMakeScratch/TryCompile-TFUPcN
[cmake]     
[cmake]     Run Build Command(s):/opt/homebrew/bin/ninja -v cmTC_70530 && [1/2] /usr/bin/clang++   -std=c++20 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -MD -MT CMakeFiles/cmTC_70530.dir/testCXXCompiler.cxx.o -MF CMakeFiles/cmTC_70530.dir/testCXXCompiler.cxx.o.d -o CMakeFiles/cmTC_70530.dir/testCXXCompiler.cxx.o -c /Users/james/repos/robco-term-game/out/build/unixlike-clang-debug/CMakeFiles/CMakeScratch/TryCompile-TFUPcN/testCXXCompiler.cxx
[cmake]     [2/2] : && /usr/bin/clang++ -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L"/Users/james/llvm/lib" CMakeFiles/cmTC_70530.dir/testCXXCompiler.cxx.o -o cmTC_70530   && :
[cmake]     FAILED: cmTC_70530 
[cmake]     : && /usr/bin/clang++ -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L"/Users/james/llvm/lib" CMakeFiles/cmTC_70530.dir/testCXXCompiler.cxx.o -o cmTC_70530   && :
[cmake]     ld: warning: ignoring file /Users/james/llvm/lib/libc++.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
[cmake]     ld: in '/Users/james/llvm/lib/libunwind.dylib', building for macOS-arm64 but attempting to link with file built for macOS-x86_64
[cmake]     clang: error: linker command failed with exit code 1 (use -v to see invocation)
[cmake]     ninja: build stopped: subcommand failed.
[cmake]     
[cmake]     
[cmake] 
[cmake]   
[cmake] 
[cmake]   CMake will not be able to correctly generate this project.
[cmake] Call Stack (most recent call first):
[cmake]   CMakeLists.txt:18 (project)
[cmake] 
[cmake] 
[cmake] -- Configuring incomplete, errors occurred!
[proc] The command: /Users/james/cmake/cmake-3.26.4-macos-universal/CMake.app/Contents/bin/cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/Users/james/repos/robco-term-game/out/install/unixlike-clang-debug -S/Users/james/repos/robco-term-game -B/Users/james/repos/robco-term-game/out/build/unixlike-clang-debug -G Ninja exited with code: 1

skwirl42 avatar May 29 '23 16:05 skwirl42

On an Intel Macbook Pro, Ventura 13.6.1. I ran setup-cpp. Cmake had a config error from not finding ninja. I figured out that setup-cpp configured .cpprc for bash in .profile. I'm using zsh, so I had to copy/paste to .zprofile. Cmake config passed. Now when I try to run tests I get the following:

[main] Building folder: test tests
[build] Starting build
[proc] Executing command: /Users/jhoward1/cmake/cmake-3.27.4-macos-universal/CMake.app/Contents/bin/cmake --build /Users/jhoward1/VSCodeProjects/test/out/build/unixlike-clang-debug --parallel 14 --target tests
[build] [1/1] Linking CXX executable test/tests
[build] FAILED: test/tests test/tests_tests-f9b55b5.cmake /Users/jhoward1/VSCodeProjects/test/out/build/unixlike-clang-debug/test/tests_tests-f9b55b5.cmake 
[build] : && /Users/jhoward1/llvm/bin/clang++ -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -fcf-protection  -D_GLIBCXX_ASSERTIONS -g -flto=thin -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L"/Users/jhoward1/llvm/lib"     -fsanitize=address,undefined test/CMakeFiles/tests.dir/tests.cpp.o -o test/tests  src/sample_library/libsample_library.a  _deps/catch2-build/src/libCatch2Maind.a  _deps/catch2-build/src/libCatch2d.a && cd /Users/jhoward1/VSCodeProjects/test/out/build/unixlike-clang-debug/test && /Users/jhoward1/cmake/cmake-3.27.4-macos-universal/CMake.app/Contents/bin/cmake -D TEST_TARGET=tests -D TEST_EXECUTABLE=/Users/jhoward1/VSCodeProjects/test/out/build/unixlike-clang-debug/test/tests -D TEST_EXECUTOR= -D TEST_WORKING_DIR=/Users/jhoward1/VSCodeProjects/test/out/build/unixlike-clang-debug/test -D TEST_SPEC= -D TEST_EXTRA_ARGS= -D TEST_PROPERTIES= -D TEST_PREFIX=unittests. -D TEST_SUFFIX= -D TEST_LIST=tests_TESTS -D TEST_REPORTER=XML -D TEST_OUTPUT_DIR=. -D TEST_OUTPUT_PREFIX=unittests. -D TEST_OUTPUT_SUFFIX=.xml -D TEST_DL_PATHS= -D CTEST_FILE=/Users/jhoward1/VSCodeProjects/test/out/build/unixlike-clang-debug/test/tests_tests-f9b55b5.cmake -P /Users/jhoward1/VSCodeProjects/test/out/build/unixlike-clang-debug/_deps/catch2-src/extras/CatchAddTests.cmake
[build] -macosx_version_min has been renamed to -macos_version_min
[build] dyld[25848]: Library not loaded: @rpath/libunwind.1.dylib
[build]   Referenced from: <3623496B-B072-3271-987B-4284E8F47FB5> /Users/jhoward1/VSCodeProjects/test/out/build/unixlike-clang-debug/test/tests
[build]   Reason: tried: '/Users/jhoward1/VSCodeProjects/test/out/build/unixlike-clang-debug/test/libunwind.1.dylib' (no such file), '/Users/jhoward1/llvm/lib/clang/15.0.3/lib/darwin/libunwind.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/jhoward1/llvm/lib/clang/15.0.3/lib/darwin/libunwind.1.dylib' (no such file), '/Users/jhoward1/VSCodeProjects/test/out/build/unixlike-clang-debug/test/libunwind.1.dylib' (no such file), '/Users/jhoward1/llvm/lib/clang/15.0.3/lib/darwin/libunwind.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/jhoward1/llvm/lib/clang/15.0.3/lib/darwin/libunwind.1.dylib' (no such file), '/usr/local/lib/libunwind.1.dylib' (no such file), '/usr/lib/libunwind.1.dylib' (no such file, not in dyld cache)
[build] CMake Error at /Users/jhoward1/VSCodeProjects/test/out/build/unixlike-clang-debug/_deps/catch2-src/extras/CatchAddTests.cmake:60 (message):
[build]   Error running test executable
[build]   '/Users/jhoward1/VSCodeProjects/test/out/build/unixlike-clang-debug/test/tests':
[build] 
[build] 
[build]     Result: Subprocess aborted
[build]     Output: 
[build] 
[build] 
[build] 
[build] ninja: build stopped: subcommand failed.
[proc] The command: /Users/jhoward1/cmake/cmake-3.27.4-macos-universal/CMake.app/Contents/bin/cmake --build /Users/jhoward1/VSCodeProjects/test/out/build/unixlike-clang-debug --parallel 14 --target tests exited with code: 1
[driver] Build completed: 00:00:03.649
[build] Build finished with exit code 1

I'm guessing it's related to this issue https://github.com/aminya/setup-cpp/issues/170

jonathanhhoward avatar Dec 05 '23 17:12 jonathanhhoward

So I backed out the setup-cpp install of llvm and used Xcode CLI Tools. Project build succeeded and tests passed.

jonathanhhoward avatar Dec 06 '23 14:12 jonathanhhoward