[LLVMdev] Segmentation fault - Kaleidoscope

Chris Lattner
2009-06-17T16:51:37Z

On Jun 17, 2009, at 9:46 AM, Paul Melis wrote:

> FWIW, I'm also suddenly experiencing segfaults in code that used to
> work
> a few days ago (I'm using svn). This may be unrelated to the problem
> described below, but perhaps it's the same thing.
>
> In my case it seems that creating an ExecutionEngine has changed. I
> used
> to do
>
>    Module* Mod = makeLLVMModule();      // basically create a gcd
> function
>    verifyModule(*Mod, PrintMessageAction);
>
>    ExecutionEngine *EE;
>    EE = ExecutionEngine::create(Mod);
>
> but I now get 0x0 for EE. The compile command I'm using is
>
> g++ -O3 -I ~/llvm/include/ -L ~/llvm bug.cpp `llvm-config --cxxflags
> --ldflags --libs core jit native` -o bug
>
> I noticed something very recently changed w.r.t. the way LLVM's
> libraries are built (no more .o files). Could this have something to
> with it?

I *just* changed this. :)

For JIT applications, please include llvm/Target/TargetSelect.h and
call the llvm::InitializeNativeTarget() function before creating an EE.

-Chris