DBraun / DawDreamer

Digital Audio Workstation with Python; VST instruments/effects, parameter automation, FAUST, JAX, Warp Markers, and JUCE processors
GNU General Public License v3.0
936 stars 68 forks source link

macOS: missing symbol error on first attempt to run #39

Closed shakfu closed 3 years ago

shakfu commented 3 years ago

I following the README, compiled successfully (I'm using homebrew python instead), renamed the resultant dylib, applied the install_name_tool, renamed and moved the libfaust library and put them together for the first run and I got the following error:

Python 3.9.6 (default, Jun 29 2021, 06:20:32)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.25.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import dawdreamer as daw
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-1bf2d360b931> in <module>
----> 1 import dawdreamer as daw

ImportError: dlopen($HOME/Downloads/dawdreamer.so, 2): Symbol not found: _kMIDIPropertyProtocolID
  Referenced from: $HOME/Downloads/dawdreamer.so (which was built for Mac OS X 11.1)
  Expected in: /System/Library/Frameworks/CoreMIDI.framework/Versions/A/CoreMIDI
 in $HOME/Downloads/dawdreamer.so

So it's not finding _kMIDIPropertyProtocolID which means that CoreMIDI should have been included as a dependency. But I checked in the Xcode project and it was already (see attached screenshot). Any Suggestions on how to fix this?

frameworks

S

DBraun commented 3 years ago

Thanks for trying it out. I just did a build on Big Sur 11.4 and didn't have this issue. Could you try the Python universal installer? Maybe IPython is an issue too. My screenshot of the Frameworks and Libraries section is the same as yours. The libsamplerate and libfaust have been compiled on this mac, but that doesn't seem like the issue here.

DBraun commented 3 years ago

The universal installer installs to /Library/Frameworks/Python.framework/Versions/3.9. You can see references to this path in the Exporters/Xcode section of the Projucer if you have the Projucer installed. With the Python from homebrew, did you have to modify the Projucer or Xcode project in any way to get the dylib built? Just curious.

shakfu commented 3 years ago

I added entries to "Library search path" and "Header search path" in Xcode to point to the appropriate locations for python3 installed by homebrew to allow successful compilation. Did I miss anything?

shakfu commented 3 years ago

By the way, I didn't use any 'universal installer', I just compiled the Xcode project and followed the instructions with respect to renaming and also the libfaust move / rename.

DBraun commented 3 years ago

What is the result of otool -L dawdreamer.so? This is mine, and it has CoreMIDI.

Screen Shot 2021-07-04 at 2 17 35 PM
shakfu commented 3 years ago

Here's the dump from otool -L daydreamer.so:

$ otool -L dawdreamer.so
dawdreamer.so:
    /usr/local/lib/dawdreamer.so.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/local/opt/libsamplerate/lib/libsamplerate.0.dylib (compatibility version 2.0.0, current version 2.8.0)
    @loader_path/libfaust.2.dylib (compatibility version 2.0.0, current version 2.13.15)
    /usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/Python (compatibility version 3.9.0, current version 3.9.0)
    /System/Library/Frameworks/AudioUnit.framework/Versions/A/AudioUnit (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (compatibility version 1.0.0, current version 4.0.0)
    /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox (compatibility version 1.0.0, current version 1000.0.0)
    /System/Library/Frameworks/AVFoundation.framework/Versions/A/AVFoundation (compatibility version 1.0.0, current version 2.0.0)
    /System/Library/Frameworks/AVKit.framework/Versions/A/AVKit (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 164.0.0)
    /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 23.0.0)
    /System/Library/Frameworks/CoreAudio.framework/Versions/A/CoreAudio (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/CoreAudioKit.framework/Versions/A/CoreAudioKit (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/CoreMedia.framework/Versions/A/CoreMedia (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/CoreMIDI.framework/Versions/A/CoreMIDI (compatibility version 1.0.0, current version 69.0.0)
    /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1770.255.0)
    /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
    /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore (compatibility version 1.2.0, current version 1.11.0)
    /System/Library/Frameworks/WebKit.framework/Versions/A/WebKit (compatibility version 1.0.0, current version 610.3.7)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 904.4.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.60.1)
    /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 2022.20.117)
    /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 54.0.0)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1770.255.0)
    /System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics (compatibility version 64.0.0, current version 1463.2.1)
    /System/Library/Frameworks/CoreImage.framework/Versions/A/CoreImage (compatibility version 1.0.1, current version 5.0.0)
    /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1122.11.0)
    /System/Library/Frameworks/CoreText.framework/Versions/A/CoreText (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo (compatibility version 1.2.0, current version 1.5.0)
    /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
shakfu commented 3 years ago

Does one need /usr/local/lib/dawdreamer.so.dylib to be actually installed? I didn't see any mention of installing it there in your installation advice so I opted not to manually install it there because I thought it was redundant. Perhaps this is the issue?

DBraun commented 3 years ago

I don't think it does. /usr/local/lib/dawdreamer.so.dylib doesn't exist on my system. Yours includes /usr/local/opt/libsamplerate/lib/libsamplerate.0.dylib. I think my intention was to include libsamplerate as a static library, but you ended up with a dynamic reference. It might not matter.

Why are you using IPython? If I do which python3 I get /Library/Frameworks/Python.framework/Versions/3.9/bin/python3. Would you mind using the macOS 64-bit universal2 installer?

There was an earlier issue using Python in conda even though the dawdreamer.so was built fine. I think something similar might be happening.

shakfu commented 3 years ago

It's strange because I added an explicit link to CoreMIDI in the "Other Linker Flags" section in Xcode to be: "-lsamplerate -lfaust -shared -lpython3.9 -framework CoreMIDI" It compiled fine without errors as before but then same error on opening.

Incidentally, I'm only using IPython as a terminal for testing, I also opened it in the vanilla python3 terminal and it gave the same error.

My which python3 is /usr/local/bin/python3 which is linked to Homebrew python and I'm still on Catalina. To be honest, I'm disinclined to install universal installer in case it messes up my homebrew python system. But I have a old spare which I can perhaps use to try the universal installer.

In any case, this is a really strange error because there are no errors in compilation, the linking looks ok, and otool -L readout looks ok as well.

Let's see what happens with some more testing on my spare.

shakfu commented 3 years ago

Got it to work. (-: It was simply an issue of changing the Deployment Target in Xcode to 10.15

Thanks for helping me sort this out. Looks like you don't need a universal installer after all.

shakfu commented 3 years ago

May I suggest that you include a small note in your installation docs to look out for this issue in case newcomers are using homebrew python (which I think is quite popular) and since your default setting on Xcode was set to 10.11

DBraun commented 3 years ago

Good catch, thank you. That is an easy setting for me to fix in the Projucer. I will get to it soon.

DBraun commented 3 years ago

Fixed in latest and tested on all platforms.