Building LV2 plugins for MOD Desktop App

I am dipping my toe once again into the waters of LV2 development.

My machine is a MacBook M1.

I am able to run the MOD Desktop App successfully on it and have built an existing LV2 plugin (To make sure my toolchain works) with the view of then starting in on the midi drum machine LV2 I want to build.

I have created a virtual machine on my system (Using UTM), it is running Debian Bullseye ARM64 (I’ve had a play with Bookworm, but found various problems getting things to work … I think the new python on it is the cause).

I’ve downloaded the mod-plugin-builder and it nicely churned through the ./bootstrap.sh moddwarf-new and ./build x42-midifilter, depositing the plugin files in ~/mod-workdir/moddwarf-new/plugins

Initially, I want to use the MOD Desktop App for an easier development cycle …

Which platform do I need to build for to target the Mac version of the MOD Desktop App?. @falkTX?

And once I’ve got them built, do I need to drop them into the app bundle of the MOD Desktop App or somewhere else?

Sam x

2 Likes

none of those work, those builds are for linux cross-compilation.

mod-app uses an alternative project of mine with a similar goal in mind, that being GitHub - DISTRHO/PawPaw: Cross-Platform build scripts for audio plugins

you want to have plugins built natively, not for Linux and not for MOD units.
the actual binaries are native system binaries, so macOS ARM/Apple-Silicon in your case.

3 Likes

Thanks @falkTX,

So I’ve done the following on my Mac (Not in a VM)
I already had xcode command line tools installed.

cd ~/git
git clone git@github.com:DISTRHO/PawPaw.git

I then tried

cd PawPaw
./bootstrap-plugins.sh native

and after several iterations, from the error messages, I concluded I needed some more dependencies installed, so
brew install cmake gawk coreutils libtool make

at this point, running
./bootstrap-plugins.sh native
produces copious output, culminating in

  CCLD     libvorbis.la
ld: unknown options: -force_cpusubtype_ALL 
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [test_sharedbook] Error 1
make[3]: *** Waiting for unfinished jobs....
vorbisfile.c:1992:24: warning: unused variable 'fpu' [-Wunused-variable]
    vorbis_fpu_control fpu;
                       ^
1 warning generated.
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

(The full output can be seen here Output of ./bootstrap-plugins.sh native · GitHub)

Any pointers?

Sam x

1 Like

I have a mac mini M1, can have a look at this soon. but seems it is failing to set the correct flags for the “native” build.

Try like this:

# skip LTO, can be slow to build and we are just testing thing here anyhow
export PAWPAW_SKIP_LTO=1

# also skip tests, we dont care just yet
export PAWPAW_SKIP_TESTS=1

# try building common deps, specifying the target manually
./bootstrap-common.sh macos-universal-10.15
1 Like

Thanks @falkTX ,
I removed ~/PawPawBuilds and then executed

# skip LTO, can be slow to build and we are just testing thing here anyhow
export PAWPAW_SKIP_LTO=1

# also skip tests, we dont care just yet
export PAWPAW_SKIP_TESTS=1

# try building common deps, specifying the target manually
./bootstrap-common.sh macos-universal-10.15 2>&1 | tee outputA.log

the output ended with

 CC       sharedbook.lo
  CC       lookup.lo
  CC       bitrate.lo
1 warning generated.
  CC       vorbisfile.lo
  CC       vorbisenc.lo
  CCLD     test_sharedbook
  CCLD     libvorbis.la
ld: unknown options: -force_cpusubtype_ALL 
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [test_sharedbook] Error 1
make[3]: *** Waiting for unfinished jobs....
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: for architecture: x86_64 file: .libs/libvorbis.a(lookup.o) has no symbols
vorbisfile.c:1992:24: warning: unused variable 'fpu' [-Wunused-variable]
    vorbis_fpu_control fpu;
                       ^
1 warning generated.
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

(full output at Output · GitHub)
Sam x

1 Like

Can reproduce, fixed in Use -Wl,-ld_classic linker flag on new macOS systems · DISTRHO/PawPaw@c119fad · GitHub

Apple really loves to break things in non-backwards-compatible ways.
They introduced a new linker that takes different flags, breaking a bunch of stuff in the process.
For now we still have the chance to use the older linker through a special flag, which unblocks this

3 Likes

You are a superstar @falkTX … thank you!
After a
git pull
running
./bootstrap-plugins.sh native
started reporting a few more missings from my system
brew install autoconf meson
I addressed these and now it runs to successful completion for me :slight_smile:

Next step is to build some plugins!

Apple eh!?

