Problems linking Matlab libraries into Qt (Linux) .. libeng.so: undefined reference to ..



  • Hey
    I want to create a program that has a user interface for inputs and outputs that is created using Qt c++ IDE and back functions that are programmed using matlab.
    To do that im using MATLAB Engine library in GUI code, but im having problems to link the Matlab libraries.
    My code of the .pro file is:

    TEMPLATE = app
    CONFIG += console
    CONFIG -= app_bundle
    CONFIG -= qt
    SOURCES += main.c
    include(deployment.pri)
    qtcAddDeployment()
    INCLUDEPATH += $$PWD/../../../MATLAB/R2016a/extern/include
    INCLUDEPATH += $$PWD/../../../MATLAB/R2016a/bin/glnxa64
    DEPENDPATH += $$PWD/../../../MATLAB/R2016a/bin/glnxa64
    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../MATLAB/R2016a/bin/glnxa64/release/
    -lmex
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../MATLAB/R2016a/bin/glnxa64
    /debug/ -lmex
    else:unix: LIBS += -L$$PWD/../../../MATLAB/R2016a/bin/glnxa64/ -lmex
    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../MATLAB/R2016a/bin/glnxa64/release/
    -leng
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../MATLAB/R2016a/bin/glnxa64
    /debug/ -leng
    else:unix: LIBS += -L$$PWD/../../../MATLAB/R2016a/bin/glnxa64/ -leng
    

    The compile output is as follows:

    14:50:27: Running steps for project untitled...
    14:50:27: Configuration unchanged, skipping qmake step.
    14:50:27: Starting: "/usr/bin/make" 
    g++ -Wl,-rpath,/home/tecnobit/Qt5.5.0/5.5/gcc_64 -o untitled main.o   -L/home/user/desktop/untitled
    /../../../MATLAB/R2016a/bin/glnxa64/ -lmex -leng 
    /usr/bin/ld: warning: libut.so, needed by /home/user/desktop/untitled/../../../MATLAB/R2016a
    /bin/glnxa64//libeng.so, not found (try using -rpath or -rpath-link)
    /usr/bin/ld: warning: libmx.so, needed by /home/user/desktop/untitled/../../../MATLAB/R2016a
    /bin/glnxa64//libeng.so, not found (try using -rpath or -rpath-link)
    /usr/bin/ld: warning: libmat.so, needed by /home/user/desktop/untitled/../../../MATLAB/R2016a
    /bin/glnxa64//libeng.so, not found (try using -rpath or -rpath-link)
    /usr/bin/ld: warning: libboost_system.so.1.56.0, needed by /home/user/desktop/untitled/../../../MATLAB
    /R2016a/bin/glnxa64//libeng.so, not found (try using -rpath or -rpath-link)
    /usr/bin/ld: warning: libmwcpp11compat.so, needed by /home/user/desktop/untitled/../../../MATLAB
    /R2016a/bin/glnxa64//libeng.so, not found (try using -rpath or -rpath-link)
    /home/user/desktop/untitled/../../../MATLAB/R2016a/bin/glnxa64//libeng.so: undefined reference to 
    `utF2cstr'
    /home/user/desktop/untitled/../../../MATLAB/R2016a/bin/glnxa64//libeng.so: undefined reference to 
    `utFree'
    /home/user/desktop/untitled/../../../MATLAB/R2016a/bin/glnxa64//libeng.so: undefined reference to 
    `matClose'
    /home/user/desktop/untitled/../../../MATLAB/R2016a/bin/glnxa64//libeng.so: undefined reference to 
    `matPutNextVariable'
    /home/user/desktop/untitled/../../../MATLAB/R2016a/bin/glnxa64//libeng.so: undefined reference to 
    `matCreateMATFile'
    /home/user/desktop/untitled/../../../MATLAB/R2016a/bin/glnxa64//libeng.so: undefined reference to 
    `matrix::detail::noninlined::mx_array_api::mxDestroyArray(mxArray_tag*)'
    /home/user/desktop/untitled/../../../MATLAB/R2016a/bin/glnxa64//libeng.so: undefined reference to 
    `matGetNextVariable'
    /home/user/desktop/untitled/../../../MATLAB/R2016a/bin/glnxa64//libeng.so: undefined reference to 
    `utCalloc'
    collect2: error: ld returned 1 exit status
    make: *** [untitled] Error 1
    14:50:27: The process "/usr/bin/make" exited with code 2.
    Error while building/deploying project untitled (kit: Desktop Qt 5.5.0 GCC 64bit)
    When executing step "Make"
    14:50:27: Elapsed time: 00:00.
    

    Everything that i found in google couldn't help, can somebody help me i've got really no idea what to do...


  • Moderators

    The warning messages seem pretty clear - you need to add -L and -l paths to libut.so, libmx.so, libmat.so, boost, etc. Or install them in your system.



  • @sierdzio Thank you for answer. I have already try that, but i can't add 'libboost_system.so.1.56.0' library as it does not finish with .so. Any idea?


  • Moderators

    Install it in your system, then:

    sudo apt-get install libboost1.56-dev
    

    In newest Ubutu the lib is actually 1.58, but maybe they are compatible. Once it is installed in the system, you don't need to add it to your LIBS in the .pro file - it will be linked automatically.



  • @sierdzio I have tried to install it, unfortunately it cant be located. I can install the previous version : libboost1.55-dev, but it does not solve the problem. I have already tried upgrade and update before the install. Should i use a newer version of Ubuntu? My current version is 14.04.


  • Moderators

    Try here, then: http://packages.ubuntu.com/wily/amd64/libboost1.58-all-dev/download

    Or compile boost from source.



  • @sierdzio Im having a lot of problems to install it because of the dependencies with other libraries


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.