51
votes

I'm trying to work with eclipse to compile/debug C/C++ applications on MAC OSX using LLVM/Clang.

I know I have the toolchain correctly installed as I can compile with it from the terminal using a makefile, and when running clang -v I get the LLVM version + install dir correctly.

I downloaded a fresh copy of eclipse C++ (Mars) + installed the LLVM support plugin and followed: Unable to install LLVM toolchain for Eclipse CDT

Copied the install dir path from the clang -v output to the LLVM part in the preferences -> c++ -> LLVM, but it seems eclipse does not detect the toolchain.

It does not appear as an option when creating a new C++ project unless I uncheck the "only show supported toolchains on the target" checkbox , and when I do uncheck it and create a LLVM project for MACOS in the build process it says:

Toolchain "LLVM with Clang (MacOSX)" is not detected.
Refer to "C/C++ Development User Guide", "Before you begin" how to install toolchains.

All it says in the manual is to install Xcode to get the toolchain running , which I obviously did as it is working from the terminal.

Any ideas? How does Eclipse detect the toolchain exists?

2

2 Answers

0
votes

In Xcode app menu > Toolchains > set the one you want to use.

And set the environment variable export TOOLCHAINS=org.llvm.12.0.1

Simply downloading the binaries doesn't make it a "toolchain" that Xcode expects like in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain

-2
votes

Its highly likely this is fixed in latest version of Eclipse. At date this question was asked, you were using 'Mars'. This version of Eclipse is superseded by 'Neon' and then 'Oxygen' which is current as of end of January 2018. I've seen a reference to this issue being solved with 'Neon' edition as it was a bug in 'Mars'. I cannot personally confirm this though.

In addition if you manually installed clang/llvm instead of included apple version try using homebrew instead. There are some clear instructions here on using it under OSX/macOS in relation to clang/llvm.