Why am I getting a zsh: exec format error? - zsh

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

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

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...

It happened to me when I emptied an executable by mistake.
~>true > a
~>wc -c a
0 a
~>./a
zsh: exec format error: ./a

Related

How do I compile bitcoin core to be more portable?

Background: I compile bitcoind on one system but run it on another. When I compiled bitcoind 0.19.1 some time back using the following method, I was able to run bitcoind and bitcoin-cli on the target system without issue. I think.
./autogen.sh
./configure --disable-wallet --disable-tests --disable-bench --disable-gui --enable-util-tx=no --prefix=$HOME/bitcoind/x64 --exec-prefix=$HOME/bitcoind/x64
make && make install
Today I compiled v0.20.0 using the same method. If I run ./bitcoind -version on the system I compiled the binary it runs fine, but if I take the binary to my target system I get the following error:
./bitcoind: error while loading shared libraries: libboost_filesystem.so.1.67.0: cannot open shared object file: No such file or directory
The binary seemed to be portable last time, and the pre-compiled binary I download from the Bitcoin Core team runs fine.
Note that on the target system libboost-filesystem-dev and libboost-filesystem1.67-dev are not installed, this is likely the source of my error. That said, running the pre-compiled binary from the Core team runs, so why doesn't mine?
Can someone help me understand if I did something wrong or if I need to add ./configure flags to make the binary more portable? Specifically what I likely did differently than the core developers that made my binary fail where theirs worked?
EDIT 1: Running ./configure --enable-static or ./configure LDFLAGS=-static does not result in a portable binary either.
Also note that installing libboost-filesystem library with apt does fix the error.
Thanks to Andrew Chow for his helpful answer to this on the bitcoind StackExchange. I needed to build the depends as per the depends documentation. Since I'm building for the same platform I'll be running on, I can run make in the depends directory with no arguments except -j2 which uses two cores. Change the number to however many cores you want to commit to the compile.
cd depends
make -j2
cd ..
./autogen.sh
./configure --prefix=$PWD/depends/x86_64-pc-linux-gnu
make -j2 && make install

How to install ADA IDE and compiler on mac (OSX)?

I downloaded GNAT ADA GPL 2014 and now trying to install on my Mac.
The directions below are the ones I am following, but I do not know where to look to find the file called doinstall. I might still need some help after finding it, but can anyone help me out here?
Navigate to the directory that contains a file called: doinstall
Enter: sudo mkdir /usr/local/gnat
Enter: sudo ./doinstall
Update your path as needed for your shell
You should have downloaded gnat-gpl-2014-x86_64-darwin-bin.tar.gz.
Go to some temporary directory (I use ~/tmp):
cd ~/tmp
Unpack the download, which creates a directory gnat-gpl-2014-x86_64-darwin-bin containing the binary distribution to be installed:
tar zxvf ~/Downloads/gnat-gpl-2014-x86_64-darwin-bin.tar.gz
Enter that directory, which contains (amongst others) doinstall:
cd gnat-gpl-2014-x86_64-darwin-bin
Execute doinstall to enter the installation dialog:
sudo ./doinstall
Remove the unpacked download:
cd ..
rm -rf gnat-gpl-2014-x86_64-darwin-bin
Now you can update PATH as needed for your shell.
What Simon Wright said is correct, but if you're running on Yosemite there's an extra problem: for some obscure reason, Adacore GNAT is broken on Yosemite. You have to make it think it's compiling for Mavericks:
export MACOSX_DEPLOYMENT_TARGET=10.9 # Yosemite workaround
That can go in a few different places, but I put it near the top of the /usr/local/gnat/bin/gps script so it doesn't interfere with the xcodebuild environment.
Also, I found GTKAda to be nearly impossible to install from source; if you download the XNAdaLib-GPL package from http://sourceforge.net/projects/gnuada/ you can install that and get everything you need without having to wade through Adacore's mess. (You may want to use the Adacore version of Glade for GUI design though; for some reason the Sourceforge package's version is localized in French and I'm not sure if it can be switched to English.)
Finally, since this is a bit duct-tape-and-baling-wire, I would recommend not shipping any production mission-critical code with this environment; either roll back to Mavericks or wait for GNAT 2015.

install danish dictionary in emacs on windows

I haven't been able to find the help I need on (on dummie level) for installing a new dictionary (danish) in emacs. To be honest I somewhat confused about ispell vs aspell. When typing "M-x ispell-buffer" a spelling control starts using english as default. I can change directory typing "M-x-ispell-change-dictionary" it suggest "dansk" but I get an error saying that the file /.../aspell/dict/danish" can not be opened for reading. I can deduct that the dictionary is not installed - but I cannot seem to finde a guide (step by step) on how to do this.
And then I have a bonus question. I have managed to install flyspell (or is that actually 'installing' as I have just addet the .el file to my emacs load path and loaded in my .emacs file?). This seem to work (wauw), and as I understand it flyspell is using the same dictionaries as ispell/aspell hence solving my probleme above would enable me to use flyspell in danish?
Any help is appreciated.
/Kira
If you are on Ubuntu or Debian system you can install the Danish aspell package from the commandline with
sudo apt-get install aspell-da

How do I initialize LLVM's external symbolizer?

When compiling with -fsanitize=memory I get WARNING: Trying to symbolize code, but external symbolizer is not initialized! when running the program. How do I initialize the external symbolizer?
I solved my own problem using MSAN_SYMBOLIZER_PATH=$(which llvm-symbolizer-3.4) ./a.out. The problem is that Ubuntu postfixes the version number but the binary doesn't know that. Of course you need to use MSAN instead of ASAN when using the memory sanitizer.
You are supposed to be able to set the ASAN_FILTER environment variable to point at a symbolizer, but I could not get it to work. However, you can redirect stderr into a symbolizer after the fact. You'll still get the warnings about the uninitialized symbolizer, but the filenames and line numbers will be correct.
You can use asan_symbolizer.py as the external symbolizer. After downloading it from that link (to /tmp, for example), invoke your program like so (in bash, for this example):
./myprogram 2>&1 | /tmp/asan_symbolize.py | c++filt
On my Ubuntu system, the issue is that LLVM's tools are installed under /usr/bin with version suffixes (like llvm-symbolizer-4.0), and the sanitizer tools are looking for them without version suffixes.
LLVM also installs its binaries to, e.g., /usr/lib/llvm-4.0/bin; the tools under /usr/bin are actually just symlinks. So an easy solution is to add the appropriate /usr/lib/llvm-*/bin directory to your path when working with sanitizers.
I received such warning when I run program debug version (compiled with -fsanitize=address) on Linux machine that didn't contain clang installation. The problem disappeared after I installed clang from devtoolset.

Cygwin error message -- binary file not executable

So I am trying to install a program on my windows machine that required me to install Cygwin to install it. So I am working from a README file and assueme I have compiled the code previously correctly (its one line sh build.sh) and when actually trying to use the program I get the following error:
BabakP#Babak /cygdrive/c/Users/BabakP/Desktop/test
$ ./Runlock input.tst output.tst 1
./Ostrich: Exec format error. Binary file not executable.
I guess I am trying to figure out why I am getting this error so any suggestions on how to troubleshoot it would be great!
./Ostrich is a Mac executable. It can't be executed under Cygwin. (A MacOS emulator that runs under Windows or Cygwin is theoretically possible, but I don't know of any such thing.)
Without knowing the details of the software you're trying to install, it's hard to say how or whether you can fix it.
You may be able to rebuild Ostrich from source (if you have the source, and if it's not MacOS-specfic).

Resources