无法为Eclipse CDT安装LLVM工具链 [英] Unable to install LLVM toolchain for Eclipse CDT
问题描述
我试图让Clang在Eclipse上重新工作,因此我试图在Eclipse Marketplace上安装LLVM工具链。与安装我得到以下错误
无法读取存储库在http://petrituononen.com/llvm4eclipsecdt/update。
http://petrituononen.com/llvm4eclipsecdt/update不是有效的存储库位置。
这个网站似乎已关闭,但我找不到任何其他来源。
有什么办法让Clang在Eclipse Mars上工作吗?
scratch为我工作(ubuntu 14.04 + eclipse mars + clang 3.6.2)。您可能对步骤8和9感兴趣。
-
安装Ubuntu
-
安装Java 8:
sudo apt-add-repository ppa:webupd8team / java
apt-get update
apt-get install oracle-java8-installer
apt-get install g ++
-
安装llvm / clang 3.6.2:
http://llvm.org/releases/download.html
下载并解压缩到您选择的文件夹。我将解压缩的文件夹重命名为clang + llvm-3.6.2,因此在安装过程中更方便。
-
将LLVM / Clang添加到PATH:
sudo gedit / etc / environment
附加指向您的llvm / clang bin文件夹的路径。
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
您的外观可能会有所不同,具体取决于您放置llvm /
-
安装build-essential:
< b
$ bsudo apt-get update
apt-get install build-essential
-
安装eclipse:
下载并解压到您选择的文件夹。 (我将其移动到我的开发文件夹并重命名为eclipse_mars,但它是可选的)
-
安装CDT和LLVM支持:
-
在打开的Eclipse中,'帮助>安装新软件>使用: - 所有可用的网站 - '。
-
列表加载后,展开编程语言,安装C / C ++开发工具SDK和C / C ++ LLVM-家族编译器构建支持。
-
-
设定eclipse:
-
菜单栏,选择Window> Prefences。
-
在左侧菜单中选择C / C ++> LLVM。
-
'LLVM安装文件夹:',导航到您的LLVM bin文件夹
(/home/[your_user_name]/Development/clang+llvm-3.6.2/bin)
,然后单击应用并确定。 p> -
在菜单中选择文件>新建> C ++项目。
-
输入项目名称,在工具链中选择可执行组
和'LLVM with Clang(Linux)'中的项目类型。 -
在选择配置中,点击高级设置按钮。
-
在左侧菜单中选择C / C ++ Build>在工具设置选项卡中,向下滚动并选择LLVM Clang ++>方言。
将其更改为ISO C ++ 11(-std = c ++ 0x)并单击应用按钮。 -
工具设置选项卡,向下滚动并选择LLVM Clang C ++链接器>库。
确保'Libraries(-l)'列表包含'stdc ++'。
确保'库搜索路径(-L)列表包含'/usr/lib/gcc/x86_64-linux-gnu/4.8' -
-
点击提供商选项卡,确保选择了CDT GCC内置编译器设置[共享]。 (应已选择)。
-
点击确定 完成按钮。
-
编译并运行您的代码。
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 ?
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.
Install Ubuntu
Install Java 8:
sudo apt-add-repository ppa:webupd8team/java
apt-get update
apt-get install oracle-java8-installer
Install g++:
apt-get install g++
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.
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.
Install build-essential:
sudo apt-get update
apt-get install build-essential
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)
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'.
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.
这篇关于无法为Eclipse CDT安装LLVM工具链的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!