简体   繁体   English

无法为Eclipse CDT安装LLVM工具链

[英]Unable to install LLVM toolchain for Eclipse CDT

Im trying to get Clang working again on Eclipse and therefore I've tried to install the LLVM toolchain over the Eclipse Marketplace. 我试图让Clang再次在Eclipse上工作,因此我尝试在Eclipse Marketplace上安装LLVM工具链。

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 ? 有没有办法让Clang在Eclipse Mars上工作?

This is a setup from scratch that worked for me (ubuntu 14.04 + eclipse mars + clang 3.6.2). 这是一个从头开始的设置,对我有用(ubuntu 14.04 + eclipse mars + clang 3.6.2)。 You will be probably interested in steps 8 and 9. 您可能对步骤8和9感兴趣。

  1. Install Ubuntu 安装Ubuntu

  2. Install Java 8: 安装Java 8:

    sudo apt-add-repository ppa:webupd8team/java sudo apt-add-repository ppa:webupd8team / java

    apt-get update apt-get update

    apt-get install oracle-java8-installer apt-get install oracle-java8-installer

  3. Install g++: 安装g ++:

    apt-get install g++ apt-get install g ++

  4. Install llvm/clang 3.6.2: 安装llvm / clang 3.6.2:

    http://llvm.org/releases/download.html 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. 我将提取的文件夹重命名为'clang + llvm-3.6.2',因此在安装过程中更方便。 Also I have moved it into /home/[user_name]/Development folder that I created. 此外,我已将其移动到我创建的/ home / [user_name] / Development文件夹中。

  5. Add LLVM/Clang to PATH: 将LLVM / Clang添加到PATH:

    sudo gedit /etc/environment sudo gedit / etc / environment

    Append the path to point to your llvm/clang bin folder. 追加指向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" PATH =“在/ usr / local / sbin中:在/ usr / local / bin目录:/ usr / sbin目录:在/ usr / bin中:/ sbin目录:/ bin中:在/ usr /游戏:在/ usr /本地/游戏:/首页/ [your_user_name ] /Development/clang+llvm-3.6.2/bin”

    Yours might look different, depending on where you placed your llvm/clang. 根据您放置llvm / clang的位置,您的外观可能会有所不同。

    Save changes, reboot. 保存更改,重启。

  6. Install build-essential: 安装build-essential:

    sudo apt-get update sudo apt-get update

    apt-get install build-essential apt-get install build-essential

  7. Install eclipse: 安装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) (我把它移到我的Development文件夹并重命名为eclipse_mars,但它是可选的)

  8. Install CDT and LLVM Support: 安装CDT和LLVM支持:

    • In opened Eclipse, 'Help > Install New Software > Work with: --All available sites--'. 在打开的Eclipse中,“帮助>安装新软件>使用: - 所有可用的站点 - ”。

    • Once the list loads, expand Programming Languages, install 'C/C++ Development Tools SDK' and 'C/C++ LLVM-Family Compiler Build Support'. 加载列表后,展开“编程语言”,安装“C / C ++开发工具SDK”和“C / C ++ LLVM系列编译器构建支持”。

  9. Configure eclipse: 配置eclipse:

    • In the top menu bar, select 'Window > Prefences'. 在顶部菜单栏中,选择“Window> Prefences”。

    • Select 'C/C++ > LLVM' in the left menu. 在左侧菜单中选择“C / C ++> LLVM”。

    • 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. 在“LLVM安装文件夹:”中,导航到LLVM bin文件夹(/home/[your_user_name]/Development/clang+llvm-3.6.2/bin),然后单击“应用”和“确定”。

    • Select 'File > New > C++ Project' in the menu. 在菜单中选择“文件>新建> C ++项目”。 C++ Project popup window opens. C ++项目弹出窗口打开。

    • Enter Project name, select Project type in the Executable group and 'LLVM with Clang(Linux)' in Toolchains. 输入项目名称,在可执行文件组中选择项目类型,在工具链中选择'LLVM with Clang(Linux)'。 Click 'Next > Next'. 单击“下一步>下一步”。

    • In the Select Configurations, click 'Advanced settings' button. 在“选择配置”中,单击“高级设置”按钮。

    • Select 'C/C++ Build > Settings' in the left menu. 在左侧菜单中选择“C / C ++ Build> Settings”。

    • In the 'Tool Settings' tab, scroll down and select 'LLVM Clang++ > Dialect'. 在“工具设置”选项卡中,向下滚动并选择“LLVM Clang ++> Dialect”。 Change it to 'ISO C++11 (-std=c++0x)' and click 'Apply' button. 将其更改为“ISO C ++ 11(-std = c ++ 0x)”并单击“应用”按钮。

    • In the 'Tool Settings' tab, scroll down and select 'LLVM Clang C++ linker > Libraries'. 在“工具设置”选项卡中,向下滚动并选择“LLVM Clang C ++链接器>库”。 Make sure the 'Libraries(-l)' list contains 'stdc++'. 确保'Libraries(-l)'列表包含'stdc ++'。 Make sure the 'Library search path(-L) list contains '/usr/lib/gcc/x86_64-linux-gnu/4.8' 确保'库搜索路径(-L)列表包含'/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.' 在左侧菜单中,选择“C / C ++ General>预处理器包含路径,宏等”。

    • Click 'Providers' tab and make sure 'CDT GCC Built-in Compiler Settings [Shared]' is selected. 单击“提供商”选项卡,确保选中“CDT GCC内置编译器设置[共享]”。 (Should be selected already). (应该已经选择)。

    • Click 'OK' button. 单击“确定”按钮。

    • Click 'Finish' button. 单击“完成”按钮。

You should be now able to compile and run your code. 您现在应该能够编译和运行您的代码。

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. 该插件现已集成到Eclipse CDT中,因此不再需要使用此已弃用的插件。 The latest version is available via official Eclipse update site: http://download.eclipse.org/releases/mars 最新版本可通过官方Eclipse更新站点获得: http//download.eclipse.org/releases/mars

It is under Programming Languages and is named "C/C++ LLVM-Family Compiler Build Support". 它位于Programming Languages下,名为“C / C ++ LLVM-Family Compiler Build Support”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM