What does it mean when ExecutionEngine::create returns 0? Here's a simplified example: #include "llvm/Module.h" #include "llvm/ExecutionEngine/ExecutionEngine.h" main() { llvm::Module * module = new llvm::Module("the module"); llvm::ExecutionEngine *ee = llvm::ExecutionEngine::create(module); fprintf(stdout, "pointer is %x.\n", ee); } I discovered this with a more complicated example in which I got a segmentation fault the moment I tried to use the created execution engine for anything. In case they are relevant, here are the commands I used to comile the thing g++ -o broken.o -c -I/farhome/hendrik/dv/llvm/llvm/include -I/farhome/hendrik/dv/llvm/obj/include -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -g -Woverloaded-virtual broken.cpp g++ -o broken broken.o /farhome/hendrik/dv/llvm/obj/Debug/lib/LLVMExecutionEngine.o /farhome/hendrik/dv/llvm/obj/Debug/lib/LLVMJIT.o -L/farhome/hendrik/dv/llvm/obj/Debug/lib -lpthread -ldl -lm -lLLVMCore -lLLVMSupport -lLLVMSystem -lLLVMAnalysis -lLLVMTarget -lLLVMSystem -lLLVMAsmParser -lLLVMCodeGen -lLLVMCore -lLLVMSupport -- hendrik
On Sat, 07 Jun 2008 15:24:41 +0000, Hendrik Boom wrote:> What does it mean when ExecutionEngine::create returns 0? > > Here's a simplified example: > > #include "llvm/Module.h" > #include "llvm/ExecutionEngine/ExecutionEngine.h" > > main() > { > llvm::Module * module = new llvm::Module("the module"); > llvm::ExecutionEngine *ee = llvm::ExecutionEngine::create(module); > fprintf(stdout, "pointer is %x.\n", ee); > } > > I discovered this with a more complicated example in which I got a > segmentation fault the moment I tried to use the created execution > engine for anything.I got the toy.cpp program from Chapter 4 of the tutorial to compile, after one change to line 359 from return ConstantFP::get(Type::DoubleTy, APFloat(Val)); to return ConstantFP::get(APFloat(Val)); Now to compare it in detail with the much smaller program I've got and maybe I'll figure out what's wrong with my call to ExecutionEngine::create. -- hendrik
> Now to compare it in detail with the much smaller program I've got and > maybe I'll figure out what's wrong with my call to > ExecutionEngine::create.That call is perfectly valid, actually. It works for me when linked with: g++ -o b b.o `llvm-config --ldflags` `llvm-config --libs engine jit` Cheers, -Mahadevan.