can FreeBSD cross compile? can compat/linux cross compile?

Summary of questions:

1) does FreeBSD really cross compile y/n (not from 64->32, from 32->64 when booted in 32 which is harder)

2) how was compat/linux made is it a binary centos blob or from scratch by freebsd completely ? (i can't find src)

3) is FreeBSD running Qt5 ?

I recently tried to upgrade a 32bit to 64bit using GCC, got build fails everywhere (mostly glibc which is in the end needed). I was kinda researching why so many wanted to do it (in late 1990's) and RH told people "we're not telling you how" (and microsoft code began appearing in linux compiler chains). I stop there because it's other-OS issue.

So question is: can FreeBSD do it? NOT cross from 64->32 (too easy). I mean cross from 32->64 when all tools support only 32? (this is more difficult if you didn't know). Put another way, can freebsd cross to Android|ARM so that freebsd's compiler and libc survive to be able to compile as a cross compiler on the ARM (targeting Android using SDK does not provide Android with a compiler if I am correct.), or to 128 from tools now supporting 64 as build/host? I'm not asking how: i'm asking the simplest question if you believe FreeBSD can do it or don't know for dang sure. I hear about clang but clang's ld is a work in progress, license are still "up in air not published" (been that way 10 yr now?). i'm unsure clang can do 32->64 with product compiler+libc on the 64 target. It's not easy to do especially if your compiler+libs are full of asm hacks unwind and such.

Next question. I want to run Mathematica it requires Qt5. Is FreeBSD an ok choice for this can it run Qt5? (i'm unsure if that's a /compat/linux question or not frankly). True MM would run in compat/linux but again I ask: FreeBSD (at least until recent) had used GCC. (i may give up on MM - they are deep in the microsoft Qt5 ring: and i'm suspcious of gcc glibc gnu-ld are really open and really work for end users - while freeBSD we know compiles for everyone - maybe not cross but idk - i know they hope clang will save them from having to upgrade BSD4.3 to work ? :)

How is compat/linux built? I'm hoping FreeBSD built the centos and I can find the source used - right now as far as I can see "it's a binary blob and FreeBSD kernel is hacked to answer calls to that binary blob" (like old sun lx-run). I've looked in ports I can't find any evidence that FreeBSD developed compiled compat/linux. That's why I ask. Just want to know if this is "RHEL7" _not_ built from scratch or if actually freebsd people did compile /compat/linux from scratch.
 
  1. Yes. You can build FreeBSD for ARM64 for example on an AMD64, or various other combinations.
  2. It's a kernel module (sys/compat/linux), it only "emulates" the Linux kernel, the "base" OS, i.e. libraries, userland, etc (emulators/linux_base-c7 for example) are indeed the binaries from CentOS.
  3. You mean, does QT5 run on FreeBSD? devel/qt5 (KDE 5 is based on QT5, so that works)

I recently tried to upgrade a 32bit to 64bit using GCC
It's possible to 'upgrade' a 32 bit FreeBSD to 64 bit but it's not a supported upgrade path. You are advised to do a reinstall.

I want to run Mathematica it requires Qt5. Is FreeBSD an ok choice for this can it run Qt5? (i'm unsure if that's a /compat/linux question or not frankly). True MM would run in compat/linux
As far as I know Mathematica is a closed source Linux binary. So it assumes you have a Linux libraries and such. That's what the /compat/linux directory structure is for, to make it appear to the application it's running on a CentOS Linux.

How is compat/linux built? I'm hoping FreeBSD built the centos and I can find the source used - right now as far as I can see "it's a binary blob and FreeBSD kernel is hacked to answer calls to that binary blob" (like old sun lx-run). I've looked in ports I can't find any evidence that FreeBSD developed compiled compat/linux. That's why I ask. Just want to know if this is "RHEL7" _not_ built from scratch or if actually freebsd people did compile /compat/linux from scratch.
You need to realize the difference between the kernel and the rest of the userland. The FreeBSD kernel has an ABI layer that translates Linux kernel ABI calls to FreeBSD equivalents, that's what linux(4) does. On top of that kernel you have a bunch of libraries and userland tools, those come directly from CentOS.
 
NOT cross from 64->32 (too easy). I mean cross from 32->64 when all tools support only 32? (this is more difficult if you didn't know)
It isn't actually any more difficult. At the end of the day it is just writing a file (which will later be executed on another PC). It isn't like it needs to actually run anything belonging to the different architecture.

You can even cross compile to a different architecture entirely. I know Cambridge university is looking at some interesting stuff involving the CHERI (128bit) platform with FreeBSD (https://www.cl.cam.ac.uk/research/security/ctsrd/cheri/cheribsd.html).

You could also consider playing around with qemu-static and running just binaries for a different platform in a FreeBSD jail. For compiling to armv7 / aarch64 I find this much easier than even cross compiling because you don't need to set up system directories for the different platforms.
 
Back
Top