My very first exposure to Apple was back in the the early 80s with the Apple IIe, then the Lisa (Predecessor to the original Mac) and so on.

They have always had to do things … differently!.

My 30 odd years of professional IT work was never Apple based, but when I retrained as a nurse in 2015 I dove back into the Apple ecosystem and I love it (I’m really blessed to own a Mac Mini Intel, Mac Mini M1, MacBook M1, iPad, iPhone), this video always makes me smile!

Using a Mac’s a little different then using a PC, it’s not so much operating a computer as it is sort of tricking it, fooling it into doing what you really want it to do! Ah … you kind of have to sneak up on a Mac

Sam x

3 Likes

Sorry to bother you again @falkTX

How can I build a MPB plugin for the MOD Desktop app on my M1 system using PawPaw now that I can run ./bootstrap-plugins.sh native successfully?
Can I copy over a directory from the MBP repo, or do I need to generate my own make files or …

Sam x

1 Like

you clone GitHub - moddevices/mod-app: MOD Audio for the desktop and just run “make” on that.
the bootstrap was partially done already, but it will still build Qt and lv2 plugins before the macOS app so it will take a little bit.

2 Likes

Thank you @falkTX !
So I cloned mod-app (I also did a submodule update to pull in the PawPaw changes)
On my system, gmake pulls in the later version of GNU Make installed by brew

❯ make -v
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0


❯ gmake -v
GNU Make 4.4.1
Built for aarch64-apple-darwin23.0.0
Copyright (C) 1988-2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

So I did

cd ~/mod-app
gmake

it seemed to run well (For quite a few minutes) but then reported

Using /Users/smanth/PawPawBuilds/targets/macos-universal-10.15/lib/python3.9/site-packages/importlib_metadata-4.10.1-py3.9.egg
Searching for zipp==3.4.0
Best match: zipp 3.4.0
Processing zipp-3.4.0-py3.9.egg
zipp 3.4.0 is already the active version in easy-install.pth

Using /Users/smanth/PawPawBuilds/targets/macos-universal-10.15/lib/python3.9/site-packages/zipp-3.4.0-py3.9.egg
Finished processing dependencies for cx-Freeze==6.8.4
~/git/mod-app/src/PawPaw
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 46.3M  100 46.3M    0     0  3112k      0  0:00:15  0:00:15 --:--:-- 3763k
patching file 'src/gui/painting/qdrawhelper.cpp'
patching file 'src/gui/painting/qdrawhelper_sse2.cpp'
patching file 'src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h'
~/PawPawBuilds/builds/macos-universal-10.15/qtbase-everywhere-src-5.12.12 ~/git/mod-app/src/PawPaw
Creating qmake...
..Done.
Info: creating cache file /Users/smanth/PawPawBuilds/builds/macos-universal-10.15/qtbase-everywhere-src-5.12.12/.qmake.cache
Info: creating stash file /Users/smanth/PawPawBuilds/builds/macos-universal-10.15/qtbase-everywhere-src-5.12.12/.qmake.stash
Project ERROR: failed to parse default search paths from compiler output
gmake: *** [Makefile:626: /Users/smanth/PawPawBuilds/targets/macos-universal-10.15/bin/cxfreeze] Error 3

subsequent invocations of gmake --debug produces

❯ gmake --debug
GNU Make 4.4.1
Built for aarch64-apple-darwin23.0.0
Copyright (C) 1988-2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating makefiles....
Updating goal targets....
 File 'all' does not exist.
  File 'build-ui/lib/libmod_utils.so' does not exist.
   File 'src/mod-ui/utils/libmod_utils.so' does not exist.
    File '/Users/smanth/PawPawBuilds/targets/macos-universal-10.15/bin/jackd' does not exist.
   Must remake target '/Users/smanth/PawPawBuilds/targets/macos-universal-10.15/bin/jackd'.
./src/PawPaw/bootstrap-mod.sh macos-universal-10.15
~/PawPawBuilds/builds/macos-universal-10.15/qtbase-everywhere-src-5.12.12 ~/git/mod-app/src/PawPaw
Creating qmake...
...............Done.
Project ERROR: failed to parse default search paths from compiler output
gmake: *** [Makefile:626: /Users/smanth/PawPawBuilds/targets/macos-universal-10.15/bin/jackd] Error 3

Feels SO close, but I can’t figure the issue.
Sam x

2 Likes

So, a small step forward.
The ERROR I was getting seems to be related to using version 15 of the xcode command tools.

https://codereview.qt-project.org/c/qt/qtbase/+/503172
states
The new linker in Xcode 15 doesn’t provide any default linker or
framework paths when requested via -v, but still seems to use the
default paths documented in the ld man page.
and shows a change that can be made
https://codereview.qt-project.org/c/qt/qtbase/+/503172/3/mkspecs/features/toolchain.prf

