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.
2 Answers
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
Create a folder for CDT project files in your workspace. I.e.
workspace/llvm
.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.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.Import the project into your workspace. File → Import... → General → Existing Projects into Workspace.
- 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...

- 3,780
- 1
- 31
- 44
-
I was able to build LLVM + Clang using your answer. Now I am facing an issue regarding the time it takes for the indexer to cover all the source files. Do you have any tip on how one could decrease this indexing time ? – Manuel Selva Oct 04 '16 at 14:35
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.

- 9,605
- 1
- 23
- 35