[LLVMdev] compiling the tutorial

Carlo Alberto Ferraris cafxx at strayorange.com
Thu Nov 20 03:12:34 PST 2008

I'm investigating adding LLVM JIT support to a project of mine, but I'm 
having issues when trying to compile the Kaleidoscope tutorial* under 
MSVC 2008.
In particular, the problem is that in main() when this line is executed
>   // Create the JIT.
>   TheExecutionEngine = ExecutionEngine::create(TheModule);
create returns null, because both JITCtor and InterpCtor are null.
I found this comment in ExecutionEngine.h
>   // To avoid having libexecutionengine depend on the JIT and interpreter
>   // libraries, the JIT and Interpreter set these functions to ctor 
> pointers
>   // at startup time if they are linked in.
>   typedef ExecutionEngine *(*EECtorFn)(ModuleProvider*, std::string*,
>                                        bool Fast);
>   static EECtorFn JITCtor, InterpCtor;
so I suppose that somehow I'm missing a library, but in my project 
settings I added "<path_to_project>\llvm\*.lib" in the 
linker>input>additional dependencies (proof it works is that the 
tutorial compiles and links just fine), and the contents of that 
directory are
> Analysis.lib
> analysis.pdb
> Archive.lib
> archive.pdb
> AsmParser.lib
> asmparser.pdb
> Bitcode.lib
> bitcode.pdb
> CBackend.lib
> cbackend.pdb
> CodeGen.lib
> codegen.pdb
> ExecutionEngine.lib
> executionengine.pdb
> Linker.lib
> linker.pdb
> support.lib
> support.pdb
> System.lib
> system.pdb
> Target.lib
> target.pdb
> Transforms.lib
> transforms.pdb
> VMCore.lib
> vmcore.pdb
> x86.lib
> x86.pdb
i.e. all the libraries created by the bundled llvm msvs solution, except 
for the CLI programs.
so I'm stuck, because it looks like the libraries are being linked 
(otherwise the tutorial wouldn't even link) but somehow something goes 
wrong and those static variables are not set. I also tried to place a 
breakpoint on JIT::Register() but it is never reached. any clue why?
my environment is Vista x86 SP1, MSVS 2008.
thank you very much for your attention,
Carlo Alberto Ferraris

* great tutorial, btw!

More information about the llvm-dev mailing list