I applied this at line 266 of

~/PawPawBuilds/builds/macos-universal-10.15/qtbase-everywhere-src-5.12.12/mkspecs/features/toolchain.prf

which stops the previous ERROR, but a new one has emerged :sob:

❯ gmake
./src/PawPaw/bootstrap-mod.sh macos-universal-10.15
~/PawPawBuilds/builds/macos-universal-10.15/qtbase-everywhere-src-5.12.12 ~/git/mod-app/src/PawPaw
Creating qmake...
...Done.

This is the Qt Open Source Edition.

You have already accepted the terms of the Open Source license.

Running configuration tests...
Done running configuration tests.
Configure summary:

Build type: macx-clang (arm64, CPU features: neon crc32)
Compiler: clang (Apple) 15.0.0
Configuration: largefile neon optimize_size silent shared qt_framework rpath release c++11 c++14 concurrent reduce_exports stl
Build options:
  Mode ................................... release
  Optimize release build for size ........ yes
  Building shared libraries .............. yes
  Using C standard ....................... C11
  Using C++ standard ..................... C++14
  Using ccache ........................... no
  Using gold linker ...................... no
  Using precompiled headers .............. no
  Using LTCG ............................. no
  Target compiler supports:
    NEON ................................. yes
  Build parts ............................ libs tools
  App store compliance ................... no
Qt modules and options:
  Qt Concurrent .......................... yes
  Qt D-Bus ............................... no
  Qt D-Bus directly linked to libdbus .... no
  Qt Gui ................................. yes
  Qt Network ............................. yes
  Qt Sql ................................. yes
  Qt Testlib ............................. yes
  Qt Widgets ............................. yes
  Qt Xml ................................. yes
Support enabled for:
  Using pkg-config ....................... yes
  udev ................................... no
  Using system zlib ...................... no
Qt Core:
  DoubleConversion ....................... yes
    Using system DoubleConversion ........ no
  GLib ................................... no
  iconv .................................. no
  ICU .................................... no
  Tracing backend ........................ <none>
 Logging backends:
    journald ............................. no
    syslog ............................... no
    slog2 ................................ no
  Using system PCRE2 ..................... no
Qt Network:
  CoreWLan ............................... yes
  getifaddrs() ........................... yes
  IPv6 ifname ............................ yes
  libproxy ............................... no
  SecureTransport ........................ no
  OpenSSL ................................ no
    Qt directly linked to OpenSSL ........ no
  OpenSSL 1.1 ............................ no
  DTLS ................................... no
  SCTP ................................... no
  Use system proxies ..................... yes
Qt Gui:
  Accessibility .......................... yes
  FreeType ............................... yes
    Using system FreeType ................ no
  HarfBuzz ............................... yes
    Using system HarfBuzz ................ no
  Fontconfig ............................. no
  Image formats:
    GIF .................................. no
    ICO .................................. no
    JPEG ................................. yes
      Using system libjpeg ............... no
    PNG .................................. yes
      Using system libpng ................ no
  EGL .................................... no
  OpenVG ................................. no
OpenGL:
    Desktop OpenGL ....................... yes
    OpenGL ES 2.0 ........................ no
    OpenGL ES 3.0 ........................ no
    OpenGL ES 3.1 ........................ no
    OpenGL ES 3.2 ........................ no
  Vulkan ................................. no
  Session Management ..................... yes
Features used by QPA backends:
  evdev .................................. no
  libinput ............................... no
  INTEGRITY HID .......................... no
  mtdev .................................. no
  tslib .................................. no
  xkbcommon .............................. no
  X11 specific:
    XLib ................................. no
    XCB Xlib ............................. no
    EGL on X11 ........................... no
QPA backends:
  DirectFB ............................... no
  EGLFS .................................. no
  LinuxFB ................................ no
  VNC .................................... no
  Mir client ............................. no
Qt Sql:
  SQL item models ........................ yes
Qt Widgets:
  GTK+ ................................... no
  Styles ................................. Fusion macOS Windows
Qt PrintSupport:
  CUPS ................................... no
Qt Sql Drivers:
  DB2 (IBM) .............................. no
  InterBase .............................. no
  MySql .................................. no
  OCI (Oracle) ........................... no
  ODBC ................................... no
  PostgreSQL ............................. no
  SQLite2 ................................ no
  SQLite ................................. yes
    Using system provided SQLite ......... no
  TDS (Sybase) ........................... no
