Why am I getting a zsh: exec format error?
Asked Answered
zsh
K

5

32

I am trying to run the metal executable from my zsh terminal in order to meta-analyze GWAS data. I have the executable in the correct directory and have checked that it is not 0MB due to truncation.

Reproducible: Download the Linux file from http://csg.sph.umich.edu/abecasis/metal/download/

In terminal:

PATH TO EXECUTABLE ./metal
zsh: exec format error: ./metal
Knut answered 5/11, 2020 at 23:12 Comment(1)
I am having the same error after the last oh-mh-zsh update, but with another execuatable.Killifish
T
42

You probably install wrong OS of go, for example, you might install go for MacOS in Linux

I solve this problem by installing go for correct OS

Edit: also, you may got the right OS but the wrong architecture:

zsh error for architecture mismatch

Trioecious answered 31/3, 2021 at 13:57 Comment(0)
U
1

The executable has been pre-compiled on a certain distribution with libraries at a certain places at certain versions.

If you have a different distribution, libraries versions, it won't work and you better compile from the source.

Basically what you have to do is to download and extract the sources, go in the folder and execute make. (You will have probably to install make first.)

I think that's not your job at all so maybe you can find a geeky person to help you, because you may stumble upon problems, libraries to install, old versions not supported anymore, new versions not supported yet...

Unbodied answered 9/11, 2020 at 15:52 Comment(0)
E
1

In case if it helps anyone, in my case I had an environment variable GOOS=linux and trying to build it on Mac and got this error.

unset GOOS fixed it.

Emptyheaded answered 14/4, 2023 at 21:2 Comment(0)
M
0

It happened to me when I emptied an executable by mistake.

~>true > a
~>wc -c a
0 a
~>./a
zsh: exec format error: ./a
Margalit answered 26/1, 2023 at 13:39 Comment(0)
M
0

I tried setting up Hugo (static site generator) on my machine which has amd64 architecture, but in the release list of its binaries on the GitHub, I mistakenly downloaded the binary compiled against the arm64 and I got the exact same message.

The crux of the message is that such type of errors occur when the platform against which the binary you are trying to execute has been compiled doesn't match yours.

On Debian/Debian, you can run:

dpkg --print-architecture

to find out the architecture of your machine.

Middlebreaker answered 10/12, 2023 at 19:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.