Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
LLVM, clang and clang++ under Eclipse
How to setup llvm and clang for eclipse
=======================================
Tested on Mac OSX 10.6.7 with LLVM and CLANG version 2.9
Eclipse Helios Service Release 1 (Build 20100917-0705)
1) Installing LLVM and clang
----------------------------
Enter the following commands in a shell:
# Grab the code from the repository:
svn co http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_29/final llvm
cd llvm/tools
svn co http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_29/final/ clang
# Configure and build:
./configure --enable-optimized # Removes debugging flags. Makes compiling much faster
gmake -j2 # (64bit, 2 jobs at a time)
sudo gmake install # This puts llvm and clang into /usr/local
2) Running LLVM in Eclipse:
---------------------------
Required plugins:
Install CDT: http://www.eclipse.org/cdt/downloads.php
Install the LLVM toolchain for Eclipse CDT from http://marketplace.eclipse.org/node/28778
Adjust settings:
Go into Eclipse preferences > C/C++ > Build > Environment and click "Select".
Click on the box next to the PATH variable and "OK".
The variable will appear in the list. Click on "Edit" and enter the path
to the clang installation into the "Value"-Field (i.e. /usr/local/bin)
Go to Preferences > LLVM and enter "usr/local/" in LLVM installation folder.
Try it out:
Try to build a sample C++ project or create a new project under File > New > C++ Project.
Good luck :)
Pro tip:
Adjust the CDT indexer settings for faster code completion:
Preferences > C/C++ > Indexer
@madhvigupta

This comment has been minimized.

Copy link

commented Apr 29, 2014

Thanks for sharing all the steps. I have done it so far but how to tell the eclipse to use LLVM as a compiler.

@dtvkoe

This comment has been minimized.

Copy link

commented Jul 27, 2016

the link to the llvm toolchain on the eclipse marketplace is borken.
Is there a new place where I can get the plugin?
Searching on the marketplace for LLM gives me no result

@mre

This comment has been minimized.

Copy link
Owner Author

commented Jan 2, 2018

I'm way too late to the party here, but for anyone reading this, probably there are better ways to use LLVM with Eclipse by now.
As @dtvkoe mentioned, the link to the plugin is broken. Some quick search turned up this outdated Github project: https://github.com/TuononenP/llvm4eclipsecdt. It indicates that the llvm toolchain is now part of Eclipse CDT itself and can be selected as an installation option. I don't use Eclipse anymore myself, so I can't say for sure. Switched to Visual Studio Code a while ago.

@leonardopsantos

This comment has been minimized.

Copy link

commented Mar 13, 2019

Unfortunately, even with LLVM 7.0.1 on the PATH, Eclipse can't find the toolchain. It can find Cygwin, MinGW, and an ARM cross GCC, but not clang.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.