ALbert Mietus
2010-Jan-22 18:56 UTC
[LLVMdev] Kaleidoscope-tutorial: Fails to create the JIT
Hello All I 'm studing LLVM/Clang and trying to follow the Kaleidoscope tutorial (Release 2.6 version). I found some minir docu-bugs and added them to Bugzilla. However, Now I found a show-stopper for me, the toy (v4) demo does build, but does crash, on any input. Even a simpe ';'! Looking into the (demo-code) found the that the JIT can't be build/ created,/loaded/... Which result's in a null-pointer for "TheExecutionEngine"; which explains the bus-errror .. The main code is || ... //GAM some setting of vars || fprintf(stderr, "ready> "); || getNextToken(); || || // Make the module, which holds all the code. || TheModule = new Module("my cool jit", getGlobalContext()); || //GAM: check TheModule: it's a valid pointer || || // create the JIT. || TheExecutionEngine = EngineBuilder(TheModule).create(); || //GAM: check TheExecutionEngine: IT IS A NULL POINTER [My addition are annotated by 'GAM'] This code, seams right to me; so probably it is an installation problem. Or such. But the code is to big to solve this now. I' following the tutorial, to get familiair with it. :-) So I need some help. Please give respond with a fix, workaround,. or when needed details Some details: Version is 2.6, PreBuild Apple OS-X download (from llvm- website). But the same happens with build form 2.6 sources. Apple (Laptop) , intel; Leopard OS (No Snow), with all updates Placed the bin/libs in a custom dir: $HOME/NoTimeMachine/LLCM/ PreBuild/ is LLVM home [or: .../<OwnBuidl>/Release/] Build the Kaleidoscope tool, as mentioned in the docs: g++ -g -O3 $< -o $@ `${LLVM}/bin/llvm-config --cppflags --ldflags -- libs core jit native` Also tried with -rdynamic option; same result Please send me instruction for a patch/workarond, so I can continue this tutorial, make bug-reports and/or -fixes. Thanks! Notice: I'n not part of the -dev list, so please responds to my directly: albert AT mietus DOT nl, or the email in header. Thanks ALbert Mietus GSM: +316 16 531 258 Send prive mail to: ALbert at ons-huis dot net Don't send spam mail! Mijn missie: http://SoftwareBeterMaken.nl product, proces & imago. Mijn leven in het kort: http://albert.mietus.nl/Doc/CV_ALbert.html
Reid Kleckner
2010-Jan-22 20:55 UTC
[LLVMdev] Kaleidoscope-tutorial: Fails to create the JIT
On Fri, Jan 22, 2010 at 1:56 PM, ALbert Mietus <albert at ons-huis.net> wrote:> Hello All > > I 'm studing LLVM/Clang and trying to follow the Kaleidoscope tutorial > (Release 2.6 version). > I found some minir docu-bugs and added them to Bugzilla. > > However, Now I found a show-stopper for me, the toy (v4) demo does > build, but does crash, on any input. Even a simpe ';'! > Looking into the (demo-code) found the that the JIT can't be build/ > created,/loaded/... > Which result's in a null-pointer for "TheExecutionEngine"; which > explains the bus-errror .. > > The main code is > || ... //GAM some setting of vars > || fprintf(stderr, "ready> "); > || getNextToken(); > || > || // Make the module, which holds all the code. > || TheModule = new Module("my cool jit", getGlobalContext()); > || //GAM: check TheModule: it's a valid pointer > || > || // create the JIT. > || TheExecutionEngine = EngineBuilder(TheModule).create();Try changing the above line to: std::string str; TheExecutionEngine EngineBuilder(OurModuleProvider).setErrorStr(str).create(); cout << str << '\n'; This interface should set str to an appropriate error message if it returns NULL. Reid
On Friday 22 January 2010 18:56:29 ALbert Mietus wrote:> This code, seams right to me; so probably it is an installation > problem. Or such.I suspect the code is wrong as of LLVM 2.6 which introduced a new requirement: the initialize_native_target function must be called before the JIT is created, in order to initialize the available target architectures. Otherwise, the JIT will not initialize. This breaking change was described in the OCaml Journal article "LLVM 2.6 support and a new HLVM garbage collector" (23rd October 2009). -- Dr Jon Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?e
ALbert Mietus
2010-Jan-23 17:21 UTC
[LLVMdev] Kaleidoscope-tutorial: Fails to create the JIT
I ask for advice, for TheExecutionEngine === NULL,>> Which result's in a null-pointer for "TheExecutionEngine"; which >> explains the bus-errror ..Reid Kleckner wrote:> Try changing the above line to: > std::string str; > TheExecutionEngine = > EngineBuilder(OurModuleProvider).setErrorStr(str).create(); > cout << str << '\n'; > > This interface should set str to an appropriate error message if it > returns NULL.I tried this, assuming that line should be || TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&str).create(); --------------------------------------------------------- ^^^^^^^^^^------------------^---------------- * There is on "OurModuleProvider, g++ says .., and * g++ complains about the str-type (Well, g++ actually complain about the function; but I assume this is what is means, ... At least adding the & help to compile it:-) The result: nada. No string is printed! (or an empty string, I should say) So more help is welcome.! Can somebody just try the code on his/her machine; maybe the tutorial is "to old" The code is, as you probably know, at: http://llvm.org/releases/2.6/docs/tutorial/LangImpl4.html#code When it is working on your system, please email me, including that version (or svn- tag/date) And I will try the same version Thanks --Groetjes, Albert ALbert Mietus GSM: +316 16 531 258 Send prive mail to: ALbert at ons-huis dot net Don't send spam mail! Mijn missie: http://SoftwareBeterMaken.nl product, proces & imago. Mijn leven in het kort: http://albert.mietus.nl/Doc/CV_ALbert.html
Reasonably Related Threads
- [LLVMdev] Kaleidoscope-tutorial: Fails to create the JIT
- [LLVMdev] Kaleidoscope-tutorial: Fails to create the JIT
- [LLVMdev] Kaleidoscope-tutorial: Fails to create the JIT
- [LLVMdev] Kaleidoscope-tutorial: Fails to create the JIT
- [LLVMdev] Kaleidoscope-tutorial: Fails to create the JIT