Can't get ChaiScript to work within QtCreator
-
I am trying to use the chaiscript scripting language but I have a hard time getting it working.
In my project's .pro file I have included the library include path:INCLUDEPATH += "D:\DevTools\ChaiScript-5.7.1\include"
and in my main.cpp file I only have the basic example posted in the chaiscript homepage:
#include <chaiscript/chaiscript.hpp> std::string helloWorld(const std::string &t_name) { return "Hello " + t_name + "!"; } int main() { chaiscript::ChaiScript chai; chai.add(chaiscript::fun(&helloWorld), "helloWorld"); chai.eval("puts(helloWorld(\"Bob\"));"); }
The compiling process goes fine, but when I run the application it says:
Starting D:\Documents\Qt\Builds\ChaiScript_Test-x32\debug\ChaiScript_Test.exe... This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. D:\Documents\Qt\Builds\ChaiScript_Test-x32\debug\ChaiScript_Test.exe exited with code 255
The debugger adds this:
terminate called after throwing an instance of 'chaiscript::exception::load_module_error' what(): Unable to find module: chaiscript_stdlib-5.7.1 Errors: Impossibile trovare il modulo specificato.
I have also tried to #include <chaiscript/chaiscript_stdlib.hpp> but it changes nothing.
Can someone please help me getting ChaiScript to work? -
hi
what does
"Impossibile trovare il modulo specificato."
means ? -
It basically says the same thing it said before: "Unable to find the specified module"
I have also seen on the web the error "chaiscript::exception::load_module_error" could be caused by unsupported c++11 features. I am using the mingw32 and mingw64 compilers, with gcc 5.1.0 and c++11 support on Windows 10 - if that's of any help...
-
so it seems to crash on loading its version of
stdlib called chaiscript_stdlib
On example it says
"Note that this example relies on being able to find the ChaiScript Stdlib module, precompiled in a known location."So did you precompile anything and put it in a "known " location ?
I know u tried with
#include <chaiscript/chaiscript_stdlib.hpp>So maybe precompiled will work. No idea on how to do that though.
-
I wonder if it is compatible with mingw?
only VS and g++ is mentioned.Yeah I saw the headeronly statement and yet all samples
talked about this stdlib as precompiled.update:
some site mention
https://github.com/ChaiScript/ChaiScript/issues/89include <chaiscript/chaiscript_stdlib.hpp>
chai(chaiscript::Std_Lib::library());to compile it. (with it self it seems)
Update 2:
there is a chaiscript_stdlib-5.7.1.dll
if that is compiled with Studio and your program is compiled with
mingw on windows, it will not work. (or might not)
seems that windows/mingw is supported if u compile it yourself.
http://discourse.chaiscript.com/t/cross-compiling-for-windows-from-linux/53 -
mingw provides the gcc.exe and g++.exe binaries, which makes it compatible with the unix g++ compiler.
Anyway I've been trying with CMake and mingw32-make for two hours now, none of them could find any file to "make" something.
Compiling applications with #include <chaiscript/chaiscript_stdlib.hpp> should include this lib into the executable code and require no other libs (even though, it requires longer compile times), but it just fails with different messages: at times I get "File too big", other times I get "too many sections" or the simple "Unable to find the specified module". The chaiscript website does not even provide instructions to build the chaiscript_stdlib separately or anything...
Why do developers always assume everyone is supposed to know what to do and how to do it instead of providing clear instructions?! Meh... I'll just quit trying, I don't have time to waste.Thank you very much for trying to help me, mrjj, I appreciate that.
-
mingw provides the gcc.exe and g++.exe binaries, which makes it compatible with the unix g++ compiler.
Anyway I've been trying with CMake and mingw32-make for two hours now, none of them could find any file to "make" something.
Compiling applications with #include <chaiscript/chaiscript_stdlib.hpp> should include this lib into the executable code and require no other libs (even though, it requires longer compile times), but it just fails with different messages: at times I get "File too big", other times I get "too many sections" or the simple "Unable to find the specified module". The chaiscript website does not even provide instructions to build the chaiscript_stdlib separately or anything...
Why do developers always assume everyone is supposed to know what to do and how to do it instead of providing clear instructions?! Meh... I'll just quit trying, I don't have time to waste.Thank you very much for trying to help me, mrjj, I appreciate that.
@T3STY
well I also looked at it. No easy way to to compile with mingw
i could find.I think the main issue is the DLL. Normally mixing compilers for
exe and DLL is a no go as with Qt.
So we need a mingw binary setup.I agree. Using mingw also and often slightly bitten by the fact that all seems to build for Visual Studio on windows
and gcc on linux so
mingw on windows is left as the ugly step child, no ones likes.you are very welcome .seems very interesting script lib.
-
I said I would quit, but I haven't yet... I am making some progress.
I have managed to get chaiscript started, both inside and outside of Qt Creator.
I have manually compiled chaiscript_stdlib like this:g++ "D:/DevTools/ChaiScript-5.7.1/src/chaiscript_stdlib.cpp" -o "D:/cstest/chaiscript_stdlib-5.7.1.dll" -shared -v -std=c++0x -Wp,-I"D:/DevTools/ChaiScript-5.7.1/include" -Wa,-mbig-obj
When compiling the basic example in Qt Creator, copying the chaiscript_stdlib-5.7.1.dll file to the exe directory, and running it, it will show the message "Hello Bob". But then it will crash with a segmentation fault error on line 1915 of file hashtable.h.
When compiling the basic example from command line like this:
g++ "D:/cstest/main.cpp" -o "D:/cstest/cstest.exe" -v -std=c++0x -Wp,-I"D:/DevTools/ChaiScript-5.7.1/include" -Wa,-mbig-obj -static
the exe will start, but it will fail to load chaiscript_stdlib-5.7.1.dll with the same "Unable to find module" error message that I posted in my first post.
The compiled in example works just fine when compiled from command line (not working in Qt Creator, can't get qmake to pass the -mbig-obj parameter to the assembler...)
Anyway, I have got in touch with the chaiscript author and I am continuing the discussion at this link:
http://discourse.chaiscript.com/t/help-compiling-chaiscript-stdlib-dll-with-mingw-5-1-0-and-qt/133
In this topic I will update while I make any progress so people looking for answers may find one... hopefully...EDIT
The above only seems to work for mingw32 (32 bit). The mingw64 (64-bit) compilation hangs on collect2.exe. It might be a bad compiler installation, but I'm quite sure the issue is somewhere else.