c++ - Qt deployment error on linux -
i tried deploy test qt program on ubuntu following http://doc.qt.io/qt-5/linux-deployment.html. when run program on ubuntu machine (without qt). keep give error: segmentation fault (core dumped). tried both staticly , dynamicly complied, give me error. test code simple , show small window.
#include<iostream> #include<qapplication> #include<qmainwindow> using namespace std; int main(int argc, char** argv){ qapplication app(argc,argv); qmainwindow *win=new qmainwindow(); win->show(); return app.exec(); }
the .pro file
template = app target = test qt += widgets includepath += . # input sources += main.cpp
after static qmake complie comand:
$/usr/local/qt5.8.0/5.8/src/qtbase/bin/qmake -config release $make
i got test program.
i tried copy related library shell script:
#!/bin/sh exe="test" des="." deplist=$(ldd $exe | awk '{if (match($3,"/")){ printf("%s "),$3 } }') cp $deplist $des
and got many related library files like: libc.so.6 libfontconfig.so.1 libicudata.so.55 libnvidia-tls.so.340.102 libstdc++.so.6 libxau.so.6 libxcb-sync.so.1 , on.
then set run-program script test.sh
#!/bin/sh appname=`basename $0 | sed s,\.sh$,,` dirname=`dirname $0` tmp="${dirname#?}" if [ "${dirname%$tmp}" != "/" ]; dirname=$pwd/$dirname fi ld_library_path=$dirname export ld_library_path $dirname/$appname "$@"
when running script test.sh, successful on ubuntu qt machine. when copy script , library files , run on no qt ubuntu machine, give me "segmentation fault"
i dont know causes problem. is library files libc.so.6 or other steps missed. appreciate help.
Comments
Post a Comment