Euterpea/Euterpea2

can't load framework: CoreMIDI

shawn-kern opened this issue · 6 comments

on macOS 11.2.2 following import, I get "can't load framework: CoreMIDI (not found)" after any function call, eg.

Prelude Euterpea> devices
can't load framework: CoreMIDI (not found)

I tried reinstalls specifying the CoreMIDI framework & framework path with ghc-options.

MG-ng commented

I'm getting the same error and would be grateful for any help!

MG-ng commented

So, I've tried

Restarting the core audio demon with
sudo launchctl kickstart -kp system/com.apple.audio.coreaudiod

Reinstalling Euterpea and HSoM with
cabal install Euterpea --ghc-options="-optl-Wl,-framework,CoreMIDI,-framework,CoreAudio" --force-reinstalls
then
cabal install HSoM-1.0.0 —reinstall
(because I read the book)

I'm running

cabal version 2.4.1.0
ghc version 8.6.3
PortMidi-0.2.0.0

But I think more importantly:
macOS BigSur version 11.2.3
It worked with Catalina (but I'm not going back because of the book)

eqMac (newest version)
I also updated from eqMac2 because it didn't work anymore (but I don't think that this is the reason)

Bifurcate and FluidSynth (runtime version 2.1.6) run as expected.
But for example the command/function devices in ghci will result in can't load framework: CoreMIDI (not found)

Would be really nice to get some hints
If you need other/more specs/terminal outputs, don't hesitate to ask!

donya commented

This is not something I've ever encountered with Mac and unfortunately I do not have a BigSur machine to test on. One question to ask is whether you have any other MIDI-related applications that still work as intended (a DAW, etc.)?

I suspect the problem is likely not Euterpea itself, since the "devices" function is really a wrapper to print info from Sound.PortMidi in a particular format.

See if you can do this is GHCi (don't import Euterpea!):
import Sound.PortMidi
countDevices

It should print a number if you have some MIDI devices. If that succeeds and gives you a number >=1, then try

getDeviceInfo 0

All Euterpea is doing with the device function is a pretty print of that so I'm guessing either countDevices or getDeviceInfo will be the point of failure. The next thing to check would be if there is a more recent PortMidi than gets installed with Euterpea right now and if that more recent one has the issue. This can be done by looking at what packages you have

ghc-pkg list

then unregistering the old one (this will break Euterpea FYI)

ghc-pkg unregister PortMidi-something (use exactly the version shown by the list command)

Then cabal update and install.

cabal v1-update
cabal v1-install PortMidi
(or if it's a GitHub new version, download the repo and just do "cabal v1-install" from where the .cabal file is)

then try the GHCi tests I gave above. If it suddenly works then it's just a matter of PortMidi update in Euterpea.

Disclaimer: I'm typing out all the ghc-pkg and cabal stuff from memory not from actually testing it myself so there may be typos. I also don't know right now if there is a newer PortMidi version. If there isn't and PortMidi is the point of failure, there is nothing I can do really except to recommend just exporting MIDI files of your work with writeMidi instead of using the real-time playback features.


EDIT 1: I should also add that if countDevices returns 0, then you simply have no MIDI devices being recognized and need to have them running before starting GHCi.

EDIT 2: for bifurcate working but devices failing, does bifurcate actually make sound and how are you running it? Compiled?

Following the instructions above, PortMidi gave the same framework not found error. After looking further, there was a ghc issue with frameworks under Big Sur that was resolved in v8.10.3:
https://gitlab.haskell.org/ghc/ghc/-/issues/18446
I installed 8.10.4 and got an accurate device count using Sound.PortMidi (no framework error), but Euterpea won't install under 8.10.4.
There's a suggested workaround for the framework error under pre-8.10.3 here:
https://www.reddit.com/r/haskell/comments/k9r2cy/workaround_for_haskell_woes_on_macos_11_big_sur/
I haven't yet tried to resolve the Euterpea install errors under 8.10.4 or this workaround to get frameworks working under 8.6.

MG-ng commented

For bifurcate working but devices failing, does bifurcate actually make sound and how are you running it? Compiled?

Yeah, you're right.
ghc Bifurcate.lhs and then ./Bifurcate works fine (with fluidsynth running) while
ghci Bifurcate.lhs and then main results in the same error message can't load framework: CoreMIDI (not found)

I got Euterpea working under 8.10.4 with:
cabal install --lib --allow-newer Euterpea