How to Install Llvm Toolchain for Eclipse Cdt

Unable to install LLVM toolchain for Eclipse CDT

This is a setup from scratch that worked for me (ubuntu 14.04 + eclipse mars + clang 3.6.2). You will be probably interested in steps 8 and 9.

  1. Install Ubuntu

  2. Install Java 8:

    sudo apt-add-repository ppa:webupd8team/java

    apt-get update

    apt-get install oracle-java8-installer

  3. Install g++:

    apt-get install g++

  4. Install llvm/clang 3.6.2:

    http://llvm.org/releases/download.html

    Download and extract to folder of your choice. I renamed the extracted folder to 'clang+llvm-3.6.2' so it is more convenient during setup. Also I have moved it into /home/[user_name]/Development folder that I created.

  5. Add LLVM/Clang to PATH:

    sudo gedit /etc/environment

    Append the path to point to your llvm/clang bin folder.

    PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/[your_user_name]/Development/clang+llvm-3.6.2/bin"

    Yours might look different, depending on where you placed your llvm/clang.

    Save changes, reboot.

  6. Install build-essential:

    sudo apt-get update

    apt-get install build-essential

  7. Install eclipse:

    Download and extract to a folder of your choice. (I moved it to my Development folder and renamed to eclipse_mars, but it is optional)

  8. Install CDT and LLVM Support:

    • In opened Eclipse, 'Help > Install New Software > Work with: --All available sites--'.

    • Once the list loads, expand Programming Languages, install 'C/C++ Development Tools SDK' and 'C/C++ LLVM-Family Compiler Build Support'.

  9. Configure eclipse:

    • In the top menu bar, select 'Window > Prefences'.

    • Select 'C/C++ > LLVM' in the left menu.

    • In the 'LLVM installation folder:', navigate to your LLVM bin folder
      (/home/[your_user_name]/Development/clang+llvm-3.6.2/bin)
      and click Apply and OK.

    • Select 'File > New > C++ Project' in the menu. C++ Project popup window opens.

    • Enter Project name, select Project type in the Executable group
      and 'LLVM with Clang(Linux)' in Toolchains. Click 'Next > Next'.

    • In the Select Configurations, click 'Advanced settings' button.

    • Select 'C/C++ Build > Settings' in the left menu.

    • In the 'Tool Settings' tab, scroll down and select 'LLVM Clang++ > Dialect'.
      Change it to 'ISO C++11 (-std=c++0x)' and click 'Apply' button.

    • In the 'Tool Settings' tab, scroll down and select 'LLVM Clang C++ linker > Libraries'.
      Make sure the 'Libraries(-l)' list contains 'stdc++'.
      Make sure the 'Library search path(-L) list contains '/usr/lib/gcc/x86_64-linux-gnu/4.8'

    • Click 'Apply' button.

    • In the left menu, select 'C/C++ General > Preprocessor include paths, Macros etc.'

    • Click 'Providers' tab and make sure 'CDT GCC Built-in Compiler Settings [Shared]' is selected. (Should be selected already).

    • Click 'OK' button.

    • Click 'Finish' button.

You should be now able to compile and run your code.

How to use clang/llvm with Eclipse CDT

I am the main author of the (only) LLVM plug-in for Eclipse CDT. It is still in development so might not be suitable for production environment yet. However feel free to test it to find out if it is suitable for your needs.

https://github.com/TuononenP/llvm4eclipsecdt

UPDATE
The latest version is available via official Eclipse update site: http://download.eclipse.org/releases/mars

It is under Programming Languages and is named "C/C++ LLVM-Family Compiler Build Support".

Visual Studio toolchain in Eclipse for C++

Well, I think you should install either windows SDK 7, 8 or Visual C++ 2015 Build Tools.

I tested windows SDK 7 with eclipse neon.
You can find a quick installation guide here.

but I don't know what will happen with Visual C++ 2015 Build Tools.
This tools is introduced in my blog - even written in korean but with full of images.

Then, you can find my another answer.

Finally, you have two check points comparing with what you have done.

The one is

Sample Image

Anther one is

Sample Image

LLVM C++ IDE for Windows

LLVM is supported in Eclipse CDT via plug-in (llvm4eclipsecdt). It is the only Windows supported IDE supporting LLVM as far as I know. I am the main author of the plug-in so you can ask any questions related to it.

The plug-in offers the basic functionality for Clang and llvm-gcc compilation and support Linux and Windows (w/ Cygwin & MiNGW). LLVM tools such as assembler, archiver, linker, and static compiler (llc) are configured and can be customized via UI. The plug-in offers all the benefits that IDE can offer such as easy configuration and building with one action.

The only drawback is that it is not ready yet as it lacks of some of the advanced features that LLVM can offer such as Clang analyze and smart auto-completion. The plug-in is also not tested well and may not work perfectly therefore I hope I can get user feedback via mailing list found from Google code development site (listed below). I wish I had time to develop it further. I only develop it in my spare time, which is very limited. I welcome any developers to participate and contribute to the project.

Development site:

http://code.google.com/p/llvm4eclipsecdt/

https://github.com/TuononenP/llvm4eclipsecdt

Eclipse marketplace (100% free & open-source):

http://marketplace.eclipse.org/content/llvm-toolchain-eclipse-cdt

UPDATE: The plugin is deprecated. Instead install "C/C++ LLVM-Family Compiler Build Support" under Programming Languages using the official Eclipse update site e.g. http://download.eclipse.org/releases/mars



Related Topics



Leave a reply



Submit