# Linux program in FreeBSD



## AlexF (Mar 24, 2010)

Trying to run my program in FreeBSD OS, I have the following results:


```
$ ./myprogram

ELF binary type "0" not known

./myprogram: 1: Syntax error: "&" unexpected (expecting ")")

$ file myprogram

myprogram: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), 

dynamically linked (uses shared libs), for GNU/Linux 2.6.15, 

not stripped
```

The program is built in GCC on Ubuntu computer. What can I do? Can I build the program for FreeBSD on my Ubuntu computer by changing some build options, or I need to build it in FreeBSD OS? Maybe there is some way to convert executable to format recognized by FreeBSD?


----------



## graudeejs (Mar 24, 2010)

If it's build on ubuntu, it's linked with Ubuntu libraries.
ELF executables also are different (in header)

you need to recompile your app on FreeBSD if you want to use it.


There is no way to convert it to FreeBSD, it's impossible.
What you could try is to run it in FreeBSD using Linux Emulation.... (but I have never used it, so I don't know the details.) It still may not run, because FreeBSD doesn't offer Ubuntu as Linux Emulation, but some other distro...

Best you can do is recompile it


----------



## rambetter (Mar 25, 2010)

A lot of precompiled Linux apps run just fine on FreeBSD, after you install linux emulation.  See here:

http://www.freebsd.org/doc/handbook/linuxemu-lbc-install.html

But of course the best way to run you app is to just compile it on FreeBSD.


----------

