I’m trying to run an executable from the command line using ./arm-mingw32ce-g++ on Ubuntu 10.10, but I get the error: bash: ./arm-mingw32ce-g++: No such file or directory Even running with sudo (sudo ./arm-mingw32ce-g++) results in: sudo: unable to execute ./arm-mingw32ce-g++: No such file or directory However, ls -l confirms the file exists and has executable permissions. Why does the OS say the file doesn’t exist when it’s clearly there? What could be causing this issue?
I’ve been dealing with cross-platform builds for a while now, and this “no such file or directory” error got me once despite the file being right there. Turned out the executable was built for a different architecture. I ran file ./arm-mingw32ce-g++
and saw it was compiled for ARM, but my machine was x86_64. So, even though the file technically existed, my system couldn’t execute it because it lacked the proper interpreter for that architecture. That mismatch triggered the misleading error.
Yeah, I’ve seen that too, and building on what @prynka.chatterjee said, in my case, the “no such file or directory” issue came from missing shared libraries rather than architecture. I used ldd ./arm-mingw32ce-g++
and noticed a few not found
entries. The executable had runtime dependencies that weren’t installed on my system. So even though the binary was present and had the right architecture, it still refused to run because the system couldn’t load its dependencies, same error, different root cause.
Adding to both your points, I’ve done a fair bit of debugging weird Linux issues over the years, and another reason I’ve hit the “no such file or directory” error is due to incorrect line endings or broken shebangs after moving scripts between Windows and Linux. I once had a script that looked fine, but file ./arm-mingw32ce-g++
showed it referenced /lib/ld-linux.so.3
, an interpreter missing from my older Ubuntu setup. So even though everything seemed in place, the system failed at the interpreter level and threw that same confusing error.