# compile a linux app on FreeBSD



## Beeblebrox (Dec 7, 2011)

I'm trying to compile a linux app from source, so I chrooted into /usr/compat/linux.  When I try to run [cmd=]# make[/cmd] I get an error, I assume because I don't have the dependent packages installed in the linux compat layer (just the base package).  

```
sh: make: command not found
```

In order to compile the linux app should I install the missing fedora packages or is there an easier way to get the linux layer to reference the already installed ports on the FreeBSD? Or better yet, can you cross-compile as a linux pkg without chroot?


----------



## SirDice (Dec 8, 2011)

Do you want a Linux package at the end or are you trying to run that application on FreeBSD?

If it's the latter I'd try and compile it using the FreeBSD native tools.


----------



## Beeblebrox (Dec 8, 2011)

I'm trying to run the app on my FreeBSD system and I'm making some headway on the issue of native compile.
Also getting help from the app's site, but several modifications are needed:
1. Use gmake instead of make. Had to modify some lines in the app's Makefile.
2. Need a simple method to re-direct / alias malloc.h to stdlib.h, since

```
<malloc.h> has been replaced by <stdlib.h>
```


----------



## SirDice (Dec 8, 2011)

If you're trying to create a FreeBSD native application I'd suggest reading up on creating a port. 
The ports system contains all sorts of handy features.

Porter's Handbook


----------



## Beeblebrox (Nov 22, 2012)

*MASTER_SITES for cloned git*

I want to add a new port to my "locally maintained" collection. Source files will be cloned using git into a git folder on the system (and not a tar.gz file).

How do I set MASTER_SITES in the port's Makefile to a local folder path? Something like this?

```
MASTER_SITES=file//path/to/folder
```

Also, is there any way version information on the git clone can be automatically passed to the Makefile?


----------

