My server is a Amazon Linux AMI 64bits ( 2014.09-release-notes )
I compiled a program coded in C++ ( gcc48-c++.x86_64 is installed) :
[root@ip-***-**-**-*** waveform_generator]# make
Compiled [src/main.cpp] >> [src/main.o]
Compiled [src/File.cpp] >> [src/File.o]
Compiled [src/AGenerator.cpp] >> [src/AGenerator.o]
Compiled [src/GeneratorSVG.cpp] >> [src/GeneratorSVG.o]
Compiled [src/GeneratorCanvas.cpp] >> [src/GeneratorCanvas.o]
Compiled [src/GeneratorPNG.cpp] >> [src/GeneratorPNG.o]
Compiled [src/Header.cpp] >> [src/Header.o]
Compiled [src/pngwriter.cpp] >> [src/pngwriter.o]
Built [wfgen]
Now when I execute the compiled file "wfgen" the console return this message :
[root@ip-***-**-**-*** waveform_generator]# bash wfgen
wfgen: wfgen: cannot execute binary file
Environment :
[root@ip-***-**-**-*** waveform_generator]# uname -i
x86_64
[root@ip-***-**-**-*** waveform_generator]# file wfgen
wfgen: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, BuildID[sha1]=2e7c881c6fc10f12cdf49402edae1cc36b8d77a0, not stripped
Do you have a solution to my problem?
Thank you a lot :)
Max.
When you type
[root@ip-***-**-**-*** waveform_generator]# bash wfgen
I think bash expects wfgen to be a shell script. Instead you could directly type the program name at th e prompt
[root@ip-***-**-**-*** waveform_generator]#./wfgen
It looks like the compiling went fine, the output of the file
command looks good. I don't know what's in the Makefile, but guess it'll be fine, too.
I don't really know your environment, so I'm taking a bit of a guess here: If everything else went fine, and you still get the cannot execute binary file
error, then it can be because your filesystem is mounted with the noexec
option.
To check if that's the case, run mount
, then determine under which mount point the current directory is, and check if the noexec
mount option is set for this mount point.
If it's indeed the noexec
problem, you have two options:
noexec
option. If you want this to be permanent, don't forget to edit /etc/fstab
. (Note however that noexec
might be there for a reason. Make sure it's ok to remove it.) noexec
restriction and try from there. A good place would be the /usr/local/bin
directory (or /usr/local/sbin
, if it's an administrative tool.)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.