roc-streaming / roc-toolkit

Real-time audio streaming over the network.
https://roc-streaming.org
Mozilla Public License 2.0
1.03k stars 205 forks source link

FreeBSD port #360

Open gavv opened 4 years ago

gavv commented 4 years ago

Last revised: Oct 2023

Add support for FreeBSD and probably other BSDs.

Some preliminary work is already done: #284 (see discussion).

In SConstruct, we already have generic unix platform (automatically used on non-linux and non-darwin posix) and generic cc compiler (to be used with POSIX-compatible C compilers other than gcc and clang). When these platform and compiler are used, no linux- or gcc/clang-specific code or options are used. However, so far they were actually tested only on Linux.

First we should try to build Roc on FreeBSD using unix --platfrom and gcc or clang --compiler. If it doesn't work out of the box, we should fix the issues by either editing the portable part of the code (e.g. in under target_posix directory) or creating new OS-specific target directories if necessary. See #292 for details on the porting process and this page for details on target directories.

We should also try to add FreeBSD to CI. Ideally, using qemu. If it wont work well, we can try to cross-compile to freebsd from Linux without running tests.

We should also update docs:

jdeblese commented 2 years ago

I've been able to compile and test the devel branch in a FreeNAS jail (11.5, FreeBSD 11.3-RELEASE-p6), although there were a few issues. After building, I was able to successfully roc-send a wav file from the FreeNAS to a remote linux host. Did have to pull in sox from the FreeBSD Ports tree to send a wave file, as sox is not in the main package repo.

Edit: the defines issue is related to _POSIX_C_SOURCE: like with darwin, it appears that macro should not be defined for FreeBSD.

gavv commented 2 years ago

@jdeblese Great news! May I ask if you consider sending a patch? Right now I don't have a bsd machine at hand, so I kind of don't like to apply the changes blindly without being able to test them. But thanks for sharing anyway.

gavv commented 2 years ago

The SConstruct struggled to find the correct toolchain to build with

Would be awesome if you could provide exact error messages or maybe even debug it a bit.

jdeblese commented 2 years ago

Yes, I'll submit a PR to develop. Happy to experiment a bit more as well, and I may get a RPi set up with NetBSD or OpenBSD and test out compiling on there as well.

Re: scons, the exact error is problem detecting AR: found '/usr/local/bin/llvm-ar', which reports version 9.0.1, but expected version 8.0.0, which I fixed by replacing meta.compiler_ver with (9,0,1) at around line 525 in the calls to FindTool. Building in a new, clean jail had no such issue, so it is something specific to the jail that I first tried it in. I'm not familiar with FindTool, however, so I'm not sure I can debug that any further.

gavv commented 1 year ago

Fresh master has some related changes in build system: