Succesfully compiled juce_core on FreeBSD

Hi,

I have played around with compiling a JUCE command-line application on FreeBSD in the last couple of days. I managed to compile juce_core & juce_data_structures, with only some minor changes.

Fork: tobanteAudio/JUCE
Patch: 0001-Compile-juce_core-on-FreeBSD.patch
Test project: juce-freebsd-example

I created a Projucer project on Linux and copied the Source/ & JuceLibraryCode/ to the BSD machine. After applying my patch to the JUCE code, the compilation of a static library works without any problems. I’m currently using CMake to build things, but I’m stuck on multiple link errors when trying to create the executable (CMake finds the includes during compilation but not the libraries for linking). I will try with manually building things sometime this week.

I’ll post updates.

Toby

2 Likes

Little Update:

I’m now build the test project using native FreeBSD Makefile: Example that uses juce::File can be found here.

What’s working?

Successfully compiled:

  • juce_audio_basics
  • juce_audio_formats
  • juce_core
  • juce_data_structures
  • juce_dsp
  • juce_events

What’s not working?

  • DBG() macro

    • Using this macro in a debug build crashes the build.
  • juce_core

    • sys/timeb.h deprecated since FreeBSD 11.1
    • Process::openDocument (linux environ is missing on FreeBSD)
    • MACAddress::findAllAddresses
    • SystemStats::getMemorySizeInMegabytes
    • String SystemStats::getUserLanguage (Missing: _NL_IDENTIFICATION_LANGUAGE)
    • String SystemStats::getUserRegion (Missing: _NL_IDENTIFICATION_TERRITORY)

The patch for juce_events can be found here

For now most changes have been to add || JUCE_BSD to enable platform specific includes.

1 Like

GUI is working:

I’ll upload the patch soon.

This is reminiscent of past embedded/set-top box work I’ve done when porting JUCE for a proof-of-concept at the time: Compilation issues when supporting some old Linux platforms .

Basically, whatever version of the uClibc toolchain was being used to build your OS has the locale/xlocale stuff disabled or bugged out for whatever reason.

I don’t think FreeBSD uses uClibc, isn’t that for Linux only?

I admit that my knowledge about FreeBSD is extremely limited, though I’m totally open to learning more about it.

Some quick searching online shows that these macros exist in glibc the same as uClibc, so it’s entirely possible my message applies similarly: where some kind of configuration for glibc has the locale contents disabled - although I can be totally wrong about that.

FreeBSD is a completely separate project from Linux. Unlike Linux, where the Userland is provide by the distributions, FreeBSD ships with both the Kernel and the Userland in one big project.

Projects like FreeNAS and Pfsense are based on FreeBSD.

It uses the BSD libc implementation of the C standard library, see wikipedia/C_standard_library