Execute program issue on different os



  • Hi, I'm using qt5.5 on my QT.
    I using this commend to get the execute program.

    qmake work.pro
    make
    

    And when i execute the program on my QT, It works perfect.
    But when i execute the program on debian, it will show this errors.

    ./producttestingtool_qt5: symbol lookup error: ./producttestingtool_qt5: undefined symbol: _ZN6QDebugD1Ev
    

    I had installed this on my Debian already.

    apt-get install qt5-default
    apt-get install libqt5serialport5-dev
    

    But it still shows errors.
    How can i fix this problem?

    Please help!


  • Moderators

    @victor-wang Your description is not clear: you build on your PC and then copy it to another PC with Debian and try to execute it there?





  • @jsulm

    Yes, and it will show the error out.
    And i'm not quite sure why it will happened.

    @J-Hilk
    Sorry, I have look at it.
    But i'm not quite sure what does /path/to/Qt mean?
    And is all this commends doing in the place where i want to execute?



  • @J.Hilk
    I'm not really understand what it means.
    Please help.


  • Moderators

    @victor-wang I geuss Qt version in your Debian machine is different to what you use on the machine where you build. That's why you get this error.
    You can either build your app on Debian.
    Or, as @J-Hilk suggested, deploy your app to your Debian machine. "Deploy" means - create a package containing the app and all needed Qt libraries and plug-ins.
    "But i'm not quite sure what does /path/to/Qt mean?" - well, what could it mean? It is the path to Qt source code.
    But you should skip the "Static linking" part of that description. Read "Creating the Application Package" and do what is described there.



  • @jsulm
    I wish could do it without compiling again.

    For the document:
    The project mean the working project or the whole Qt project?
    About the third approach that it suggests.
    I have to make a shell script with my project and execute it on my Debian right?

    I assume that appname is my execution file.
    But I don't know what is "basename $0 | sed s,.sh$,," mean and dirname could be?

    #!/bin/sh
    appname=`basename $0 | sed s,\.sh$,,`
    
    dirname=`dirname $0`
    tmp="${dirname#?}"
    
    if [ "${dirname%$tmp}" != "/" ]; then
    dirname=$PWD/$dirname
    fi
    LD_LIBRARY_PATH=$dirname
    export LD_LIBRARY_PATH
    $dirname/$appname "$@"
    

    Please help!


  • Moderators

    @victor-wang It means your project.
    You don't need to change anything in the script. You only need to give it the same name as your app + ".sh" extension: MY_APP_NAME.sh
    The script alone is not enough: you need to have Qt libs used by your app and Qt plug-in in the package as well (described on that site). Please read the description carefully and do it as described there.



  • @jsulm
    Is this what it means?
    I got a cross_execute file that i named myself.
    Inside the file are producttestingtool_qt5 which is my executable file and a producttestingtool_qt5.sh which i just copy the content of what it said in the document inside the shell script.

    Here is the picture

    If it is right what else do i need to add?
    Like what it said about the plugins, is that mean if i execute the producttestingtool_qt5.sh then will automatically get the .so file?



  • @jsulm
    Sorry, i have to fix it.
    I think it mean like this
    Here is the component

    It has to be my whole Project and have the execution file in the project.

    And this is what inside the shell script.
    shell script


  • Moderators

    @victor-wang said in Execute program issue on different os:

    If it is right what else do i need to add?

    You need to read the description.
    Executing the shell script will not magically copy any libraries - this shell script is meant to be used to START your app. YOU need to copy the libs and plug-ins. Please read the description! There is even an example showing what must be where.
    Your executable must be in the SAME directory as the shell script, not in a subdirectory!



  • @jsulm
    I see so i need to add lib and plugins too.

    "Either you have to manually copy the plugins into the plugins directory, or you can set the DESTDIR in the plugins' project files:"

    I assume that it means i have to find the /plugandpaint/plugins and copy it into the same directly with my shell script right?

    document

    And there are .so file and platform which is inside the plugins right?


  • Moderators

    @victor-wang plugandpaint is just an example app!
    Plug-ins are in qt/5.8/gcc_64/plugins (or somewhere else, depends on how you installed Qt).
    Yes you need to copy plug-ins which are used by your app.
    Libs are in qt/5.8/gcc_64/lib, copy those which are needed by your app.
    You can do

    ldd YOUR_APP
    

    in a terminal to find out which libs are needed.


  • Lifetime Qt Champion

    Hi,

    Take a look at the linuxdeployqt tool. It should make your life easier.


Log in to reply
 

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