Skip to content

Instantly share code, notes, and snippets.

@cfstras
Last active February 25, 2022 03:22
Show Gist options
  • Save cfstras/f741087c77a899d5f77eb4664c5b4a70 to your computer and use it in GitHub Desktop.
Save cfstras/f741087c77a899d5f77eb4664c5b4a70 to your computer and use it in GitHub Desktop.
Script to compile mumble natively on an M1 Mac (using my branch cfstras/mumble:arm-m1-mac)
#!/bin/bash
# Notes on building Mumble on an M1 mac
set -euo pipefail
ARM=(arch -arm64)
BREW=(
/opt/homebrew/bin/brew
)
BUILD_DIR=build
FLAGS=(
# add this if you want to build and debug with XCode
#-G Xcode
-Dice=off
# Build with debug or release
-DCMAKE_BUILD_TYPE=Release
)
## If you want error output...
#export VERBOSE=1
function install_packages() {
function brewUp() {
if "${BREW[@]}" ls --versions "$1"; then
"${BREW[@]}" upgrade "$1"
else
"${BREW[@]}" install "$1"
fi
}
"${BREW[@]}" update
export HOMEBREW_NO_AUTO_UPDATE=1
brewUp cmake
brewUp pkg-config
brewUp qt5
brewUp boost
brewUp libogg
brewUp libvorbis
brewUp flac
brewUp libsndfile
brewUp protobuf
brewUp openssl
brewUp ice
}
make_links() {
if [[ -f /opt/homebrew/opt/qt5/ ]]; then
sudo ln -fs /opt/homebrew/opt /usr/local/opt
fi
}
function clean() {
rm -rf $BUILD_DIR
}
function mkdirs() {
mkdir -p $BUILD_DIR
cd $BUILD_DIR
}
function configure() {
"${ARM[@]}" cmake "${FLAGS[@]}" ..
}
function build() {
"${ARM[@]}" cmake --build . -j5
}
(
set -x
## You can comment-out individual steps if you don't want to re-run them.
install_packages
clean
mkdirs
make_links
configure
build
)
echo
echo "Done! your app is in $BUILD_DIR/Mumble.app"
echo "... (Or, if you built with XCode, in build/Debug/Mumble.app/Contents/MacOS/Mumble)"
@jason-green-io
Copy link

Has anything changed for this script to longer work?

CMake Error at cmake/qt-utils.cmake:6 (include):
  include could not find requested file:

    FindPythonInterpreter
Call Stack (most recent call first):
  src/mumble/CMakeLists.txt:17 (include)


-- Qt5 component found: Concurrent | Version: 5.15.2
-- Qt5 component found: Sql | Version: 5.15.2
-- Qt5 component found: Svg | Version: 5.15.2
-- Qt5 component found: Widgets | Version: 5.15.2
INSTALL TARGETS - target mumble has RESOURCE files but no RESOURCE DESTINATION.
-- Poco component not found: Zip
-- Regular Poco search failed - looking for Poco include dir manually...
CMake Error at src/mumble/CMakeLists.txt:410 (message):
  Unable to locate Poco include directory


-- Configuring incomplete, errors occurred!
See also "/Users/Shared/mumble/build/CMakeFiles/CMakeOutput.log".
See also "/Users/Shared/mumble/build/CMakeFiles/CMakeError.log".

@cfstras
Copy link
Author

cfstras commented Jun 14, 2021

@jason-green-io you might need to install python and/or python3 using brew install, I forgot to put it into the script since I already had it installed.

@jason-green-io
Copy link

I have those installed already as well:

greener@enderdragon mumble % brew install python3
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> Updated Formulae
Updated 21 formulae.
==> New Casks
sparrow
==> Updated Casks
Updated 22 casks.

Warning: python@3.9 3.9.5 is already installed and up-to-date.
To reinstall 3.9.5, run:
  brew reinstall python@3.9
greener@enderdragon mumble % brew install python 
Warning: python@3.9 3.9.5 is already installed and up-to-date.
To reinstall 3.9.5, run:
  brew reinstall python@3.9
greener@enderdragon mumble %

@jason-green-io
Copy link

jason-green-io commented Jun 14, 2021

Newer cmake uses a different module to find python.

Progress:

greener@enderdragon mumble % git diff cmake/qt-utils.cmake 
diff --git a/cmake/qt-utils.cmake b/cmake/qt-utils.cmake
index fc7327540..707128ef5 100644
--- a/cmake/qt-utils.cmake
+++ b/cmake/qt-utils.cmake
@@ -3,7 +3,7 @@
 # that can be found in the LICENSE file at the root of the
 # Mumble source tree or at <https://www.mumble.info/LICENSE>.
 
-include(FindPythonInterpreter)
+include(FindPython3)
 
 function(include_qt_plugin TARGET SCOPE PLUGIN)
        set(PATH "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_plugin_import.cpp")

Now onto poco which doesn't seem available for aarm64 on brew.

Edit: poco not pogo

@jason-green-io
Copy link

brew install --build-from-source poco

Smooth sailing from then on.

@tristan-k
Copy link

Can someone provide a binary for M1? I'm running a 256GB base model and I'm already low on disk space. So I would like to avoid installing all the dependencies.

@cfstras
Copy link
Author

cfstras commented Sep 11, 2021

@tristan-k I recommend using the regular amd64 version with rosetta. The native build still has a lot of problems that make it pretty unusable (crashes when switching audio devices, no hotkey support, …)
See „Caveats“ here: mumble-voip/mumble#4765

@tristan-k
Copy link

Thanks for the heads-up. I guess will have to wait then. If you need someone for testing just holler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment