lenmus / lenmus

LenMus Phonascus is a free open source program (GPL v3) for learning music. It allows you to focus on specific skills and exercises, on both theory and aural training. The different activities can be customized to meet your needs.
http://www.lenmus.org/
GNU General Public License v3.0
76 stars 15 forks source link

macOS package for distribution to other machines #126

Open blurbler27 opened 3 years ago

blurbler27 commented 3 years ago

I've been trying to compile a macOS package that could be passed on to other mac users who do not wish to compile the program themselves, since it's a little complicated on a Mac. Initial attempts resulted in a package that would not run on other Macs.

I have been working on Catalina, but I used the VirtualBox program to create three virtual Macs on my machine for test purposes -- (1) with full Xcode installed, (2) with only the Xcode command line tools, and (3) with no additional packages whatsoever. I installed High Sierra on these virtual machines rather than the latest version of macOS. (Actually I did one basic installation, cloned it twice, and added the additional packages to two of the virtual machines.)

On virtual machine (1), I did a complete compilation of wxWidgets, downloaded the additional packages necessary, and compiled LenMus into a macOS package. The resulting macOS package would run correctly on virtual machine (1) and my host machine, but not on virtual machines (2) or (3). I am attaching a typical crash report. crashRep.txt

Since the macOS package contains all necessary libraries, it seemed clear that some configuration files found on virtual machine (1) and the host machine were missing. Since I had the Xcode command line tools installed on virtual machine (2) I was able to run the program under the command line debugger and get a little more information. (Somewhat limited since the source code was not on virtual machine (2).) Anyway, under the command line debugger I got the additional message: Fontconfig error: cannot load default config file so there are presumably some config files belonging to the "fontconfig" package (which is not a default package on macOS. I installed the homebrew fontconfig package on the host machine and virtual machine (1).)

To fix this error, we need to find where the fontconfig libraries are looking for their config files, put suitable config files in the macOS package, and tell the fontconfig libraries where to look. I'll need to do a little research on this, but if anyone knows, it could save me some time.

There may be some other config files that are missing, but this setup should make finding them much easier.

cecilios commented 3 years ago

Thank you for this extensive report and for your efforts.

LenMus uses fontconfig to look for fonts, and fontconfig uses configuration files provided with the fontconfig package for each platform. fontconfig is a Linux package, that also works in Windows and Mac, but as it is not normally used Windows and Mac, probably it is not well maintained in those platforms.

To my knowledge, LenMus is not configured to use fontconfig in Mac. Please check that when building your build is compiling file _lomseother.cpp and not _lomselinux.cpp. The file to use is decided in file "lenmus/lomse"trunk/add-sources.cmake". This file is used by cmake when configuring the project. In line 228 it is decided which source file to use: _lomselinux.cpp, _lomsewindows.cpp or _lomseother.cpp.

blurbler27 commented 3 years ago

You're right. _lomselinux.cpp is being used. In add-sources.cmake I see:

if(UNIX)
    set(PLATFORM_FILES
        ${LOMSE_SRC_DIR}/platform/lomse_linux.cpp
    )
elseif(WIN32)
    set(PLATFORM_FILES
        ${LOMSE_SRC_DIR}/platform/lomse_windows.cpp
    )
else()
    set(PLATFORM_FILES
        ${LOMSE_SRC_DIR}/platform/lomse_other.cpp
    )
endif()

The quickest way to fix this would be to change the first line to if(UNIX AND NOT APPLE). I just quickly tried this and am now getting a different error (apparently related to audio support). I'll look at the differences between these two files to see if I can get a better idea of what's going on.

cecilios commented 3 years ago

The quickest way to fix this would be to change the first line to if(UNIX AND NOT APPLE).

Yes, that's the right fix