Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation issues on macOS Sonoma 14.5 with GHC 9.4.8 and Cabal 3.10.3.0 #59

Open
Quarkstar opened this issue Jul 16, 2024 · 3 comments

Comments

@Quarkstar
Copy link

Hi! I'm experiencing issues while installing the Euterpea Haskell package on my macOS Sonoma 14.5 system with GHC 9.4.8 and Cabal 3.10.3.0.

The initial issue is a compilation error in the PortMidi 0.2.0.0 package, specifically in the portmidi/pm_mac/pmmacosxcm.c:60:22 file. The error is:

error: incompatible pointer to integer conversion initializing 'MIDIClientRef' (aka 'unsigned int') with an expression of type 'void *' [-Wint-conversion]

To resolve this, I followed the instructions in the PortMidi (https://github.com/PortMidi/portmidi/blob/8efac0cfe6c245aeb2ce5122aa2b82fb79e91463/pm_mac/pmmacosxcm.c#L187), downloaded the PortMidi-Haskell package, and added #define NULL 0 to the portmidi/pm_mac/pmmacosxcm.c file. After doing this, I was able to successfully install the PortMidi-Haskell and Euterpea using cabal v1-install.

However, when I try to import the Euterpea package in GHCi, I encounter a different issue:

λ> import Euterpea

<interactive>:1:1: error:
    attempting to use module ‘main:Euterpea’ (./Euterpea.lhs) which is not loaded
λ> :l Euterpea.lhs
[ 1 of 18] Compiling Control.Arrow.ArrowP ( Control/Arrow/ArrowP.lhs, interpreted )
[ 2 of 18] Compiling Control.SF.SF    ( Control/SF/SF.lhs, interpreted )
[ 3 of 18] Compiling Euterpea.IO.Audio.Types ( Euterpea/IO/Audio/Types.hs, interpreted )
[ 4 of 18] Compiling Euterpea.IO.Audio.IO ( Euterpea/IO/Audio/IO.hs, interpreted )
[ 5 of 18] Compiling Euterpea.IO.MIDI.ExportMidiFile ( Euterpea/IO/MIDI/ExportMidiFile.lhs, interpreted )
[ 6 of 18] Compiling Euterpea.IO.MIDI.MidiIO ( Euterpea/IO/MIDI/MidiIO.lhs, interpreted )

Euterpea/IO/MIDI/MidiIO.lhs:327:5: error:
    parse error (possibly incorrect indentation or mismatched brackets)
    |
327 | >   case m of
    |     ^
[ 7 of 18] Compiling Euterpea.Music   ( Euterpea/Music.lhs, interpreted )
[ 8 of 18] Compiling Euterpea.IO.MIDI.MEvent ( Euterpea/IO/MIDI/MEvent.lhs, interpreted )
[ 9 of 18] Compiling Euterpea.IO.MIDI.GeneralMidi ( Euterpea/IO/MIDI/GeneralMidi.hs, interpreted )
[14 of 18] Compiling Euterpea.IO.Audio.Basics ( Euterpea/IO/Audio/Basics.hs, interpreted )
[15 of 18] Compiling Euterpea.IO.Audio.Render ( Euterpea/IO/Audio/Render.hs, interpreted )
[16 of 18] Compiling Euterpea.IO.Audio.BasicSigFuns ( Euterpea/IO/Audio/BasicSigFuns.lhs, interpreted )
[17 of 18] Compiling Euterpea.IO.Audio ( Euterpea/IO/Audio.hs, interpreted )
Failed, 12 modules loaded.
> deliverMidiEvent :: OutputDeviceID -> MidiEvent -> IO ()
> deliverMidiEvent devId (t,m) = do
>   (pChan, out, _stop) <- getOutDev devId
>   now <- getTimeNow
>   let deliver t m = do
>       if t == 0
>         then out (now,m)
>         else push pChan (now+t) m
>
>   case m of
>     Std m -> deliver t m
>     ANote c k v d -> do
>         deliver t     (NoteOn c k v)
>         deliver (t+d) (NoteOff c k v)

I'm new to Haskell and I found this parse error in the Euterpea/IO/MIDI/MidiIO.lhs file really confusing. Any advice or suggestions would be greatly appreciated.

@donya
Copy link
Member

donya commented Jul 16, 2024

This is a new error to me. Unfortunately it will be a bit before I can dig into this. At a glance this looks like it may be outside the scope of Euterpea's code base and therefore might not be something I can fix directly. Since it's a failure within PortMidi I would suggest also creating an issue here: https://github.com/PortMidi/PortMidi-haskell

In the mean time, I don't know if this will help or not with what you're trying to do with Euterpea, but if you don't mind writing MIDI files and playing them through another program (like MuseScore or a DAW) instead of using the "play" function to do it directly through a synth, you can try EuterpeaLite instead and avoid the whole PortMidi installation.

Also it's unclear to me if you used the --allow-newer flag? If not, give that a try.

@ludflu
Copy link

ludflu commented Aug 6, 2024

I actually just fixed this issue in PortMidi, and my PR has been approved, but its not merged yet. PortMidi/PortMidi-haskell#21

@amordahl
Copy link

@ludflu Were you able to fix this? I am experiencing the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants