Open cosmikwolf opened 2 months ago
scratch that, it still doesn't compile properly. still troubleshooting...
It seems like this was the original issue, since the mac os system /usr/bin/ld doesn't support start-group and end-group https://stackoverflow.com/questions/10286850/using-llvm-linker-when-using-clang-cmake
but I was able to seemingly get it to use the homebrew version of lld with this:
cmake -G Ninja -DCMAKE_C_COMPILER=/opt/homebrew/opt/llvm/bin/clang -DCMAKE_CXX_COMPILER=/opt/homebrew/opt/llvm/bin/clang++ -DCMAKE_C_FLAGS="-B /opt/homebrew/opt/llvm/bin" -DCMAKE_CXX_FLAGS="-B /opt/homebrew/opt/llvm/bin" -DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=lld" -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" ../src
but it still fails:
[44/44] Linking CXX executable xsca
FAILED: xsca
: && /opt/homebrew/opt/llvm/bin/clang++ -B /opt/homebrew/opt/llvm/bin -fno-exceptions -fno-rtti -pthread -no-pie -O0 -g -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -mmacosx-version-min=14.3 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -fuse-ld=lld CMakeFiles/xsca.dir/cc1_main.cpp.o CMakeFiles/xsca.dir/driver.cpp.o CMakeFiles/xsca.dir/xsca_gen.cpp.o CMakeFiles/xsca.dir/xsca_link.cpp.o -o xsca -L/Users/tenkai/Development/language_servers/clang-prebuilt/release/lib -Wl,-rpath,/Users/tenkai/Development/language_servers/clang-prebuilt/release/lib core/libxscaCore.a rules/libxscaRule.a -Wl,--start-group -lclangAnalysis -lclangAST -lclangBasic -lclangDriver -lclangEdit -lclangFrontend -lclangFrontendTool -lclangLex -lclangParse -lclangRewrite -lclangRewriteFrontend -lclangSema -lclangSerialization -lclangTooling -lLLVMBinaryFormat -lLLVMBitReader -lLLVMBitstreamReader -lLLVMCore -lLLVMDemangle -lLLVMFrontendOpenMP -lLLVMMC -lLLVMMCParser -lLLVMOption -lLLVMProfileData -lLLVMRemarks -lLLVMSupport -Wl,--end-group -lm -ldl -lrt -lpthread rules/GJB5369/libxscaGJB5369Rule.a rules/GJB8114/libxscaGJB8114Rule.a rules/MISRA/libxscaMISRARule.a rules/CERT/libxscaCERTRule.a rules/AUTOSAR/libxscaAUTOSARRule.a rules/libxscaRule.a rules/GJB5369/libxscaGJB5369Rule.a rules/GJB8114/libxscaGJB8114Rule.a rules/MISRA/libxscaMISRARule.a rules/CERT/libxscaCERTRule.a rules/AUTOSAR/libxscaAUTOSARRule.a core/libxscaCore.a && :
clang++: warning: argument unused during compilation: '-no-pie' [-Wunused-command-line-argument]
ld64.lld: error: unknown argument '--start-group'
ld64.lld: error: unknown argument '--end-group'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
running the clang++ command manually in verbose mode reveals it is using homebrew llvm for linking:
fsh ❯ /opt/homebrew/opt/llvm/bin/clang++ -B /opt/homebrew/opt/llvm/bin -fno-exceptions -fno-rtti -pthread -no-pie -O0 -g -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -mmacosx-version-min=14.3 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -fuse-ld=lld CMakeFiles/xsca.dir/cc1_main.cpp.o CMakeFiles/xsca.dir/driver.cpp.o CMakeFiles/xsca.dir/xsca_gen.cpp.o CMakeFiles/xsca.dir/xsca_link.cpp.o -o xsca -L/Users/tenkai/Development/language_servers/clang-prebuilt/release/lib -Wl,-rpath,/Users/tenkai/Development/language_servers/clang-prebuilt/release/lib core/libxscaCore.a rules/libxscaRule.a -Wl,--start-group -lclangAnalysis -lclangAST -lclangBasic -lclangDriver -lclangEdit -lclangFrontend -lclangFrontendTool -lclangLex -lclangParse -lclangRewrite -lclangRewriteFrontend -lclangSema -lclangSerialization -lclangTooling -lLLVMBinaryFormat -lLLVMBitReader -lLLVMBitstreamReader -lLLVMCore -lLLVMDemangle -lLLVMFrontendOpenMP -lLLVMMC -lLLVMMCParser -lLLVMOption -lLLVMProfileData -lLLVMRemarks -lLLVMSupport -Wl,--end-group -lm -ldl -lrt -lpthread rules/GJB5369/libxscaGJB5369Rule.a rules/GJB8114/libxscaGJB8114Rule.a rules/MISRA/libxscaMISRARule.a rules/CERT/libxscaCERTRule.a rules/AUTOSAR/libxscaAUTOSARRule.a rules/libxscaRule.a rules/GJB5369/libxscaGJB5369Rule.a rules/GJB8114/libxscaGJB8114Rule.a rules/MISRA/libxscaMISRARule.a rules/CERT/libxscaCERTRule.a rules/AUTOSAR/libxscaAUTOSARRule.a core/libxscaCore.a -v
Homebrew clang version 17.0.6
Target: arm64-apple-darwin23.3.0
Thread model: posix
InstalledDir: /opt/homebrew/opt/llvm/bin
clang++: warning: argument unused during compilation: '-no-pie' [-Wunused-command-line-argument]
"/opt/homebrew/opt/llvm/bin/ld64.lld" -demangle -no_deduplicate -dynamic -arch arm64 -platform_version macos 14.3.0 14.4 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -o xsca -L/Users/tenkai/Development/language_servers/clang-prebuilt/release/lib -search_paths_first -headerpad_max_install_names CMakeFiles/xsca.dir/cc1_main.cpp.o CMakeFiles/xsca.dir/driver.cpp.o CMakeFiles/xsca.dir/xsca_gen.cpp.o CMakeFiles/xsca.dir/xsca_link.cpp.o -rpath /Users/tenkai/Development/language_servers/clang-prebuilt/release/lib core/libxscaCore.a rules/libxscaRule.a --start-group -lclangAnalysis -lclangAST -lclangBasic -lclangDriver -lclangEdit -lclangFrontend -lclangFrontendTool -lclangLex -lclangParse -lclangRewrite -lclangRewriteFrontend -lclangSema -lclangSerialization -lclangTooling -lLLVMBinaryFormat -lLLVMBitReader -lLLVMBitstreamReader -lLLVMCore -lLLVMDemangle -lLLVMFrontendOpenMP -lLLVMMC -lLLVMMCParser -lLLVMOption -lLLVMProfileData -lLLVMRemarks -lLLVMSupport --end-group -lm -ldl -lrt -lpthread rules/GJB5369/libxscaGJB5369Rule.a rules/GJB8114/libxscaGJB8114Rule.a rules/MISRA/libxscaMISRARule.a rules/CERT/libxscaCERTRule.a rules/AUTOSAR/libxscaAUTOSARRule.a rules/libxscaRule.a rules/GJB5369/libxscaGJB5369Rule.a rules/GJB8114/libxscaGJB8114Rule.a rules/MISRA/libxscaMISRARule.a rules/CERT/libxscaCERTRule.a rules/AUTOSAR/libxscaAUTOSARRule.a core/libxscaCore.a -lc++ -lSystem /opt/homebrew/Cellar/llvm/17.0.6_1/lib/clang/17/lib/darwin/libclang_rt.osx.a
ld64.lld: error: unknown argument '--start-group'
ld64.lld: error: unknown argument '--end-group'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
this is the version of ld:
labrador/build on master [!?] via △ v3.29.2 on ☁️ (us-west-1)
fsh ❯ /opt/homebrew/opt/llvm/bin/ld64.lld --version
Homebrew LLD 17.0.6
so, I am out of ideas :D I might try again later today
The standard compile command that was provided in the readme attempts to use the built in OS X version of clangd, which fails:
In order to use the homebrew installed version, I had to use the following command:
And then it compiled properly