Hendrik Boom-2 wrote:> > On Tue, 10 Jun 2008 07:07:35 +0530, Mahadevan R wrote: > >>> 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. > > Thanks. It's compiling and executing now. > > The story appears to be this: > > llvm::ExecutionEngine::create requires particular libraries (presumably > those that involve execution, JIT code generation, or interpretation) to > be linked into the executable (the executable that contains the call to > llvm::ExecutionEngine::create), or else it returns NULL. However, > llvm::ExecutionEngine::create does not itself contains references to > entry-points that would cause the necessary libraries to be sought by the > linker, so no linker failure results. > > Would it be possible to include this information in the documentation for > llvm::ExecutionEngine::create? > > -- hendrik > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >I am using llvm 2.6 and I am getting the same error. I tried using llvm-config with flags '--libs core engine jit native'. But ExecutionEngine returns NULL. I even tried including the JIT.h. No luck there too. Here is my code listing: llvm::ExecutionEngine* ee = llvm::ExecutionEngine::create(mModule); llvm::Function* func = ee->FindFunctionNamed("main"); typedef void (*PFN)(); PFN pfn = reinterpret_cast<PFN> (ee->getPointerToFunction(func)); pfn(); delete ee; thanks, subramanyam -- View this message in context: http://old.nabble.com/ExecutionEngine%3A%3Acreate-returns-0-tp17710149p29825737.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
> > I am using llvm 2.6 and I am getting the same error. I tried using > llvm-config with flags '--libs core engine jit native'. But ExecutionEngine > returns NULL. I even tried including the JIT.h. No luck there too. > > Here is my code listing: > llvm::ExecutionEngine* ee = llvm::ExecutionEngine::create(mModule); > llvm::Function* func = ee->FindFunctionNamed("main"); > typedef void (*PFN)(); > PFN pfn = reinterpret_cast<PFN> (ee->getPointerToFunction(func)); > pfn(); > delete ee;More information would be helpful, if you have a program that someone else can compile or take a look at we might be able to help. That said, 2.6 is pretty old at this point and I'm really only willing to look at failures with ToT. The HowToUseJIT example compiles and links just fine on ToT for me. -eric
On Sep 28, 2010, at 1:53 AM, Subramanyam P.U.R. wrote:> I am using Fedora 10 and I installed LLVM2.6 from binaries. I use gcc front-end(not Clang). Do I need to install something else, to be able to add JIT support? >I don't know, I don't package it.> I am able to compile HowToUseJIT example. The compilation command is > g++ -g -rdynamic toy.cpp `llvm-config --cppflags --ldflags --libs core jit native` -O3 -o toy > > But I am getting segmentation fault because of the NULL returned by ExecutionEngine::create(Module*) method. >Not surprising since you're dereferencing a NULL pointer.> Here is the error I get when I run HowToUseJIT example > > Program received signal SIGSEGV, Segmentation fault. > 0x080b02f6 in llvm::ExecutionEngine::getTargetData () at /home/subbu/llvm/install/include/llvm/ExecutionEngine/ExecutionEngine.h:167 > 167 const TargetData *getTargetData() const { return TD; } >Is that using 2.6 or something newer? My guess is that, of course, you don't have a target data. You'll need to debug why you can't seem to create one for your host. That said, if you can't get it to work with the 2.8 branch let me know. -eric
Seemingly Similar Threads
- [LLVMdev] ExecutionEngine::create returns 0
- [LLVMdev] Kaleidoscope toy4 failure seg fault on llvm::ExecutionEngine::getTargetData (this=0x0)
- [LLVMdev] llvm-mc build fails
- [LLVMdev] Kaleidoscope toy4 failure seg fault on llvm::ExecutionEngine::getTargetData (this=0x0)
- [LLVMdev] Error while creating ExecutionEngine