-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Compiling on Macs with Apple Silicon
It is not yet possible to create a native Apple Silicon (ARM) build, mainly because Qt 5.15 (which we are using) does not support ARM yet. Therefore, you need to build in Intel mode, and then run under Rosetta 2.
The safest way to start with is then to create a dedicated I386 arch shell as follow :
At least on osx 13 duplicating the Apple terminal and make it rue in i386 mode is not supported ; so I suggest here to download Iterm2 i386 shell(or any other supporting running in I386 arch mode)
- Next, using Finder navigate to Application and Locate Iterm App
- Right click on it and chose duplicate.
- Rename the duplicated Iterm to 'Item Rosetta'
- Right click again on it and choose 'Get info'
- Inside the info panel check 'Open using Rosetta'
You're done here I just suggest to Put this new rosetta term on your navigation bar close to your standard term. Click on it to open a new term and enter 'arch' command => it should display I386 (entéring 'arch' command on your standard M1 term would show : Arm64
All our commands starting from now will be entered in the Rosetta Iterm
Unless you really need it and deeply know what you're doing I advise you not to have dual (are/I386 brew system installed At a given time you will do a mistake which will leed you to a corrupted instable brew system). if you already have an arm brew installed (arm brew is installed in /opt directory) just dump it and uninstall it. Then in the Rosetta Iterm install and I386 brew and restore your packages in it( i386 new will install package in /usr/local)
IMPORTANT : all commands bellow should be executed in Rosetta Iterm
- Install HomeBrew in I386 mode in rosetta Iterm :
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Install requested dependencies : brew install cmake ninja git pkg-config libsndfile
This way the linker will be happy having pkg-config and libsndfile in i386 mode and having other brew command running in i386 mode would not be a problem compared to the the mess of managing brew multiple modes ( NB : you will only need arm brew if you are also having other development library requesting link in arm )
Install Qt in the same way as described here: Install Qt and Qt Creator.
You can now ignore the next paragraphs and jump directly to 'compiling MuseScore'
IMPORTANT : **YOU SHOULD RUN ALL FOLLOWING MuseScore build command in the Rosetta Iterm as well **
Build tools like CMake, Ninja and Git can be installed in ARM mode.
- Install HomeBrew in ARM mode:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Follow the instructions that appear after running this command.
- Install CMake, Ninja and Git:
brew install cmake ninja git
Install Qt in the same way as described here: Install Qt and Qt Creator.
MuseScore depends on a package called SndFile
. Because you are building MuseScore in x86_64 mode, you need to install this package in that mode too, otherwise, it will cause linker errors. You can use arch -x86_64 command
to run command
in x86_64 mode. This should ask you to install Rosetta 2 if you haven't done that yet.
HomeBrew behaves differently in x86_64 mode. In ARM mode, it puts its packages in /opt/homebrew/bin
. In x86_64 mode, it puts packages in /usr/local/bin
. If you installed HomeBrew correctly, /opt/homebrew/bin
should appear in the $PATH
variable before /usr/local/bin
. This means that your shell will first look in /opt/homebrew/bin
when searching for the brew
command or any packages installed by it, so by default the ARM version will be used. If you want to use the x86_64 version instead, you need to prepend /usr/local/bin
to the $PATH variable. You can do that by prepending PATH=/usr/local/bin:$PATH
to a command (or by running export PATH=/usr/local/bin:$PATH
, but that will affect all future commands you run in that shell). Note the use of colons here (:
) instead of semicolons.
- Install HomeBrew in x86_64 mode:
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Install pkg-config and libsndfile in x86_64 mode:
PATH=/usr/local/bin:$PATH arch -x86_64 brew install pkg-config libsndfile
Now that we have these things installed, we can start building MuseScore.
# Inside the MuseScore source code directory:
PATH_TO_QT=~/Qt/5.15.2/clang_64/bin # This is the default location, but it might be different for you
PATH=$PATH_TO_QT:/usr/local/bin:$PATH ./build.cmake
Note that the body of this command is just ./build.cmake
. For information about this script, see Compile on the command line.
The rest of the command makes sure that the $PATH variable is set correctly. When cmake searches for a package, it will look in the directories mentioned in $PATH one by one. So when it looks for Qt, it will first look in the first directory, where it will immediately find Qt, because the first directory was the Qt directory. When it then looks for pkg-config and libsndfile, it won't find them in the first directory (that was the Qt directory), but it will find them in the second directory, which is where HomeBrew installed them. When it would look for, for example, Ninja, it won't find it in the first two directories, but then it will look in /opt/homebrew/bin, and there it will be found.
You probably don't want to specify those PATHs every time you run the script. As described on the page about build.cmake, you can also specify these things in a build_overrides.cmake
file:
set(ENV{QTDIR} "$ENV{HOME}/Qt/5.15.2/clang_64") # or wherever Qt is located; note that we are not adding "/bin" to the path
set(ENV{PATH} "/usr/local/bin:$ENV{PATH}")
After performing these steps, you should also be able to compile MuseScore in Qt Creator, following these instructions: Compile in Qt Creator.
Testing
- Manual testing
- Automatic testing
Translation
Compilation
- Set up developer environment
- Install Qt and Qt Creator
- Get MuseScore's source code
- Install dependencies
- Compile on the command line
- Compile in Qt Creator
Beyond compiling
Misc. development
Architecture general
- Architecture overview
- AppShell
- Modularity
- Interact workflow
- Channels and Notifications
- Settings and Configuration
- Error handling
- Launcher and Interactive
- Keyboard Navigation
Audio
Engraving
- Style settings
- Working with style files
- Style parameter changes for 4.0
- Style parameter changes for 4.1
- Style parameter changes for 4.2
- Style parameter changes for 4.3
- Style parameter changes for 4.4
Extensions
- Extensions overview
- Manifest
- Forms
- Macros
- Api
- Legacy plugin API
Google Summer of Code
References