Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can't get ChaiScript to work within QtCreator
Forum Updated to NodeBB v4.3 + New Features

Can't get ChaiScript to work within QtCreator

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 2 Posters 2.9k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    T3STY
    wrote on 21 Nov 2015, 13:01 last edited by T3STY
    #1

    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?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 21 Nov 2015, 13:05 last edited by
      #2

      hi
      what does
      "Impossibile trovare il modulo specificato."
      means ?

      T 1 Reply Last reply 21 Nov 2015, 13:09
      0
      • M mrjj
        21 Nov 2015, 13:05

        hi
        what does
        "Impossibile trovare il modulo specificato."
        means ?

        T Offline
        T Offline
        T3STY
        wrote on 21 Nov 2015, 13:09 last edited by T3STY
        #3

        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...

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 21 Nov 2015, 13:50 last edited by
          #4

          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.

          1 Reply Last reply
          0
          • T Offline
            T Offline
            T3STY
            wrote on 21 Nov 2015, 13:55 last edited by
            #5

            I haven't compiled anything. The library is supposed to be header only, not relying on any precompiled code/lib. I'm going to look for a way to compile the chaiscript_stdlib, but seems strange to me that I need it.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 21 Nov 2015, 13:56 last edited by mrjj
              #6

              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/89

              include <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

              1 Reply Last reply
              0
              • T Offline
                T Offline
                T3STY
                wrote on 21 Nov 2015, 15:19 last edited by
                #7

                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.

                M 1 Reply Last reply 21 Nov 2015, 15:27
                0
                • T T3STY
                  21 Nov 2015, 15:19

                  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.

                  M Offline
                  M Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 21 Nov 2015, 15:27 last edited by mrjj
                  #8

                  @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.

                  1 Reply Last reply
                  0
                  • T Offline
                    T Offline
                    T3STY
                    wrote on 22 Nov 2015, 16:43 last edited by T3STY
                    #9

                    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.

                    1 Reply Last reply
                    1

                    1/9

                    21 Nov 2015, 13:01

                    • Login

                    • Login or register to search.
                    1 out of 9
                    • First post
                      1/9
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved