Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22031

Why can't I run a C program built on alpine on ubuntu?

$
0
0

I compiled a simple hello world C program inside of an alpine linux container and copied it onto my ubuntu host. To my surprise, I am not able to run the binary on my ubuntu host. Instead, I get the following error when I try to execute the program.

$ /bin/bash ./hello
$ ./hello: ./hello: cannot execute binary file

Why can't I run my program that was compiled on alpine on ubuntu?

UPDATE I made the mistake of trying to run the C program as a bash script. However, after correcting my mistake, I still get an error...

$ ./hello
$ bash: ./hello: No such file or directory

I have made the binary executable, so that should not be the issue. This error message does not show up when running the same program compiled on the host.


Viewing all articles
Browse latest Browse all 22031

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>