Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt Project & Matlab Engine (Linux 64 bits)



  • Hi everyone,

    I'm trying to use Matlab Engine (Matlab R2013a) in a Qt Project (Qt 5.2.0, GCC 4.6.1, 64 bit). My GCC version is 4.7.3 and Matlab documents says compatible with 4.4.X, but i read about this and looks like it's compatible. I found many solutions for Windows but any one clear enought for Linux 64 bits. I set the run-time library path in the Qt build environment:

    LD_LIBRARY_PATH=matlabroot/bin/glnxa64:matlabroot/sys/os/glnxa64

    I tried to add also the shared libraries: libmat.so, libmx.so and libeng.so but i'm not sure if it is well done.

    This is my .pro file:

    @QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = ahrs_libusb
    TEMPLATE = app

    SOURCES += main.cpp
    ahrs.cpp

    HEADERS += ahrs.h

    FORMS += ahrs.ui

    LIBS += -lusb
    unix:LIBS += -lusb

    LIBS += -L /usr/local/MATLAB/R2013a/bin/glnxa64/
    /usr/local/MATLAB/R2013a/bin/glnxa64/libmat.so
    /usr/local/MATLAB/R2013a/bin/glnxa64/libmx.so
    /usr/local/MATLAB/R2013a/bin/glnxa64/libeng.so

    INCLUDEPATH += /usr/local/MATLAB/R2013a/extern/include@

    And this is the test when create the form:

    @Engine * ep = engOpen (NULL);
    if (!ep)
    {
        ui->qTEstatus->append("Can start Matlab engine!");
    }@
    

    Actually i compile and i get these two errors:

    /usr/local/MATLAB/R2013a/sys/os/glnxa64/libstdc++.so.6:-1: error: version `GLIBCXX_3.4.15' not found (required by /usr/lib/x86_64-linux-gnu/libppl_c.so.4)

    and

    /usr/local/MATLAB/R2013a/sys/os/glnxa64/libstdc++.so.6:-1: error: version `GLIBCXX_3.4.15' not found (required by /usr/lib/x86_64-linux-gnu/libppl.so.12)

    I spend much time but without any solution...

    Thanks,
    Andrew.



  • Hi again,

    Finally, I found an easy way to solve the problem by linking the correct library file with the MATLAB firstly searched old library file, i.e.,

    sudo ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.17 /usr/local/MATLAB/R2013a/bin/glnxa64/libstdc++.so.6

    Now the program compile but the Matlab Engine doesn't run because the function: engOpen(NULL) returns 0x00

    Any idea??



  • Can you guide me linking matlab's engine.h to qt?

    I have 64bit versions of both ubuntu(12.04) and qt(5.2.1)

    I'm able to compile the code with engine.h included in the program but I get the following error:
    MATLAB: Command not found

    Any ideas?

    my .pro file is:
    @TEMPLATE = app
    CONFIG += console
    CONFIG -= app_bundle
    CONFIG -= qt
    INCLUDEPATH += "/usr/local/MATLAB/MATLAB_Production_Server/R2013a/extern/include"

    LIBS += -llapack -lblas -larmadillo -L"/usr/local/MATLAB/MATLAB_Production_Server/R2013a/bin/glnxa64" -leng -lmat -lmex -lmx -Wl,-rpath=/usr/local/MATLAB/MATLAB_Production_Server/R2013a/bin/glnxa64

    SOURCES += main.cpp@

    and using a simple program to test the connectivity.

    I have define the PATH variable. But I'm doubtful about the way I have defined LD_LIBRARY_PATH

    Can you please elaborate how you were able to link matlab to qt?

    Thanks,
    Pranav


Log in to reply