Qt Testlib:
  Tester for item models ................. yes

ERROR: Feature 'system-zlib' was enabled, but the pre-condition 'libs.zlib' failed.

Check config.log for details.
gmake: *** [Makefile:626: /Users/smanth/PawPawBuilds/targets/macos-universal-10.15/bin/jackd] Error 3

And config.log has what seems a load of nasty warnings/errors in it!

Sam x

3 Likes

Thanks so much for putting this here! I’ll “follow along at home” at some point, and I’ll be very grateful for this :slight_smile:

3 Likes

You’re very welcome @malfunction54!

My issues seem to be due to me using an M1 … the online github builds for MacOS seem to run fine.
Giveen the huge number of warnings/errors I’m seeing with the QT stuff, I’m thinking that it might be better to extract just the plugin build code, I don’t really need to build the whole MOD Desktop App, I just want to do an LV2 development and then deploy it to use with the App on my Mac (And also to my Dwarf once it is working) … but I’m struggling to figure out how to do it! (My makefile skills are low).

I wonder if @falktx might be able to suggest how to do so?

Sam x

1 Like

HUGE STEP FORWARD!

After scouring the makefile and build scripts I tried the following

make PAWPAW_SKIP_QT=1 plugins

and after some time, I now have a directory full of LV2 plugins. I’ve checked them with lipo -archs and they report x86_64 arm64.

So, the steps overall (MacBook M1 running Sonoma 14.2.1)

# Grab the mod-app repo
cd ~/git
git clone --recurse-submodules git@github.com:moddevices/mod-app.git

There are a number of prequisites, including xcode command tools. I use brew to install such things on my Mac.

Installing brew will itself cause xcode command tools to be installed (If not already on the system) and then brew can be used to install the other stuff needed

brew install autoconf automake cmake coreutils gawk git gnu-sed jq make meson p7zip wget

Then to build the plugins

cd ~/git/mod-app
make PAWPAW_SKIP_QT=1 plugins

and the plugins will appear in

~/git/mod-app/build/plugins/

For some reason, not all of the plugins I expect are there, for instance “aidadsp-lv2” is not; it appears to be listed in the makefile to be built and I can see workproducts being created in ~/PawPawBuilds/builds/macos-universal-10.15/aidadsp-lv2-bb2751b52d50c9b926780dc4063be2ca79dc775b but I cannot see the LV2 plugin folder/files for it.

But my next step is to try to add a simple LV2 of my own and build/deploy it.

Sam x.

3 Likes

That is great news! Now I’m itching to try this myself :slight_smile:

2 Likes

Well knock me over with a feather!

I’ve managed to build my VERY FIRST LV2 plugin, the eg-amp-labs.lv2 sample in mod-plugin-builder.

I could not get it to work using the mod-app make process detailed above, despite adding it to the plugin build targets … the makefiles are totally messing with my head!

Instead, I succeeded using PawPaw.

I got the source from

I dropped this into a folder called eg-amp.lv2 in my own source tree, giving me this.
CleanShot 2024-01-13 at 17.21.57@2x

I could not figure out a better way of ensuring it was targetting MacOS then adding a line to Makefile.mk

I also changed the name of the plugin in amp.ttl

To build

# Install dependencies
brew install autoconf automake cmake coreutils gawk git gnu-sed jq make meson p7zip wget

cd ~/git

# Grab the PawPaw repo
git clone git@github.com:DISTRHO/PawPaw.git

# change dir to PawPaw root folder
cd ~/git/PawPaw

# build plugin dependencies for target (only needed once)
./bootstrap-plugins.sh macos-universal-10.15

# set up environment variables for macos-universal-10.15 builds with PawPaw static libs
source local.env macos-universal-10.15

# change dir to your own project and build
cd ~/git/eg-amp.lv2
gmake

and it built!
CleanShot 2024-01-13 at 17.29.04@2x

I created an LV2 directory in the right place, which on a Mac is
inside ~/Library/Audio/Plug-Ins and then I copied the eg-amp.lv2 folder into it.

I fired up the MOD App, ticked the ‘Show all LV2 Plugins’ option and clicked ‘Start’.

And there it was!

I wired it into a simple pedalboard and it works!

No MODUI but the settings can be tweaked in the config screen.

Well chuffed!
Sam x

13 Likes

@SamIAm Congratulations on your perseverance and success! I really appreciate you taking the time to document your steps and will keep this bookmarked in hopes of making use. I’d like to be able to build some of the familiar Calf / Gx* plugins for MOD App and be available to help make Mac-targeted builds for the plugin suite. Thanks for working through the tedious steps for the rest of us.

4 Likes