Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build LLVM source code on Eclipse?

I am trying to add a new pass to the llvm compiler infrastructure. 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. 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. Is this is a right way to build llvm using eclipse?. Please suggest me steps involved to build llvm source using Eclipse. Note: Platform ubuntu.

like image 884
shashikiran Avatar asked Apr 26 '26 11:04

shashikiran


2 Answers

  1. Tools/versions used by me:

    • eclipse 4.3 Kepler, CDT 8.2.1
    • Oracle Java SDK 1.7.0_45
    • cmake 2.8.11.2
    • LLVM 3.5svn
  2. Create a folder for CDT project files in your workspace. I.e. workspace/llvm.

  3. Generate CDT project files with cmake (being in 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.

  4. Increase eclipse heap allocation size. The default setting is too small and C++ Indexer would hang the whole IDE. Replace default settings with

    -Xms512m
    -Xmx1024m
    

    in eclipse.ini file.

  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). There are also separated targets created for every lib and executable, placed in [Targets] folder. Individual target can be built with option Make Targets → Build...
like image 63
Paweł Bylica Avatar answered Apr 30 '26 10:04

Paweł Bylica


You can use cmake -G"Eclipse CDT4 - Unix Makefiles" to produce the native Eclipse set of projects. 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.

like image 23
SK-logic Avatar answered Apr 30 '26 09:04

SK-logic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!