# Cannot execute binary file



## notooth (Oct 5, 2019)

Hello,

I got an error when executing a binary file on FreeBSD 12. Can anyone help?

```
$ ./linux.run
ELF binary type "3" not known.
-bash: ./linux.run: cannot execute binary file: Exec format error

$ file linux.run
linux.run: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, stripped

$ uname -m
amd64
```


----------



## yuripv (Oct 5, 2019)

Please check https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/linuxemu.html.


----------



## notooth (Oct 5, 2019)

Thank you for the link.

I followed the instruction and got an error. Can you help?

```
$ ./linux

libXext.so.6: cannot open shared object file: No such file or directory


$ locate libXext.so.6

/usr/local/lib/libXext.so.6

/usr/local/lib/libXext.so.6.4.0


$ sudo cp /usr/local/lib/libXext.so.6.4.0 /compat/linux/usr/lib64

$ sudo ln -s /compat/linux/usr/lib64/libXext.so.6.4.0 /compat/linux/usr/lib64/libXext.so.6


$ ./linux

libXext.so.6: ELF file OS ABI invalid
```


----------



## shkhln (Oct 5, 2019)

notooth said:


> $ sudo cp /usr/local/lib/libXext.so.6.4.0 /compat/linux/usr/lib64


----------



## shkhln (Oct 5, 2019)

notooth, what application are you trying to run?


----------



## D-FENS (Oct 5, 2019)

What does this ./linux do? Give us some more details about the program you are trying to execute.
It obviously needs some shared object but the last error message means that the binary format does not match. This is usually the case when there is a mismatch - an executable uses a library and they do not match binarily because they have not been compiled against each other (for example, with different compiler options like calling convention or int size). If you provide more details about your application it would be easier to track down what's happening.


----------



## notooth (Oct 5, 2019)

It's Xilinx Vivado.


----------



## D-FENS (Oct 5, 2019)

There is a Wiki page for that: https://wiki.freebsd.org/FreeBSD_Xilinx
Did you follow these instructions first?
They complain they could not make the Vivado work because of Java segmentation faults but it was > 1 year ago, maybe it works now.


----------



## shkhln (Oct 5, 2019)

roccobaroccoSC said:


> They complain they could not make the Vivado work because of Java segmentation faults but it was > 1 year ago, maybe it works now.



That page mentions linux_base-f10-10_2, so it's obviously compiled from much older material.


----------



## shkhln (Oct 5, 2019)

From https://wiki.freebsd.org/FreeBSD_Xilinx#line-326:


> Starting from 9.2i Alpha release, Xilinx ISE brings native userspace, libusb-based driver for their cables.
> 
> _it has been proven to be possible to get it to work in FreeBSD 9-CURRENT. We simply compile our libusb on Linux and install it in the Linuxolator. It had to be modified to use our ioctl() commands, but conflict within command space exists. There's an ongoing work related with investigating, what's the best way to bring support for Linux USB in the FreeBSD_



Must be linux_libusb. I should try that with my Steam Controller…


----------



## shkhln (Oct 5, 2019)

By the way:

```
% pkg which /compat/linux/usr/lib64/libXext.so.6.4.0
/compat/linux/usr/lib64/libXext.so.6.4.0 was installed by package linux-c7-xorg-libs-7.7_6
```


----------



## notooth (Oct 6, 2019)

shkhln: Thanks for the tip. I finally made it work after installing linux-c7-xorg-libs.


----------

