I am using macOS and have two copies of llvm toolchain. One of which is apple's fork of llvm installed with xcode-select --install, and the other is installed with homebrew. Each copy of the llvm toolchain should have their own implementation of header files. I have language server enabled in my editor using heomebrew clangd.
My issue is that when I set my editor to use the homebrew version of clangd, the homebrew version of clangd somehow uses the header files from apple's clang.
Below is the current settings of clangd:
{ // The path to the clangd binary to use "system_binary": "/opt/homebrew/opt/llvm/bin/clangd", "initializationOptions": { // The flags to use in case there is no compile_commands.json // or compile_flags.txt specified in the project directory "fallbackFlags": [ "-xc++", "-std=c++23" ] } } This gives the following path for including the iostream header:
/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/iostream

My question is what causes the issue that homebrew clangd suddenly uses apple clang's standard library?
If my question isn't appropriate for stack overflow or needs more clarification, please let me know. Additionally, if anyone needs more information I'm happy to provide clangd log.
Источник: https://stackoverflow.com/questions/780 ... s-in-macos