Error executing program after building in Qt Creator
-
Dear fellow coders, i'm currently using Qt 4.8 qmake (as my Qt 5.7 is not working properly at this juncture) to build my source codes.
After building my source codes in Qt Creator 3.5.0 (i.e. my C source codes for embedded Linux board + simple Qt GUI interface), I set to run the executable program generated in [Release] folder in my Putty terminal. However it was unsuccessful and Putty terminal reported the following error:
/mnt/Working folder/build-vdec_test-HI3536_Qt4_8-Release # ./vdec_test
./vdec_test: error while loading shared libraries: libdnvqe.so: cannot open shared file or directoryI'm able to locate the directory of libdnvqe.so; I've also added this path into /etc/profile LD_LIBRARY_PATH.
Did a reboot of my embedded Linux target in Putty terminal; run my program again but still met with the same problem.
FYI, the missing library PATH is located via my NFS to my guest OS Ubuntu in virtualbox
-
@embdev said in Error executing program after building in Qt Creator:
FYI, the missing library PATH is located via my NFS to my guest OS Ubuntu in virtualbox
Is that library built for x86? If so then it will not work. You need that library built for your target (I guess ARM?).
You can check withfile libdnvqe.so
in the terminal.
-
@jsulm that lib (libdnvqe.so) is for ARMS, that's for my target itself. Since i'm doing development work, i'm accessing my developmental files in my guest OS (Ubuntu). It's strange as I've configure the qmake to be using -static libraries so by right my compiled files shouldn't have dependencies issue?
Details of the missing lib as per above:
aa@aa:~/Hi3536_SDK_V2.0.4.0/mpp_single/lib$ file libdnvqe.so
libdnvqe.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, strippedBut is there a way to temporary link this missing library so that I can at least try out my compiled program in Qt?
-
@jsulm I tried putting the dynamic lib in the same directory as my executable but problem still persists though. I've the static build for this lib as well.
Could it be also qmake not properly configured when compiling the sources? (Qt 4.8 sources)
-
@jsulm I think the Linux 3.10.7 version i'm running on my embedded target is a scaled-down version so it doesn't contain the ldd command. Nonetheless I tried to run ldd (exe file) on my host machine but it says 'not a dynamic executable'. Did some quick search and executed another command to check the dependencies and came out with the following:
It's surprising to see that the file is using shared libraries as I've configured qmake to use static lib during configuration, another thing to note is that all these libraries all reside in the same directory; hence the missing lib 'libdnvqe.so' should also be located by the exe though.
aa@aa:~/Hi3536_SDK_V2.0.4.0/working folder/build-vdec_test-HI3536_Qt4_8-Release$ ldd vdec_test
not a dynamic executable
aa@aa:~/Hi3536_SDK_V2.0.4.0/working folder/build-vdec_test-HI3536_Qt4_8-Release$ readelf -a vdec_test | grep NEEDED
0x00000001 (NEEDED) Shared library: [libdnvqe.so]
0x00000001 (NEEDED) Shared library: [libhdmi.so]
0x00000001 (NEEDED) Shared library: [libmpi.so]
0x00000001 (NEEDED) Shared library: [libjpeg.so]
0x00000001 (NEEDED) Shared library: [libupvqe.so]
0x00000001 (NEEDED) Shared library: [libVoiceEngine.so]
0x00000001 (NEEDED) Shared library: [libdl.so.2]
0x00000001 (NEEDED) Shared library: [librt.so.1]
0x00000001 (NEEDED) Shared library: [libpthread.so.0]
0x00000001 (NEEDED) Shared library: [libstdc++.so.6]
0x00000001 (NEEDED) Shared library: [libm.so.6]
0x00000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x00000001 (NEEDED) Shared library: [libc.so.6]
0x00000001 (NEEDED) Shared library: [ld-linux.so.3] -
@jsulm i managed to get this issue solved by manually copying the libraries into my embedded Linux target before executing the run again and was successful.
However 2 points for discussion here:
- I should have a static executable file (configured qmake to have -static libraries) that i can run stand alone; but it appears that the exe file is using dynamic libraries.
- my PATH could have been defined wrongly in /etc/profile in my embedded target Linux board:
the lib required are stored in
/mpp_single/lib
LD_LIBRARY_PATH="/mnt/v1_QtEmbedded-4.8.6/lib/fonts:/mpp_single/lib:$LD_LIBRARY_PATH"
-
@embdev Many of the shared libraries you mentioned before are basic system libraries which are usually shared. I don't know whether it is easily possible to have them as static ones. But the question is: why do you care? Those libs are always there.
The other libs, like libdnvqe.so or libjpeg.so, are probably coming from Qt configured in a way to use system libraries. At least for some of these libraries it should be possible to tell the configure script to use what Qt provides instead of system libs. -
@jsulm i think those shared lib generally have no issues. the libraries that were missing are actually from my embedded Linux SDK itself i.e.
libnvqe.so, libhdmi.so, libmpi.so, libjpeg.so, libupvqe.so, libVoiceEngine.so
which i also added the static versions of these vendor-provided lib in .pro file itself. -
@embdev You mean in .pro file of your project? It will not help as Qt itself depends on them. For example libjpeg.so is used by Qt to be able to read JPEG images. But as far as I know you can configure Qt to not to use system provided libjpeg but its own version. Check the configure options.