christofmuc / KnobKraft-orm

The KnobKraft Orm - The free modern cross-platform MIDI Sysex Librarian
GNU Affero General Public License v3.0
207 stars 27 forks source link

Mac build issues #315

Closed redconfetti closed 7 months ago

redconfetti commented 8 months ago

I'm new here, and have tried to read the docs to make sure I'm doing things right. I intend to create an Adaptation for the Alesis QSR (Quadrasynth rack module). I'm not sure if getting a build environment is necessary for Adaptations. They appear to be Python powered, not C++.

ICU4c Version Updated

I ran into an issue with the ICU path. This was resolved by updating the ICU_ROOT path to reflect the current version installed by Homebrew, 74.2.

set(ICU_ROOT "/opt/homebrew/Cellar/icu4c/74.2")

Header Not Found

However now I'm running into an issue during the build where an ICU related header isn't being found.

$ cmake --build builds/release
[  7%] Built target juce-static
[  9%] Built target gin
[ 12%] Built target nlohmann_json_schema_validator
[ 13%] Built target fmt
[ 16%] Built target spdlog
[ 26%] Built target juce-utils
[ 38%] Built target juce-widgets
[ 45%] Built target midikraft-base
[ 50%] Built target midikraft-librarian
[ 52%] Built target midikraft-database
[ 53%] Built target midikraft-access-virus
[ 55%] Built target midikraft-behringer-bcr2000
[ 58%] Built target midikraft-kawai-k3
[ 58%] Building CXX object synths/oberheim-matrix1000/CMakeFiles/midikraft-oberheim-matrix1000.dir/Matrix1000Patch.cpp.o
/Users/jason/Developer/KnobKraft-orm/synths/oberheim-matrix1000/Matrix1000Patch.cpp:13:10: fatal error: 'unicode/ucnv.h' file not found
#include <unicode/ucnv.h>
         ^~~~~~~~~~~~~~~~
1 error generated.
gmake[2]: *** [synths/oberheim-matrix1000/CMakeFiles/midikraft-oberheim-matrix1000.dir/build.make:118: synths/oberheim-matrix1000/CMakeFiles/midikraft-oberheim-matrix1000.dir/Matrix1000Patch.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1048: synths/oberheim-matrix1000/CMakeFiles/midikraft-oberheim-matrix1000.dir/all] Error 2
gmake: *** [Makefile:156: all] Error 2

If I comment out the header include, I get these errors:

/Users/jason/Developer/KnobKraft-orm/synths/oberheim-matrix1000/Matrix1000Patch.cpp:45:3: error: unknown type name 'UErrorCode'
                UErrorCode error = U_ZERO_ERROR;
                ^
/Users/jason/Developer/KnobKraft-orm/synths/oberheim-matrix1000/Matrix1000Patch.cpp:45:22: error: use of undeclared identifier 'U_ZERO_ERROR'
                UErrorCode error = U_ZERO_ERROR;
                                   ^

I am a Ruby dev, not a C++ dev, so I'm not very adept at resolving what might be a minor build issue.

I figure that the version change to 74.2 caused this. I see that the ucnv.h still exists in that release.

Rollback ICU4c Version

I explored installing an older version of the icu4c library, but that doesn't appear available with Homebrew

$ brew install icu4c@72.1
Warning: No available formula with the name "icu4c@72.1". Did you mean icu4c?
==> Searching for similarly named formulae and casks...
==> Formulae
icu4c

To install icu4c, run:
  brew install icu4c

$ brew search icu4c
==> Formulae
icu4c

$ brew info icu4c
==> icu4c: stable 74.2 (bottled) [keg-only]
C/C++ and Java libraries for Unicode and globalization
https://icu.unicode.org/home
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/i/icu4c.rb
License: ICU
==> Caveats
icu4c is keg-only, which means it was not symlinked into /opt/homebrew,
because macOS provides libicucore.dylib (but nothing else).
==> Analytics
install: 241,833 (30 days), 479,950 (90 days), 1,921,954 (365 days)
install-on-request: 13,698 (30 days), 19,976 (90 days), 66,875 (365 days)
build-error: 39 (30 days)

I don't see the Adaptation programming guide mentioning that you need a build environment. It sounds like the application makes use of Python adaptations, so I'm going to just try to use a published build for now. I'm leaving my notes here just in case it helps others.

christofmuc commented 8 months ago

Thank you! I need to have a look, probably some change in the ICU library as you mentioned.

And you're correct, to make a new adaptation you only need Python - the C++ code will load the Python module as a "driver" to parse and compose MIDI messages to talk to the synth.

christofmuc commented 8 months ago

The .github/workflows/builds-macos.yml contains the following code.

  brew reinstall icu4c

and does the configure with

cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_PREFIX_PATH=/usr/local/Cellar/icu4c/73.2

This is missing from the documentation, but then again the code always wins anyway. I use the macos-latest build machines from github.

christofmuc commented 7 months ago

@redconfetti Thanks again for all the info and work! I have updated the documentation and the build files to make it easier to find the right icu4c version, but sadly there is a difference between Intel Macs and Apple Silicon Macs on where to search for it, so I made a comment in the README and the CMakeLists.txt to clarify this further.

let me know if you need any help with the adaptation you're planning!