mtytel / helm

Helm - a free polyphonic synth with lots of modulation
http://tytel.org/helm
GNU General Public License v3.0
2.36k stars 202 forks source link

FreeBSD / TrueOS support #142

Open danboid opened 7 years ago

danboid commented 7 years ago

I have been running TrueOS as my main OS for the last few weeks and I'm liking it a lot. I wanted to switch from Linux so I get fully supported ZFS with all its great benefits (mainly boot environments and snapshots) plus, and more relevant for helm, I greatly prefer OSS (the default soundsystem in FreeBSD and TrueOS) to ALSA. It's so much easier to manage and you can easily run JACK alongside PA or other OSS apps. I hear the FreeBSD kernel is more RT safe than Linux is, by default (without special RT patches) at least. It 'just works' more than Linux for me, most notably for audio.

I've already got a recent version of Ardour running nicely under TrueOS with my Focusrite 2i4 USB soundcard, so now it came time to test MIDI and the first app I reached for was helm, of course! I suspect I could be the first to trying to build it under a FreeBSD derivative because the makefile indicates it currently only supports Linux and OSX.

Would you consider adding FreeBSD / TrueOS support Matt? I'm presuming juce will be easy enough to patch for FreeBSD in asking, of course.

Thanks

gmake -C standalone/builds/linux CONFIG=Release DEBCXXFLAGS="" DEBLDFLAGS="" gmake[1]: Entering directory '/usr/home/dan/src/helm/standalone/builds/linux' Compiling juce_audio_devices.cpp In file included from ../../../JUCE/modules/juce_audio_devices/juce_audio_devices.cpp:40: In file included from ../../../JUCE/modules/juce_audio_devices/juce_audio_devices.h:28: In file included from ../../../JUCE/modules/juce_audio_devices/../juce_events/juce_events.h:29: In file included from ../../../JUCE/modules/juce_audio_devices/../juce_events/../juce_core/juce_core.h:137: In file included from ../../../JUCE/modules/juce_audio_devices/../juce_events/../juce_core/native/juce_BasicNativeHeaders.h:171: /usr/include/sys/dir.h:39:2: warning: "The information in this file should be obtained from " [-W#warnings]

warning "The information in this file should be obtained from "

^ /usr/include/sys/dir.h:40:2: warning: "and is provided solely (and temporarily) for backward compatibility." [-W#warnings]

warning "and is provided solely (and temporarily) for backward compatibility."

^ In file included from ../../../JUCE/modules/juce_audio_devices/juce_audio_devices.cpp:40: In file included from ../../../JUCE/modules/juce_audio_devices/juce_audio_devices.h:28: In file included from ../../../JUCE/modules/juce_audio_devices/../juce_events/juce_events.h:29: In file included from ../../../JUCE/modules/juce_audio_devices/../juce_events/../juce_core/juce_core.h:137: ../../../JUCE/modules/juce_audio_devices/../juce_events/../juce_core/native/juce_BasicNativeHeaders.h:173:11: fatal error: 'sys/vfs.h' file not found

include <sys/vfs.h>

      ^~~~~~~~~~~

2 warnings and 1 error generated. gmake[1]: [Makefile:733: build/intermediate/Release/juce_audio_devices_2d9302c9.o] Error 1 gmake[1]: Leaving directory '/usr/home/dan/src/helm/standalone/builds/linux' gmake: [Makefile:35: standalone] Error 2

danboid commented 7 years ago

I found this about JUCE under FreeBSD. Apparently some guy has got it working but decided to fork it into something called BEAST. Dunno how easy it will be for anyone to discern what he had to patch as a result.

https://forum.juce.com/t/freebsd-support/10678

danboid commented 7 years ago

Looks like most of his patches for JUCE under FreeBSD are here:

https://forum.juce.com/t/freebsd/10638/7

I'd like to build helm as an LV2 plugin so that I've got a good softsynth to use under Ardour.

danboid commented 7 years ago

I have applied all the JUCE FreeBSD patches in the link from my previous post to the JUCE code in the Helm tree and added

-D "JUCE_BSD=1"

to the Release CPPFLAGS section of /standalone/builds/linux/Makefile and now I get as far as:

Compiling juce_audio_devices.cpp ../../../JUCE/modules/juce_audio_devices/juce_audio_devices.cpp:107:12: fatal error: 'alsa/asoundlib.h' file not found

include <alsa/asoundlib.h>

       ^~~~~~~~~~~~~~~~~~

1 error generated. gmake[1]: [Makefile:733: build/intermediate/Release/juce_audio_devices_2d9302c9.o] Error 1 gmake[1]: Leaving directory '/usr/home/dan/src/helm/standalone/builds/linux' gmake: [Makefile:35: standalone] Error 2

Is there an easy way to disable ALSA for JACK only audio yet?

mtytel commented 7 years ago

Hmmm.. have you tried:

-D "JUCE_ALSA=0"

Also you're just making the lv2 with:

make lv2

right? Reason I ask is that a lot of the system dependent stuff (like alsa) is only needed in the standalone.

danboid commented 7 years ago

Hi Matt

I've just tried building helm again, with the JUCE BSD patches but this time I modified the release CPPFLAGS within /builds/linux/LV2/Makefile.binary to add

-D "JUCE_BSD=1" -D "JUCE_ALSA=0"

Then I ran gmake lv2 in the tree root but JUCE still isn't quite happy it seems:

Compiling juce_core.cpp
In file included from ../../../JUCE/modules/juce_core/juce_core.cpp:48:
/usr/include/sys/timeb.h:42:2: warning: "this file includes <sys/timeb.h> which is deprecated" [-W#warnings]
#warning "this file includes <sys/timeb.h> which is deprecated"
 ^
In file included from ../../../JUCE/modules/juce_core/juce_core.cpp:197:
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:249:21: error: invalid use of incomplete type 'juce::(anonymous namespace)::stat64'
                 && JUCE_STAT (fileName.toUTF8(), &info) == 0;
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:240:27: note: expanded from macro 'JUCE_STAT'
    #define JUCE_STAT     stat64
                          ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:239:20: note: forward declaration of 'juce::(anonymous namespace)::stat64'
    typedef struct stat64 juce_statStruct;
                   ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:269:92: error: member access into incomplete type 'const juce_statStruct' (aka 'const juce::(anonymous namespace)::stat64')
    static int64 getCreationTime (const juce_statStruct& s) noexcept     { return (int64) s.st_ctime; }
                                                                                           ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:239:20: note: forward declaration of 'juce::(anonymous namespace)::stat64'
    typedef struct stat64 juce_statStruct;
                   ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:277:29: error: variable has incomplete type 'juce_statStruct' (aka 'juce::(anonymous namespace)::stat64')
            juce_statStruct info;
                            ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:239:20: note: forward declaration of 'juce::(anonymous namespace)::stat64'
    typedef struct stat64 juce_statStruct;
                   ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:306:21: error: variable has incomplete type 'juce_statStruct' (aka 'juce::(anonymous namespace)::stat64')
    juce_statStruct info;
                    ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:239:20: note: forward declaration of 'juce::(anonymous namespace)::stat64'
    typedef struct stat64 juce_statStruct;
                   ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:325:21: error: variable has incomplete type 'juce_statStruct' (aka 'juce::(anonymous namespace)::stat64')
    juce_statStruct info;
                    ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:239:20: note: forward declaration of 'juce::(anonymous namespace)::stat64'
    typedef struct stat64 juce_statStruct;
                   ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:331:21: error: variable has incomplete type 'juce_statStruct' (aka 'juce::(anonymous namespace)::stat64')
    juce_statStruct info;
                    ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:239:20: note: forward declaration of 'juce::(anonymous namespace)::stat64'
    typedef struct stat64 juce_statStruct;
                   ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:349:21: error: variable has incomplete type 'juce_statStruct' (aka 'juce::(anonymous namespace)::stat64')
    juce_statStruct info;
                    ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:239:20: note: forward declaration of 'juce::(anonymous namespace)::stat64'
    typedef struct stat64 juce_statStruct;
                   ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:380:21: error: variable has incomplete type 'juce_statStruct' (aka 'juce::(anonymous namespace)::stat64')
    juce_statStruct info;
                    ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:239:20: note: forward declaration of 'juce::(anonymous namespace)::stat64'
    typedef struct stat64 juce_statStruct;
                   ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:392:21: error: variable has incomplete type 'juce_statStruct' (aka 'juce::(anonymous namespace)::stat64')
    juce_statStruct info;
                    ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:239:20: note: forward declaration of 'juce::(anonymous namespace)::stat64'
    typedef struct stat64 juce_statStruct;
                   ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:978:13: error: use of undeclared identifier 'PR_SET_NAME'
     prctl (PR_SET_NAME, name.toRawUTF8(), 0, 0, 0);
            ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:1394:13: error: expected unqualified-id
            jassertfalse; // unimplemented
            ^
../../../JUCE/modules/juce_core/system/juce_PlatformDefs.h:147:37: note: expanded from macro 'jassertfalse'
  #define jassertfalse              JUCE_BLOCK_WITH_FORCED_SEMICOLON (JUCE_LOG_CURRENT_ASSERTION)
                                    ^
../../../JUCE/modules/juce_core/system/juce_PlatformDefs.h:108:46: note: expanded from macro 'JUCE_BLOCK_WITH_FORCED_SEMICOLON'
 #define JUCE_BLOCK_WITH_FORCED_SEMICOLON(x) do { x } while (false)
                                             ^
In file included from ../../../JUCE/modules/juce_core/juce_core.cpp:197:
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:1394:13: error: expected unqualified-id
../../../JUCE/modules/juce_core/system/juce_PlatformDefs.h:147:37: note: expanded from macro 'jassertfalse'
  #define jassertfalse              JUCE_BLOCK_WITH_FORCED_SEMICOLON (JUCE_LOG_CURRENT_ASSERTION)
                                    ^
../../../JUCE/modules/juce_core/system/juce_PlatformDefs.h:108:55: note: expanded from macro 'JUCE_BLOCK_WITH_FORCED_SEMICOLON'
 #define JUCE_BLOCK_WITH_FORCED_SEMICOLON(x) do { x } while (false)
                                                      ^
In file included from ../../../JUCE/modules/juce_core/juce_core.cpp:220:
../../../JUCE/modules/juce_core/native/juce_linux_Files.cpp:193:21: error: variable has incomplete type 'juce_statStruct' (aka 'juce::(anonymous namespace)::stat64')
    juce_statStruct info;
                    ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:239:20: note: forward declaration of 'juce::(anonymous namespace)::stat64'
    typedef struct stat64 juce_statStruct;
                   ^
In file included from ../../../JUCE/modules/juce_core/juce_core.cpp:221:
../../../JUCE/modules/juce_core/native/juce_linux_Network.cpp:44:31: error: use of undeclared identifier 'SIOCGIFHWADDR'
                if (ioctl (s, SIOCGIFHWADDR, &ifr) == 0)
                              ^
../../../JUCE/modules/juce_core/native/juce_linux_Network.cpp:46:55: error: no member named 'ifr_hwaddr' in 'ifreq'
                    MACAddress ma ((const uint8*) ifr.ifr_hwaddr.sa_data);
                                                  ~~~ ^
In file included from ../../../JUCE/modules/juce_core/juce_core.cpp:225:
../../../JUCE/modules/juce_core/native/juce_linux_SystemStats.cpp:98:20: error: variable has incomplete type 'struct sysinfo'
    struct sysinfo sysi;
                   ^
../../../JUCE/modules/juce_core/native/juce_linux_SystemStats.cpp:98:12: note: forward declaration of 'sysinfo'
    struct sysinfo sysi;
           ^
../../../JUCE/modules/juce_core/native/juce_linux_SystemStats.cpp:145:67: error: use of undeclared identifier '_NL_IDENTIFICATION_LANGUAGE'
String SystemStats::getUserLanguage()    { return getLocaleValue (_NL_IDENTIFICATION_LANGUAGE); }
                                                                  ^
../../../JUCE/modules/juce_core/native/juce_linux_SystemStats.cpp:146:67: error: use of undeclared identifier '_NL_IDENTIFICATION_TERRITORY'
String SystemStats::getUserRegion()      { return getLocaleValue (_NL_IDENTIFICATION_TERRITORY); }
                                                                  ^
1 warning and 18 errors generated.
gmake[2]: *** [Makefile.binary:750: build/intermediate/Release/juce_core_9d6b33ad.o] Error 1
gmake[2]: Leaving directory '/usr/home/dan/src/helm/builds/linux/LV2'
gmake[1]: *** [Makefile:8: binary] Error 2
gmake[1]: Leaving directory '/usr/home/dan/src/helm/builds/linux/LV2'
gmake: *** [Makefile:38: lv2] Error 2
mtytel commented 7 years ago

Whelp.. I have no idea. This is defs of out of my skill set/knowledge. You could try the juce forum. Some linux people are on there: http://forum.juce.com Or #lv2 on IRC, falktx made lv2 plugins work in JUCE. He might have some insight.

danboid commented 7 years ago

No probs Matt - I just wanted to see what suggestions you might have before I ask the JUCE devs or otherwise have to get adventurous.

If I'm successful in getting JUCE and Helm to build, I presume you'd have no objections to adding FreeBSD support to helm?

Thanks!

mtytel commented 7 years ago

Yes, but It depends on how much the JUCE framework changes. I don't really have the bandwidth to test a whole framework so I'd need the changes to be either minimal or mostly segregated so I'm mostly sure the changes don't insert new bugs.

danboid commented 7 years ago

The last error was probably a result of me passing both the LINUX and JUCE_BSD defines, which is prob not the best idea.

Just using the JUCE_BSD def in Makefile.binary, I get this far currently:

Compiling juce_audio_processors.cpp
Compiling juce_audio_utils.cpp
Compiling juce_core.cpp
In file included from ../../../JUCE/modules/juce_core/juce_core.cpp:48:
/usr/include/sys/timeb.h:42:2: warning: "this file includes <sys/timeb.h> which is deprecated" [-W#warnings]
#warning "this file includes <sys/timeb.h> which is deprecated"
 ^
In file included from ../../../JUCE/modules/juce_core/juce_core.cpp:156:
../../../JUCE/modules/juce_core/network/juce_Socket.cpp:134:19: error: no type named 'close' in the global namespace
                ::close (h);
                ~~^
In file included from ../../../JUCE/modules/juce_core/juce_core.cpp:157:
../../../JUCE/modules/juce_core/network/juce_IPAddress.cpp:146:11: error: no type named 'close' in the global namespace
        ::close (sock);
        ~~^
In file included from ../../../JUCE/modules/juce_core/juce_core.cpp:164:
../../../JUCE/modules/juce_core/system/juce_SystemStats.cpp:168:11: error: use of undeclared identifier 'getpid'
    kill (getpid(), SIGKILL);
          ^
In file included from ../../../JUCE/modules/juce_core/juce_core.cpp:197:
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:202:17: error: use of undeclared identifier 'getcwd'
    char* cwd = getcwd (localBuffer, sizeof (localBuffer) - 1);
                ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:208:15: error: use of undeclared identifier 'getcwd'
        cwd = getcwd (heapBuffer, bufferSize - 1);
              ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:217:12: error: use of undeclared identifier 'chdir'
    return chdir (getFullPathName().toUTF8()) == 0;
           ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:287:27: error: use of undeclared identifier 'access'
            *isReadOnly = access (path.toUTF8(), W_OK) != 0;
                          ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:315:17: error: use of undeclared identifier 'access'
             && access (fullPath.toUTF8(), F_OK) == 0;
                ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:339:16: error: use of undeclared identifier 'access'
        return access (fullPath.toUTF8(), W_OK) == 0;
               ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:412:16: error: use of undeclared identifier 'rmdir'
        return rmdir (fullPath.toUTF8()) == 0;
               ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:460:9: error: use of undeclared identifier 'close'
        close (getFD (fileHandle));
        ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:469:20: error: no member named 'read' in the global namespace
        result = ::read (getFD (fileHandle), buffer, numBytes);
                 ~~^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:499:17: error: use of undeclared identifier 'close'
                close (f);
                ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:522:9: error: use of undeclared identifier 'close'
        close (getFD (fileHandle));
        ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:533:20: error: no member named 'write' in the global namespace
        result = ::write (getFD (fileHandle), data, numBytes);
                 ~~^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:546:13: error: use of undeclared identifier 'fsync'
        if (fsync (getFD (fileHandle)) == -1)
            ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:585:40: error: use of undeclared identifier '_SC_PAGE_SIZE'
        const long pageSize = sysconf (_SC_PAGE_SIZE);
                                       ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:617:9: error: use of undeclared identifier 'close'
        close (fileHandle);
        ^
../../../JUCE/modules/juce_core/native/juce_posix_SharedCode.h:862:13: error: use of undeclared identifier 'close'
            close (handle);
            ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
gmake[2]: *** [Makefile.binary:750: build/intermediate/Release/juce_core_9d6b33ad.o] Error 1
gmake[2]: Leaving directory '/usr/home/dan/src/helm/builds/linux/LV2'
gmake[1]: *** [Makefile:8: binary] Error 2
gmake[1]: Leaving directory '/usr/home/dan/src/helm/builds/linux/LV2'
gmake: *** [Makefile:38: lv2] Error 2
Martinfx commented 6 years ago

@danboid Problem is , that bsd doesnt much support .