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. Including Matlab into Qt: Runtime Error - Shared object not open

Including Matlab into Qt: Runtime Error - Shared object not open

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 5 Posters 2.0k Views
  • 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.
  • R Offline
    R Offline
    Rob123
    wrote on 26 Jan 2018, 08:34 last edited by
    #1

    I'm trying to include a Matlab program into Qt Creator on Ubuntu by using the Matlab Compiler. Therefore, I use a simple test program. In terminal everything works fine when I export LD_LIBRARY_PATH like this:

    export LD_LIBRARY_PATH=/home/robin/Matlab_Runtime/v93/runtime/glnxa64:/home/robin/Matlab_Runtime/v93/bin/glnxa64:/home/robin/Matlab_Runtime/v93/sys/os/glnxa64:
    

    and then run the program. Building the project in Qt Creator works fine, too, but on runtime I'm getting:

    An Error has occurred while trying to initialize the MATLAB Runtime.  
    The error is: Fatal error loading library /home/robin/Matlab_Runtime/v93/bin/glnxa64/libmat.so Error: /home/robin/Matlab_Runtime/v93/bin/glnxa64/libmat.so: shared object not open
    An Error has occurred while trying to initialize the MATLAB Runtime.  
    The error is: Fatal error loading library /home/robin/Matlab_Runtime/v93/bin/glnxa64/libmwmclbase.so Error: /home/robin/Matlab_Runtime/v93/bin/glnxa64/libmwmclbase.so: shared object not open
    could not initialize the application properly
    

    My LD_LIBRARY_PATH is:

    /home/robin/Qt/5.9.1/gcc_64/lib:/home/robin/projects_opencv/Matlab_compiler_test/../../Matlab_Runtime/v93/runtime/glnxa64/:/home/robin/Matlab_Runtime/v93/runtime/glnxa64:/home/robin/Matlab_Runtime/v93/bin/glnxa64:/home/robin/Matlab_Runtime/v93/sys/os/glnxa64:/home/robin/Matlab_Runtime/v93/sys/opengl/lib/glnxa64:/home/robin/Matlab_Runtime/v93/extern/include
    

    Relevant lines in my .pro file:

    INCLUDEPATH += /home/robin/Matlab_Runtime/v93/extern/include
    LIBS += -L$$PWD/../../Matlab_Runtime/v93/runtime/glnxa64/ -lmwmclmcrrt
    INCLUDEPATH += $$PWD/../../Matlab_Runtime/v93/runtime/glnxa64
    DEPENDPATH += $$PWD/../../Matlab_Runtime/v93/runtime/glnxa64
    LIBS += -L$$PWD/../../Matlab_Runtime/v93/bin/glnxa64/ -lmat -lmwmclbase
    INCLUDEPATH += $$PWD/../../Matlab_Runtime/v93/bin/glnxa64
    DEPENDPATH += $$PWD/../../Matlab_Runtime/v93/bin/glnxa64
    

    I'm grateful for any kind of help on this. Thank you very much!

    J 1 Reply Last reply 26 Jan 2018, 09:10
    0
    • R Rob123
      26 Jan 2018, 08:34

      I'm trying to include a Matlab program into Qt Creator on Ubuntu by using the Matlab Compiler. Therefore, I use a simple test program. In terminal everything works fine when I export LD_LIBRARY_PATH like this:

      export LD_LIBRARY_PATH=/home/robin/Matlab_Runtime/v93/runtime/glnxa64:/home/robin/Matlab_Runtime/v93/bin/glnxa64:/home/robin/Matlab_Runtime/v93/sys/os/glnxa64:
      

      and then run the program. Building the project in Qt Creator works fine, too, but on runtime I'm getting:

      An Error has occurred while trying to initialize the MATLAB Runtime.  
      The error is: Fatal error loading library /home/robin/Matlab_Runtime/v93/bin/glnxa64/libmat.so Error: /home/robin/Matlab_Runtime/v93/bin/glnxa64/libmat.so: shared object not open
      An Error has occurred while trying to initialize the MATLAB Runtime.  
      The error is: Fatal error loading library /home/robin/Matlab_Runtime/v93/bin/glnxa64/libmwmclbase.so Error: /home/robin/Matlab_Runtime/v93/bin/glnxa64/libmwmclbase.so: shared object not open
      could not initialize the application properly
      

      My LD_LIBRARY_PATH is:

      /home/robin/Qt/5.9.1/gcc_64/lib:/home/robin/projects_opencv/Matlab_compiler_test/../../Matlab_Runtime/v93/runtime/glnxa64/:/home/robin/Matlab_Runtime/v93/runtime/glnxa64:/home/robin/Matlab_Runtime/v93/bin/glnxa64:/home/robin/Matlab_Runtime/v93/sys/os/glnxa64:/home/robin/Matlab_Runtime/v93/sys/opengl/lib/glnxa64:/home/robin/Matlab_Runtime/v93/extern/include
      

      Relevant lines in my .pro file:

      INCLUDEPATH += /home/robin/Matlab_Runtime/v93/extern/include
      LIBS += -L$$PWD/../../Matlab_Runtime/v93/runtime/glnxa64/ -lmwmclmcrrt
      INCLUDEPATH += $$PWD/../../Matlab_Runtime/v93/runtime/glnxa64
      DEPENDPATH += $$PWD/../../Matlab_Runtime/v93/runtime/glnxa64
      LIBS += -L$$PWD/../../Matlab_Runtime/v93/bin/glnxa64/ -lmat -lmwmclbase
      INCLUDEPATH += $$PWD/../../Matlab_Runtime/v93/bin/glnxa64
      DEPENDPATH += $$PWD/../../Matlab_Runtime/v93/bin/glnxa64
      

      I'm grateful for any kind of help on this. Thank you very much!

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 26 Jan 2018, 09:10 last edited by
      #2

      @Rob123 Are you trying to start your app from QtCreator?
      If so then set the LD_LIBRARY_PATH variable in Run settings of your project (in QtCreator on the left side "Projects/Build & Run".

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      R 1 Reply Last reply 27 Jan 2018, 11:27
      1
      • J jsulm
        26 Jan 2018, 09:10

        @Rob123 Are you trying to start your app from QtCreator?
        If so then set the LD_LIBRARY_PATH variable in Run settings of your project (in QtCreator on the left side "Projects/Build & Run".

        R Offline
        R Offline
        Rob123
        wrote on 27 Jan 2018, 11:27 last edited by Rob123 2 Feb 2018, 09:03
        #3

        @jsulm Thank you for your answer! I did already. My LD_LIBRARY_PATH in build and run in environment is both: /home/robin/Qt/5.9.1/gcc_64/lib:/home/robin/Matlab_Runtime/v93/runtime/glnxa64:/home/robin/Matlab_Runtime/v93/bin/glnxa64:/home/robin/Matlab_Runtime/v93/sys/os/glnxa64:/home/robin/Matlab_Runtime/v93/sys/opengl/lib/glnxa64:/home/robin/Matlab_Runtime/v93/extern/include

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 27 Jan 2018, 16:42 last edited by
          #4

          Hi,

          Not to nitpick, but you’re missing the LD_ in the environment variable name. Is it a typo here ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          R 1 Reply Last reply 2 Feb 2018, 09:02
          0
          • S SGaist
            27 Jan 2018, 16:42

            Hi,

            Not to nitpick, but you’re missing the LD_ in the environment variable name. Is it a typo here ?

            R Offline
            R Offline
            Rob123
            wrote on 2 Feb 2018, 09:02 last edited by
            #5

            @SGaist just a typo ;) thanks anyway

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 2 Feb 2018, 22:12 last edited by
              #6

              Did you try to run ldd on these libraries to check their dependencies ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • Z Offline
                Z Offline
                zhaopengdt
                wrote on 1 Nov 2018, 16:21 last edited by
                #7

                @Rob123 Did you solve this problem? I am encountering the same issue. Could you please tell me how to resolve this if you have found a way?

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  slanoe
                  wrote on 4 Jun 2019, 12:20 last edited by
                  #8

                  I think the problem comes from the Qt libraries embedded in Matlab which are in version 5.5.1 for Matlab v93. Try to compile your project in 5.5.1 rather than 5.9.1 to avoid conflict between Qt versions.

                  1 Reply Last reply
                  0

                  • Login

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