FreeBSD?


#1

Is there FreeBSD support?


#2

Well, that’s just OSX without the Apple stuff, so I guess the answer is “probably”!


#3

I get “#error “Unknown platform!”” in juce_TargetPlatform.h

Trying to install FreeBSD on a VirtualBox, and having the dickens of a time! Can anyone point me in the right direction? It wants to know the number of cylinders of my hard drive (lol).


#4

Maybe try defining LINUX=1…?


#5

Hmm that didn’t work. I ended up checking for FreeBSD and defining JUCE_BSD. Then in various places I account for the differences in header files. Like in juce_BasicNativeHeaders.h.

Some things dont’ work like clock_nanoseconds() used in HighResolutionTimer (bug in FreeBSD).

Overall its doable. I’m talking about just the juce_core module. Obviously, I haven’t tried the others!


#6

Well, if you want me to merge-in your tweaks, just let me know!


#7

Unfortunately, I’ve hard-forked juce_core. Here’s a run-down of my changes though:

juce_TargetPlatform.h

#elif defined (__FreeBSD__)
  #define JUCE_BSD 1
#else
  #error "Unknown platform!"
#endif
//...
#if JUCE_LINUX || JUCE_ANDROID || JUCE_BSD

  #ifdef _DEBUG
    #define JUCE_DEBUG 1
  #endif

  // Allow override for big-endian Linux platforms
  #if defined (__LITTLE_ENDIAN__) || ! defined (JUCE_BIG_ENDIAN)
    #define JUCE_LITTLE_ENDIAN 1
    #undef JUCE_BIG_ENDIAN
  #else
    #undef JUCE_LITTLE_ENDIAN
    #define JUCE_BIG_ENDIAN 1
  #endif

  #if defined (__LP64__) || defined (_LP64)
    #define JUCE_64BIT 1
  #else
    #define JUCE_32BIT 1
  #endif

  #if __MMX__ || __SSE__ || __amd64__
    #define JUCE_INTEL 1
  #endif

juce_core.cpp

#if ! JUCE_BSD
 #include <sys/timeb.h> // deprecated on FreeBSD
#endif
//...
 #if ! JUCE_ANDROID && ! JUCE_BSD
  #include <execinfo.h>
 #endif

juce_BasicNativeHeaders.h

#elif JUCE_LINUX || JUCE_BSD
 #include <sched.h>
 #include <pthread.h>
 #include <sys/time.h>
 #include <errno.h>
 #include <sys/stat.h>
 #include <sys/ptrace.h>
 #include <sys/wait.h>
 #include <sys/mman.h>
 #include <fnmatch.h>
 #include <utime.h>
 #include <pwd.h>
 #include <fcntl.h>
 #include <dlfcn.h>
 #include <netdb.h>
 #include <arpa/inet.h>
 #include <netinet/in.h>
 #include <sys/types.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
 #include <net/if.h>
 #include <sys/file.h>
 #include <signal.h>
 #include <stddef.h>

 #if JUCE_BSD
  #include <dirent.h>
  #include <sys/param.h>
  #include <sys/mount.h>
 #else
  #include <sys/dir.h>
  #include <sys/vfs.h>
  #include <sys/sysinfo.h>
  #include <sys/prctl.h>
 #endif

juce_posix_SharedCode.h

#if JUCE_BSD
            jassertfalse; // unimplemented
#else
            clock_nanosleep (CLOCK_MONOTONIC, TIMER_ABSTIME, &t, nullptr);
#endif

juce_SystemStats.cpp

String SystemStats::getStackBacktrace()
{
    String result;

   #if JUCE_ANDROID || JUCE_MINGW || JUCE_BSD
    jassertfalse; // sorry, not implemented yet!

#8

re: clock_nanosleep, I’d have thought that using the OSX version above it (mach_wait_until) would work?


#9

I will try that and see if it compiles.


#10

Can’t seem to find the right #include for this. <mach/mach_time.h> doesn’t exist in FreeBSD.


FreeBSD support?
#11

Yeah no way Jules…wild goose chase lol! mach_* functions are for the Mach kernel, which is not FreeBSD.


#12

Fair enough! I always assumed that stuff came from the BSD parts of the OSX kernel!