Solved Cross Compiling for Linux in FreeBSD

Hello and sorry if this question is already answered anywhere, I didn't found it.

I run FreeBSD on my desktop but I have some friends who run Windows and Linux. I can cross compile for Windows easily using mingw32-gcc, but for Linux I'm using the cloud9 Ubuntu machine to compile my code, but the access is very limited and a few bugs occur, if there's a way to compile this code to Linux ELF in my FreeBSD it would be great (mainly for debugging), but I did not found nothing about this in forums and there's no linux-(c6 or f10)-gcc or -clang... Thanks in advance
Welcome to the forums :) Whilst I'm sure it is possible to cross-compile for GNU/Linux on a FreeBSD box, I also suspect it might take you a while to get it working. As an alternative method to achieve your goal you could run a GNU/Linux virtual machine on your FreeBSD box using bhyve, VirtualBox or emulators/qemu and compile natively within that environment.
Quick search at did not reveal any cross compilers for Linux. It is technically possible to build such a cross-compiler using for example the GCC version 5 but that would be just a beginning and the easiest part for building a cross-compilation environment. You would also need proper headers and libraries (from the distro of your choice naturally, there's not just one Linux you can target!) for Linux and setting up those would be lots of work.

Some people have been successful in setting up a Linux jail on their FreeBSD system and at least in theory that could be used for producing Linux executables.
They used to exists though, but I can't seem to find them any more. Even in the 'deleted' list. It was something like linux_base-f4-devel or something like it.
This package name suggests those are/were not cross compilers but repackaged native linux compilers.
Not directly related, but I maintain two FreeBSD => Android cross-compilers in ports:
  • lang/gnatdroid-armv7
  • lang/gnatdroid-x86
Technically those are FreeBSD/DragonFly to Linux cross-compilers, but not the right flavor of linux. :)