-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
When building the PortMidi-0.2.0.0 Haskell package with GHC 9.8.4 on macOS Sequoia, the build process fails during the compilation of the C code in pmmacosxcm.c. The errors are related to incompatible pointer to integer conversions for CoreMIDI types such as MIDIClientRef, MIDIPortRef, and MIDIEndpointRef.
For example, the following errors are reported:
/private/var/folders/sb/5rkt9wkx1cjfv5mmfk1llypw0000gp/T/stack-2b682c2295e963b9/PortMidi-0.2.0.0/portmidi/pm_mac/pmmacosxcm.c:60:22: error:
error: incompatible pointer to integer conversion initializing 'MIDIClientRef' (aka 'unsigned int') with an expression of type 'void *' [-Wint-conversion]
60 | static MIDIClientRef client = NULL; /* Client handle to the MIDI server */
| ^ ~~~~
|
60 | static MIDIClientRef client = NULL; /* Client handle to the MIDI server */
| ^
Similar errors occur for MIDIPortRef, MIDIEndpointRef, MIDIEntityRef, and MIDIDeviceRef.
This issue arises because, in newer versions of macOS, CoreMIDI types like MIDIClientRef are defined as unsigned int, whereas the PortMidi C code still initializes them with NULL, which is a pointer. This mismatch causes the build to fail.
Steps to Reproduce:
- Clone the PortMidi-haskell repository.
- Use Stack or Cabal to build the PortMidi-0.2.0.0 package on macOS with GHC 9.8.4 (Stack lts-23.24).
- Observe the build failure with the errors listed below.
Full logs
PortMidi> configure
PortMidi> Warning: PortMidi.cabal:30:34: version operators used. To use version
PortMidi> operators the package needs to specify at least 'cabal-version: >= 1.8'.
PortMidi> Configuring PortMidi-0.2.0.0...
PortMidi> build with ghc-9.8.4
PortMidi> Preprocessing library for PortMidi-0.2.0.0..
PortMidi> Building library for PortMidi-0.2.0.0..
PortMidi> [1 of 2] Compiling Sound.PortMidi.DeviceInfo
PortMidi> [2 of 2] Compiling Sound.PortMidi
PortMidi>
PortMidi> /private/var/folders/sb/5rkt9wkx1cjfv5mmfk1llypw0000gp/T/stack-2b682c2295e963b9/PortMidi-0.2.0.0/portmidi/pm_mac/pmmacosxcm.c:60:22: error:
PortMidi> error: incompatible pointer to integer conversion initializing 'MIDIClientRef' (aka 'unsigned int') with an expression of type 'void *' [-Wint-conversion]
PortMidi> 60 | static MIDIClientRef client = NULL; /* Client handle to the MIDI server */
PortMidi> | ^ ~~~~
PortMidi> |
PortMidi> 60 | static MIDIClientRef client = NULL; /* Client handle to the MIDI server */
PortMidi> | ^
PortMidi>
PortMidi> /private/var/folders/sb/5rkt9wkx1cjfv5mmfk1llypw0000gp/T/stack-2b682c2295e963b9/PortMidi-0.2.0.0/portmidi/pm_mac/pmmacosxcm.c:61:20: error:
PortMidi> error: incompatible pointer to integer conversion initializing 'MIDIPortRef' (aka 'unsigned int') with an expression of type 'void *' [-Wint-conversion]
PortMidi> 61 | static MIDIPortRef portIn = NULL; /* Input port handle */
PortMidi> | ^ ~~~~
PortMidi> |
PortMidi> 61 | static MIDIPortRef portIn = NULL; /* Input port handle */
PortMidi> | ^
PortMidi>
PortMidi> /private/var/folders/sb/5rkt9wkx1cjfv5mmfk1llypw0000gp/T/stack-2b682c2295e963b9/PortMidi-0.2.0.0/portmidi/pm_mac/pmmacosxcm.c:62:20: error:
PortMidi> error: incompatible pointer to integer conversion initializing 'MIDIPortRef' (aka 'unsigned int') with an expression of type 'void *' [-Wint-conversion]
PortMidi> 62 | static MIDIPortRef portOut = NULL; /* Output port handle */
PortMidi> | ^ ~~~~
PortMidi> |
PortMidi> 62 | static MIDIPortRef portOut = NULL; /* Output port handle */
PortMidi> | ^
PortMidi>
PortMidi> /private/var/folders/sb/5rkt9wkx1cjfv5mmfk1llypw0000gp/T/stack-2b682c2295e963b9/PortMidi-0.2.0.0/portmidi/pm_mac/pmmacosxcm.c:307:16: error:
PortMidi> warning: cast to smaller integer type 'MIDIEndpointRef' (aka 'unsigned int') from 'void *' [-Wvoid-pointer-to-int-cast]
PortMidi> 307 | endpoint = (MIDIEndpointRef) descriptors[midi->device_id].descriptor;
PortMidi> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PortMidi> |
PortMidi> 307 | endpoint = (MIDIEndpointRef) descriptors[midi->device_id].descriptor;
PortMidi> | ^
PortMidi>
PortMidi> /private/var/folders/sb/5rkt9wkx1cjfv5mmfk1llypw0000gp/T/stack-2b682c2295e963b9/PortMidi-0.2.0.0/portmidi/pm_mac/pmmacosxcm.c:308:18: error:
PortMidi> warning: comparison between pointer and integer ('MIDIEndpointRef' (aka 'unsigned int') and 'void *') [-Wpointer-integer-compare]
PortMidi> 308 | if (endpoint == NULL) {
PortMidi> | ~~~~~~~~ ^ ~~~~
PortMidi> |
PortMidi> 308 | if (endpoint == NULL) {
PortMidi> | ^
PortMidi>
PortMidi> /private/var/folders/sb/5rkt9wkx1cjfv5mmfk1llypw0000gp/T/stack-2b682c2295e963b9/PortMidi-0.2.0.0/portmidi/pm_mac/pmmacosxcm.c:336:17: error:
PortMidi> warning: values of type 'OSStatus' should not be used as format arguments; add an explicit cast to 'int' instead [-Wformat]
PortMidi> 335 | "Host error %ld: MIDIPortConnectSource() in midi_in_open()",
PortMidi> | ~~~
PortMidi> | %d
PortMidi> 336 | macHostError);
PortMidi> | ^~~~~~~~~~~~
PortMidi> | (int)
PortMidi> |
PortMidi> 336 | macHostError);
PortMidi> | ^
PortMidi>
PortMidi> /private/var/folders/sb/5rkt9wkx1cjfv5mmfk1llypw0000gp/T/stack-2b682c2295e963b9/PortMidi-0.2.0.0//Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:50:56: error:
PortMidi> note: expanded from macro 'sprintf'
PortMidi> 50 | __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
PortMidi> | ^~~~~~~~~~~
PortMidi> |
PortMidi> 50 | __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
PortMidi> | ^
PortMidi>
PortMidi> /private/var/folders/sb/5rkt9wkx1cjfv5mmfk1llypw0000gp/T/stack-2b682c2295e963b9/PortMidi-0.2.0.0/portmidi/pm_mac/pmmacosxcm.c:356:16: error:
PortMidi> warning: cast to smaller integer type 'MIDIEndpointRef' (aka 'unsigned int') from 'void *' [-Wvoid-pointer-to-int-cast]
PortMidi> 356 | endpoint = (MIDIEndpointRef) descriptors[midi->device_id].descriptor;
PortMidi> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PortMidi> |
PortMidi> 356 | endpoint = (MIDIEndpointRef) descriptors[midi->device_id].descriptor;
PortMidi> | ^
PortMidi>
PortMidi> /private/var/folders/sb/5rkt9wkx1cjfv5mmfk1llypw0000gp/T/stack-2b682c2295e963b9/PortMidi-0.2.0.0/portmidi/pm_mac/pmmacosxcm.c:357:18: error:
PortMidi> warning: comparison between pointer and integer ('MIDIEndpointRef' (aka 'unsigned int') and 'void *') [-Wpointer-integer-compare]
PortMidi> 357 | if (endpoint == NULL) {
PortMidi> | ~~~~~~~~ ^ ~~~~
PortMidi> |
PortMidi> 357 | if (endpoint == NULL) {
PortMidi> | ^
PortMidi>
PortMidi> /private/var/folders/sb/5rkt9wkx1cjfv5mmfk1llypw0000gp/T/stack-2b682c2295e963b9/PortMidi-0.2.0.0/portmidi/pm_mac/pmmacosxcm.c:367:17: error:
PortMidi> warning: values of type 'OSStatus' should not be used as format arguments; add an explicit cast to 'int' instead [-Wformat]
PortMidi> 366 | "Host error %ld: MIDIPortDisconnectSource() in midi_in_close()",
PortMidi> | ~~~
PortMidi> | %d
PortMidi> 367 | macHostError);
PortMidi> | ^~~~~~~~~~~~
PortMidi> | (int)
PortMidi> |
PortMidi> 367 | macHostError);
PortMidi> | ^
PortMidi>
PortMidi> /private/var/folders/sb/5rkt9wkx1cjfv5mmfk1llypw0000gp/T/stack-2b682c2295e963b9/PortMidi-0.2.0.0//Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:50:56: error:
PortMidi> note: expanded from macro 'sprintf'
PortMidi> 50 | __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
PortMidi> | ^~~~~~~~~~~
PortMidi> |
PortMidi> 50 | __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
PortMidi> | ^
PortMidi>
PortMidi> /private/var/folders/sb/5rkt9wkx1cjfv5mmfk1llypw0000gp/T/stack-2b682c2295e963b9/PortMidi-0.2.0.0/portmidi/pm_mac/pmmacosxcm.c:431:13: error:
PortMidi> warning: cast to smaller integer type 'MIDIEndpointRef' (aka 'unsigned int') from 'void *' [-Wvoid-pointer-to-int-cast]
PortMidi> 431 | (MIDIEndpointRef) descriptors[midi->device_id].descriptor;
PortMidi> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PortMidi> |
PortMidi> 431 | (MIDIEndpointRef) descriptors[midi->device_id].descriptor;
PortMidi> | ^
PortMidi>
PortMidi> /private/var/folders/sb/5rkt9wkx1cjfv5mmfk1llypw0000gp/T/stack-2b682c2295e963b9/PortMidi-0.2.0.0/portmidi/pm_mac/pmmacosxcm.c:446:13: error:
PortMidi> warning: values of type 'OSStatus' should not be used as format arguments; add an explicit cast to 'int' instead [-Wformat]
PortMidi> 445 | "Host error %ld: MIDISend() in midi_write()",
PortMidi> | ~~~
PortMidi> | %d
PortMidi> 446 | macHostError);
PortMidi> | ^~~~~~~~~~~~
PortMidi> | (int)
PortMidi> |
PortMidi> 446 | macHostError);
PortMidi> | ^
PortMidi>
PortMidi> /private/var/folders/sb/5rkt9wkx1cjfv5mmfk1llypw0000gp/T/stack-2b682c2295e963b9/PortMidi-0.2.0.0//Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/secure/_stdio.h:50:56: error:
PortMidi> note: expanded from macro 'sprintf'
PortMidi> 50 | __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
PortMidi> | ^~~~~~~~~~~
PortMidi> |
PortMidi> 50 | __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
PortMidi> | ^
PortMidi>
PortMidi> /private/var/folders/sb/5rkt9wkx1cjfv5mmfk1llypw0000gp/T/stack-2b682c2295e963b9/PortMidi-0.2.0.0/portmidi/pm_mac/pmmacosxcm.c:651:17: error:
PortMidi> error: incompatible pointer to integer conversion initializing 'MIDIEntityRef' (aka 'unsigned int') with an expression of type 'void *' [-Wint-conversion]
PortMidi> 651 | MIDIEntityRef entity = NULL;
PortMidi> | ^ ~~~~
PortMidi> |
PortMidi> 651 | MIDIEntityRef entity = NULL;
PortMidi> | ^
PortMidi>
PortMidi> /private/var/folders/sb/5rkt9wkx1cjfv5mmfk1llypw0000gp/T/stack-2b682c2295e963b9/PortMidi-0.2.0.0/portmidi/pm_mac/pmmacosxcm.c:653:14: error:
PortMidi> warning: comparison between pointer and integer ('MIDIEntityRef' (aka 'unsigned int') and 'void *') [-Wpointer-integer-compare]
PortMidi> 653 | if (entity == NULL)
PortMidi> | ~~~~~~ ^ ~~~~
PortMidi> |
PortMidi> 653 | if (entity == NULL)
PortMidi> | ^
PortMidi>
PortMidi> /private/var/folders/sb/5rkt9wkx1cjfv5mmfk1llypw0000gp/T/stack-2b682c2295e963b9/PortMidi-0.2.0.0/portmidi/pm_mac/pmmacosxcm.c:667:17: error:
PortMidi> error: incompatible pointer to integer conversion initializing 'MIDIDeviceRef' (aka 'unsigned int') with an expression of type 'void *' [-Wint-conversion]
PortMidi> 667 | MIDIDeviceRef device = NULL;
PortMidi> | ^ ~~~~
PortMidi> |
PortMidi> 667 | MIDIDeviceRef device = NULL;
PortMidi> | ^
PortMidi>
PortMidi> /private/var/folders/sb/5rkt9wkx1cjfv5mmfk1llypw0000gp/T/stack-2b682c2295e963b9/PortMidi-0.2.0.0/portmidi/pm_mac/pmmacosxcm.c:669:14: error:
PortMidi> warning: comparison between pointer and integer ('MIDIDeviceRef' (aka 'unsigned int') and 'void *') [-Wpointer-integer-compare]
PortMidi> 669 | if (device == NULL)
PortMidi> | ~~~~~~ ^ ~~~~
PortMidi> |
PortMidi> 669 | if (device == NULL)
PortMidi> | ^
PortMidi>
PortMidi> /private/var/folders/sb/5rkt9wkx1cjfv部分 of the build log omitted for brevity, but included in the full issue report on GitHub]
PortMidi> 18 warnings and 5 errors generated.
PortMidi> `gcc' failed in phase `C Compiler'. (Exit code: 1)
Metadata
Metadata
Assignees
Labels
No labels