User forums > Help
'No such file or directory' error running in terminal
oBFusCATed:
Why do you think cb is generating ./name and not ./debug/name or ./release/name?
If you inspect the build log or your project settings you'll see where the executable is generated.
markpotts:
CB generate the executable in bin/Release (or bin/Debug). This is where it runs (correctly) from within the IDE. Running the same executable outside the IDE fails. Building via gcc from the command line generates an executable wherever specified (-o). This executable runs correctly.
Following is a log of the different behaviors:
in Code::Blocks
-------------- Clean: Release in Barcode (compiler: GNU GCC Compiler)---------------
Cleaned "Barcode - Release"
-------------- Build: Release in Barcode (compiler: GNU GCC Compiler)---------------
g++ -Wall -fexceptions -O2 -c /home/user/Source/Barcode/Barcode.cpp -o obj/Release/Barcode.o
g++ -o bin/Release/Barcode obj/Release/Barcode.o -s -lpthread
Output file is bin/Release/Barcode with size 22.58 KB
Process terminated with status 0 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
-------------- Run: Release in Barcode (compiler: GNU GCC Compiler)---------------
Checking for existence: /home/user/Source/Barcode/bin/Release/Barcode
Executing: xterm -T Barcode -e /app/bin/cb_console_runner LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. /home/user/Source/Barcode/bin/Release/Barcode (in /home/user/Source/Barcode/.)
this works ...
Barcode [Nov 11 2020, 11:58:37]
then in terminal
~/Source/Barcode$ ls bin/Release
Barcode
~/Source/Barcode$ bin/Release/Barcode
this fails ...
bash: bin/Release/Barcode: No such file or directory
recompile with gcc
~/Source/Barcode$ gcc Barcode.cpp -lpthread -o Barcode
~/Source/Barcode$ ./Barcode
this works ...
Barcode [Nov 11 2020, 12:13:24]
stahta01:
Please change the current directory to the folder with the executable in it.
This will then be a real comparison instead of one where your OS can be the cause of the problem; because what you posted says the OS is the reason it is failing.
Tim S.
markpotts:
~/Source/Barcode/bin/Release$ ls -l
total 24
-rwxr-xr-x 1 user user 23120 Nov 11 11:58 Barcode
~/Source/Barcode/bin/Release$ ./Barcode
bash: ./Barcode: No such file or directory
This is under a new install of Ubuntu 20.04 with Code::Blocks 17.12. I have previously compiled a range of custom programs for an IoT product using earlier versions of Ubuntu/CB without any problem. I was recently forced to upgrade the Linux/CB versions due to hardware support issues which was when this issue emerged. If necessary I can recompile everything using gcc from the command line but I would prefer to build using the CB IDE.
I noticed that CB uses a complex command to execute the program but I am not sure what this implies:
Executing: xterm -T Barcode -e /app/bin/cb_console_runner LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. /home/user/Source/Barcode/bin/Release/Barcode (in /home/user/Source/Barcode/.)
oBFusCATed:
This is really odd.
Are there any messages in dmesg for this event?
Do you have some protection system running (apparmor, selinux, etc)?
What happens if you use "file" or "objdump -d" on the file? ldd on the file?
Generally you want to pass -pthread to both compilation and linking, but I doubt this would change anything.
The execution in cb is complex, because it has to start a terminal, make sure it pauses after the executable ends and if there are libraries in non-default places they are found.
Generally the last thing surprises people the most, but you're not linking to any shared library. :shrug:
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version