Sample Header Ad - 728x90

-bash: ./ex1: cannot execute binary file: Exec format error (on Ubuntu installed through Windows 10 app store, 64 bit)

2 votes
1 answer
2715 views
I am trying to start out with some assembly but I run into this error from the outset. Here are the details: I've written the file myself (following a video) so its not some import: global _start _start: mov eax, 1 mov ebx, 42 int 0x80 Pretty basic. I assemble and link it ( nasm -f elf32 ex1.asm -o ex1.o followed by ld -m elf_i386 ex1.o -o ex1 checking the exit status at each stage with echo $?). It assembles and links fine. File gives: ex1: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, not stripped My processor is a 64-bit AMD Ryzen 3 2200G, and my Win10 host and Ubuntu are also 64 bit (from what I've read running a 32 bit binary in a 64 bit environment is fine, right?). I have read many posts and they either discuss trying to run 64 on a 32, or corrupt imports or arch incompatibility (e.g. assembled for ARM) or more complex issues. This here is quite straight forward and for all intents and purposes it should simply run. However when I try it I get -bash: ./ex1: cannot execute binary file: Exec format error This is on Ubuntu installed through Windows 10 app store, 64 bit. Any suggestions?
Asked by x iLeon (39 rep)
May 31, 2020, 12:10 PM
Last activity: May 23, 2021, 01:03 AM