简体   繁体   English

如何在Eclipse上构建LLVM源代码?

[英]How to build LLVM source code on Eclipse?

I am trying to add a new pass to the llvm compiler infrastructure. 我正在尝试向llvm编译器基础结构添加新传递。 I have been able to build LLVM-2.9 using make.But I wants to build using Eclipse so that I can trace the code. 我已经能够使用make构建LLVM-2.9。但是我想使用Eclipse构建,以便我可以跟踪代码。 I imported llvm source files to c++ project with LinuxGcc tool chain and CDT internal builder(Eclipse with CDT-7.0).But it gives some errors. 我使用LinuxGcc工具链和CDT内部构建器(带有CDT-7.0的Eclipse)将llvm源文件导入到c ++项目中。但是它给出了一些错误。 Is this is a right way to build llvm using eclipse?. 这是使用eclipse构建llvm的正确方法吗? Please suggest me steps involved to build llvm source using Eclipse. 请建议我使用Eclipse构建llvm源的步骤。 Note: Platform ubuntu. 注意:平台ubuntu。

  1. Tools/versions used by me: 我使用的工具/版本:

    • eclipse 4.3 Kepler, CDT 8.2.1 eclipse 4.3 Kepler,CDT 8.2.1
    • Oracle Java SDK 1.7.0_45 Oracle Java SDK 1.7.0_45
    • cmake 2.8.11.2 cmake 2.8.11.2
    • LLVM 3.5svn LLVM 3.5svn
  2. Create a folder for CDT project files in your workspace. 在工作区中为CDT项目文件创建一个文件夹。 Ie workspace/llvm . workspace/llvm

  3. Generate CDT project files with cmake (being in workspace/llvm ): 使用cmake生成CDT项目文件(在workspace/llvm ):

     cmake -G "Eclipse CDT4 - Unix Makefiles" -D_ECLIPSE_VERSION=4.3 ../../src/llvm 

    If eclipse version is not set the generator will assume 3.7 and inform you that it can be changed by CMAKE_ECLIPSE_VERSION option, what turns out to be the wrong name for that option. 如果未设置eclipse版本,则生成器将假定为3.7并通知您可以通过CMAKE_ECLIPSE_VERSION选项更改它,结果是该选项的名称错误。

  4. Increase eclipse heap allocation size. 增加eclipse堆分配大小。 The default setting is too small and C++ Indexer would hang the whole IDE. 默认设置太小,C ++ Indexer会挂起整个IDE。 Replace default settings with 用。替换默认设置

     -Xms512m -Xmx1024m 

    in eclipse.ini file. eclipse.ini文件中。

  5. Import the project into your workspace. 将项目导入工作区。 File → Import... → General → Existing Projects into Workspace. 文件→导入...→常规→现有项目到工作区。

  6. The project llvm can be built as one (option Build Project). 项目llvm可以构建为一个(选项Build Project)。 There are also separated targets created for every lib and executable, placed in [Targets] folder. 还为每个lib和可执行文件创建了分隔的目标,放在[Targets]文件夹中。 Individual target can be built with option Make Targets → Build... 可以使用选项Make Targets→Build ...构建单个目标。

You can use cmake -G"Eclipse CDT4 - Unix Makefiles" to produce the native Eclipse set of projects. 您可以使用cmake -G"Eclipse CDT4 - Unix Makefiles"成本机Eclipse项目集。 It might require tweaking your CMakeLists.txt to remove the check for in-source builds (since Eclipse can only support project files and sources in the same directory, but for some reason the current CMakeLists allows it for MSVS only) - just follow the error messages. 它可能需要调整你的CMakeLists.txt来删除对源内构建的检查(因为Eclipse只能支持同一目录中的项目文件和源,但由于某种原因,当前的CMakeLists仅允许它用于MSVS) - 只需按照错误消息。

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

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