Unable to install LLVM toolchain for Eclipse CDT
Asked Answered
L

2

4

Im trying to get Clang working again on Eclipse and therefore I've tried to install the LLVM toolchain over the Eclipse Marketplace.

But when I click Confirm to procceed with the installation I get the following error

Unable to read repository at http://petrituononen.com/llvm4eclipsecdt/update.
http://petrituononen.com/llvm4eclipsecdt/update is not a valid repository location.

This site seems to be down but I cant find any alternative sources.

Is there any way to get Clang working on Eclipse Mars ?

Legging answered 22/9, 2015 at 20:23 Comment(0)
R
15

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.

Ronda answered 25/9, 2015 at 10:56 Comment(3)
thats one hell of an answer! thank you so much. My failure was at point 8 where I tried to install the "LLVM toolchain for Eclipse CDT 1.1.7" through the marketplace instead of the "C/C++ LLVM-Family Compiler Build Support".Legging
I installed LLVM on Debian using apt-get. I had to set the LLVM path in Eclipse to directory pointed to by llvm-config-3.5 --bindir.Selfcontained
No LLVM option exists under Preferences > C/C++ after installing the plugin in Eclipse 2021-12Limelight
R
8

That was my domain but now I don't have it anymore.

The plugin is now integrated into Eclipse CDT so there is no need to use this deprecated plugin anymore. 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".

Rhino answered 7/11, 2015 at 11:47 Comment(2)
Still, that just covers step 8 in Otaxar's answer. Step 9 is still needed, even in Mac OS X (where clang has been the default compiler for a couple of years already)Quatrefoil
Sure, my instructions were only related for installing the LLVM plugin for Eclipse CDT. It does not contain LLVM libraries which have to be installed separately and installation path chosen in Eclipse as per Otaxar's instructions.Rhino

© 2022 - 2024 — McMap. All rights reserved.