I just downloaded LLVM a couple days ago – I got everything built and installed quite easily using CMake to generate build files for Eclipse CDT + MinGW. That much worked like a charm – but I’ve spent most of the intervening time trying to get a simple project set up.
My goal is to create a project consisting of two main parts:
- A backend for WDC 65816
- A frontend including a simple programming language and tools for managing generated code
It’s my understanding that it’s necessary to develop the backend as part of the LLVM source tree. The frontend, though, I would like to maintain as a separate project, with as little coupling as possible to the rest of the LLVM source and build configuration.
The problem, though, is that I’m having a heck of a time figuring out how to do this. I started with the “Creating an LLVM Project” documentation:
Which advises copying projects/sample to a location of your choosing and modifying it with autoconf. That seems to be a tricky proposition on Windows, though, especially if you want to use Eclipse CDT to build and maintain your project. For one thing, since I built using CMake instead of using the configure script, some files (like Makefile.config in LLVM_OBJ_ROOT) do not exist.``
Eventually I decided to just try compiling the source for Chapter 3 of the Kaleidoscope tutorial directly with GCC. Here was the command line I used:
llvm-config --libs core
This compiled just fine, with no warnings; but when I tried to run the program, as soon as I entered an expression for Kaleidoscope to compile, I got an assert failure like this:
define double @0()Assertion failed: errorcode == 0, file c:/llvm-2.7/lib/System/RWMutex.cpp, line 87
When I built the examples using Eclipse CDT (via the CMake-generated project files), the Kaleidoscope examples all worked perfectly.
So what’s the scoop? Is there any way I can conveniently create a project with Eclipse CDT that uses LLVM? What do I actually need to include and link? Any advice or guidance would be greatly appreciated.