Qt4-Embedded交叉编译ARM7L程序报“No such file or directory”错误求助
Hey there, let’s troubleshoot that "no such file or directory" error you’re hitting with your Qt4 Embedded app on the ARM7L device. I’ve debugged tons of cross-compiling missteps like this, so let’s break down the most likely issues and fixes step by step:
Let’s rule out the simplest stuff first:
- SSH or serial into your target device, then run
ls -l /full/path/to/your/appto check if the file exists. Double-check the path—typos happen all the time! - If the file shows up, make sure it has execute permissions: run
chmod +x /full/path/to/your/appand try launching it again. - Sometimes file transfers get corrupted (especially if you used ASCII mode FTP). Re-send the executable using
scporrsyncto ensure the binary stays intact.
Your cross-compiler is arm-linux-gnueabi, but let’s confirm the output isn’t accidentally targeting x86:
- On your Ubuntu dev machine, run
file your-app-executable. The output should look like:your-app-executable: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.32, ...
- If it says "x86" anywhere, your Qt cross-compile setup is broken. Go back and ensure you’re using the cross-compiled
qmake(e.g., runqmake -spec linux-arm-gnueabi-g++instead of the system default qmake).
More often than not, this error doesn’t mean the app itself is missing—it means one of its dependent libraries isn’t found on the device.
- On your dev machine, list all required libraries with:
You’ll see entries likearm-linux-gnueabi-readelf -d your-app-executable | grep NEEDEDlibQtGui.so.4,libQtCore.so.4, andlibstdc++.so.6. - On the target device, check if these libraries are available with
ldd /full/path/to/your/app. Any line that saysnot foundis your problem. - Fix steps:
- Copy the cross-compiled Qt libraries (from your Qt4-embedded install directory on Ubuntu) to the device’s
/usr/libor/libfolder, or place them in the same directory as your app. - Copy system libraries (like
libstdc++.so.6) from your cross-compiler’s sysroot (usually/usr/arm-linux-gnueabi/lib) to the device’s corresponding library directory. - Before running the app, set the library path:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/your/libs
- Copy the cross-compiled Qt libraries (from your Qt4-embedded install directory on Ubuntu) to the device’s
ARM executables rely on a specific dynamic linker (like /lib/ld-linux-armhf.so.3). If the device doesn’t have this linker at the expected path, it’ll fail to launch.
- Check the linker your app expects on the dev machine:
arm-linux-gnueabi-readelf -l your-app-executable | grep interpreter - On the target device, verify the linker exists:
ls /lib/ld-linux-armhf.so.3(or whatever path the readelf output showed). - If it’s missing, copy the linker from your cross-compiler’s sysroot (e.g.,
/usr/arm-linux-gnueabi/lib/ld-linux-armhf.so.3) to the device’s/libdirectory. - Alternatively, when compiling, specify the correct linker path with a qmake flag: add
-Wl,--dynamic-linker=/path/to/ld-linux.so.3to your project’sLIBSvariable to match the device’s setup.
If the device’s root filesystem is misbehaving, files might seem missing even if they’re there:
- Run
mounton the device to check if/is mounted as read-only. If so, remount it as read-write:mount -o remount,rw / - If your device uses a ramdisk for the root filesystem, any files you copy will disappear on reboot. Make sure you’re copying the app and libraries to non-volatile storage (like an SD card or NAND flash) and updating the boot script to mount that storage correctly.
Qt4 Embedded needs specific runtime flags and plugins to work on embedded devices:
- Try launching the app with the Qt Window System flag:
./your-app -qws—this is mandatory for Qt4 Embedded apps. - Ensure the Qt platform plugin (usually
libqws_linuxfb.so) is present on the device. Place it in aplugins/platformsdirectory next to your app, then set the plugin path:export QT_PLUGIN_PATH=/path/to/your/app/plugins
Start with the first few steps—they’ll cover 90% of cases. Let me know if any of these lead you to the fix!
内容的提问来源于stack exchange,提问作者Joe Joe Ngigí

