Code Monkey home page Code Monkey logo

m1xxx's Introduction

M1xxx

Build

Note

Official snapshot builds of Mixxx for Apple Silicon are now available for download here. These are recommended for most users and can also be installed via Homebrew:

brew tap homebrew/cask-versions
brew install --cask mixxx-snapshot

Unofficial snapshot builds of the free and open source DJ software Mixxx for macOS (arm64/Apple Silicon, x86-64/Intel) and Linux (x86-64).

Screenshot

Installation

Get the most recent binaries from GitHub Releases here.

Alternatively you can install m1xxx via Homebrew using

brew tap fwcd/fwcd
brew install --cask m1xxx

This has the additional advantage of making it easy to upgrade or remove m1xxx.

Background

Mixxx traditionally only provided builds for x86-64 macOS. While these run fine under Rosetta 2, native Mixxx builds for arm64 run at roughly half the CPU load and feel noticeably more snappy than the x86-64 version.

This repo provides native builds for arm64 that are cross-compiled from GitHub's x86-64 Actions runners.

Upstreaming process

Both the mixxx and the vcpkg branch now use the official upstream revisions.

Building natively on Apple Silicon (arm64 macOS) hosts

While the CI workflows in this repo mainly deal with the case of cross-compiling Mixxx from x86-64 macOS runners to arm64, it is also possible to compile directly from an arm64 macOS (Apple Silicon) host.

First, make sure to have Homebrew installed and the submodules in this repo checked out (using git submodule update). To install the system dependencies, run:

scripts/install-macos-deps

To compile and install Mixxx's dependencies into vcpkg run:

scripts/bootstrap-vcpkg
scripts/install-vcpkg-deps

Note

If vcpkg produces a 'missing Python' error message, make sure to have python on your PATH, e.g. by symlinking it to python3 with ln -s /opt/homebrew/bin/python3 /usr/local/bin/python.

To build Mixxx, run:

scripts/configure-mixxx
scripts/build-mixxx

Credits

Thanks to daschuer for the work involved in backporting the relevant Qt patches, parts of the CI workflows and assistance in building the dependencies!

m1xxx's People

Contributors

fwcd avatar github-actions[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

m1xxx's Issues

Automatically bump `mixxx` on 2.4 branch

Since scheduled GitHub workflows unfortunately only run on the default branch, we'd have to modify main's workflow accordingly, e.g.

diff --git a/.github/workflows/update-mixxx.yml b/.github/workflows/update-mixxx.yml
index 0715f62..500cc06 100644
--- a/.github/workflows/update-mixxx.yml
+++ b/.github/workflows/update-mixxx.yml
@@ -9,10 +9,14 @@ on:
 jobs:
   automerge:
     runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        branch: ['2.4', 'main']
 
     steps:
     - uses: actions/checkout@v3
       with:
+        ref: '${{ matrix.branch }}'
         fetch-depth: '0' # to compute the monotonic version correctly
         submodules: true
     - name: Configure Git user

The issue is that the build currently depends on a workflow_run trigger, for which I am not sure if it triggers in the way we would expect across branches: Given that the scheduled workflows run on main, 2.4's build workflow would likely not end up being triggered. We might be able to work around that by using e.g. a repository_dispatch event, but I am not sure if workflows on non-default branches will receive these events. This would be something to investigate.

m2?

Probably a silly question, but I am new to mac world so not sure: will m1xxx fork work for m2 (macbook air 2022)?

Port Mixxx to Emscripten/WebAssembly

Status

The wasm branch contains experimental forks of mixxx and vcpkg for targeting wasm32-emscripten.

You can try it out, there is a GitHub Pages-hosted build at https://fwcd.dev/m1xxx, but be warned: It may take a while to load (tne Wasm binary is ~300 MB, the assets are ~90 MB) and there is no audio (the experimental "Web Audio" backend is not functional yet, hence why it is disabled by default).

Screenshot

On the technical side, there are still some major roadblocks to be resolved:

Something to investigate would be whether we could replace -sASYNCIFY entirely with -sPROXY_TO_PTHREAD, i.e. move the "main" thread to a Web Worker where we can block synchronously. Unfortunately, there seem to be some complexities involved in making this work with Qt:

We may have to check whether setting USE_PTHREADS=1 for Qt would help here (or whether that would be redundant because our vcpkg triplet already sets -pthread).

Another option would be the recently-added C++20 co_await integration, which uses native LLVM coroutines and thus hopefully shouldn't be bound to the same limitations as Asyncify: emscripten-core/emscripten#20413

Given that PortAudio exposes a C interface, I am not sure how well we could integrate C++ coroutines there, however.

Motivation

Being able to run Mixxx on the web would be pretty cool. Qt supports WebAssembly, we would however also have to compile all of the other dependencies. This would probably take some work, but should not be impossible.

We take a similar approach to the iOS port (#16) and use custom WASM branches for mixxx and vcpkg, along with an integration branch in m1xxx, then gradually upstream the required changes.

Porting the dependencies to WebAssembly

  • Configure Qt correctly with GL ES 3.0 and without dbus
  • Fix libflac, libmad and libmodplug
  • Fix sleef build by using fftw as an alternative FFT backend
  • Fix qttools build (or figure out how to remove non-host qttools dependency from qttranslations)
  • Fix undefined _qt_test_emscripten_version in Qt6WasmMacros.cmake during Mixxx configure
    • Patched out in fwcd/vcpkg@e80fbb4, though we may want to look for a better solution before we attempt to upstream this
  • Update Qt to 6.6.2
    • This provides WASM stack traces in log messages and exceptions, which is really useful for debugging

Porting Mixxx to WebAssembly

  • Figure out why WrapRt cannot be found when configuring Mixxx:
    Qt6Core could not be found because dependency WrapRt could not be found.
    
    Digging into FindWrapRt.cmake shows that the check_cxx_source_compiles failed, which (as build/CMakeFiles/CMakeConfigureLog.yaml revealed), failed due a missing clang-scan-deps binary:
    "CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS-NOTFOUND" -format=p1689 -- /opt/emsdk/upstream/emscripten/em++ -DHAVE_STDATOMIC_WITH_LIB  -fdiagnostics-color=auto  -std=gnu++20 -x c++ /Users/fredrik/git/m1xxx-wasm/mixxx/build/CMakeFiles/CMakeScratch/TryCompile-QIjor4/src.cxx -c -o CMakeFiles/cmTC_0948e.dir/src.cxx.o -MT CMakeFiles/cmTC_0948e.dir/src.cxx.o.ddi -MD -MF CMakeFiles/cmTC_0948e.dir/src.cxx.o.ddi.d > CMakeFiles/cmTC_0948e.dir/src.cxx.o.ddi.tmp && mv CMakeFiles/cmTC_0948e.dir/src.cxx.o.ddi.tmp CMakeFiles/cmTC_0948e.dir/src.cxx.o.ddi
    /bin/sh: CMAKE_CXX_COMPILER_CLANG_SCAN_DEPS-NOTFOUND: command not found
    ninja: build stopped: subcommand failed.
    
    Presumably we hit emscripten-core/emscripten#21042, possibly because Mixxx uses C++20 (this would also explain why vcpkg builds of Qt passed, despite running the same FindWrapRt check).
  • Solve this linker error
    wasm-ld: error: --shared-memory is disallowed by sqlite3.c.o because it was not compiled with 'atomics' or 'bulk-memory' features.
    
    The issue is likely that we have to compile (all?) our dependencies with -pthread (as per this discussion). This should in principle be possible via the triplet, just setting VCPKG_C(XX)_FLAGS does not work, however:
    microsoft/vcpkg#30108
    • Fixed by introducing new triplets (wasm32-emscripten-pthread(-release)) and setting
      set(ENV{EMCC_CFLAGS} "$ENV{EMCC_CFLAGS} -pthread")

Upstreaming the Mixxx patches

Upstreaming the vcpkg patches

to microsoft/vcpkg

to mixxxdj/vcpkg

TBD:

  • Cherry-pick the PortAudio patches (Web Audio support)
  • Cherry-pick the taglib patch, i.e. either rebase it or wait until Mixxx fully supports Taglib 2.0:

to upstream projects

Nice to have

  • CI for Emscripten/WebAssembly
  • Support for local files/persistence
  • Updating the install logic in CMakeLists to produce a proper archive when e.g. cpack -G TGZ is used
    • Currently we get a desktop-like file structure with bin etc.
    • Instead we want a flat directory with mixxx.{data,html,js,wasm,worker.js}, qtloader.js and qtlogo.svg
      • From there, emrun mixxx.html can be used to launch the web app locally

Useful resources

Set up infrastructure for custom build flavors

E.g. with the ability to specify a list of PRs to include. We could either model this by automatically updating a fork of Mixxx or by dynamically applying the merges during CI.

A slightly adjacent idea would be the ability to build with different vcpkg environments, e.g. different Qt versions. Since this is generally non-trivial to perform automatically, we would likely have to pin a custom vcpkg revision for that.

App does not request microphone access.

Hi,

Firstly, thanks for the work you've done making an m1 build available, it's really nice to have it running natively!

Unfortunately, I haven't been able to get my DVS setup working, the program does not detect the timecode signal coming from the audio interface. I suspect it might be because m1xxx does not request microphone access when starting up.

I didn't observe this behaviour with the official (intel) build, any idea what the issue could be? My best guesses are that the builds based off master do not currently support this, or alternatively, that the fact that this is an unofficial build restricts the access given to the program (launching the app requires going into system preferences and clicking "Open anyway"). I'm not a macOS expert, so any help with this would be amazing!

Update automerge workflow

Now that the main branch can be built directly without patches (see #5), we would simply have to regularly update the mixxx submodule to point to the recentmost main commit.

Set up ccache

Caching artifacts with ccache (in conjunction with the GitHub Actions cache) would be cool.

Investigate building for aarch64 Linux too

This would be nice for use on a Raspberry Pi, especially given that from-source builds under QEMU take very long. We'd have to figure out whether building all the dependencies from scratch via vcpkg is the right approach or whether using the distribution-provided libraries would be better after all.

Build Mixxx itself

Currently the repo only builds the dependencies, not Mixxx itself yet. We should do so and perhaps figure out whether we could pass the (relatively few) patches to the CMake build files as command line arguments to avoid having to patch the mixxx tree itself (this would also make it easier to e.g. provide regularly updated nightly builds of Mixxx, at least while the dependencies don't change).

Update the README to reflect the current situation

Many of the blockers mentioned in the README (in particular waveforms requiring a legacy widget to render, thus preventing an update to a newer Qt version) are no longer applicable as of

We should therefore update the description to reflect the current status and ideally make the link to the official ARM snapshots more prominent (especially once a stable ARM version is released).

There are also still a few minor issues with the official snapshots that this unofficial build doesn't have, in particular this signing/sandbox-related issue:

Automatically update `vcpkg` repo

This would however require automatically tracking Mixxx's dependencies, which might first be possible once they migrate to manifest mode.

Build cache (ccache) path currently doesn't work properly in CI

$HOME is not resolved in this context, so the current solution does not work:

path: $HOME/Library/Caches/ccache

We can, however, use ~ to resolve the directory, see:

#48 addresses this by adding ccache_path to the matrix with the correct paths. If that PR turns out to be a larger blocker, we might consider extracting that logic (including the step that saves the ccache even if the run fails).

Port Mixxx to iOS

Status

The ios-qt6 branch contains experimental forks of mixxx and vcpkg that support compiling Mixxx and its dependencies for iOS, i.e. for arm64-ios-release. Most changes to Mixxx have been upstreamed, vcpkg upstreaming is still in progress. iOS CI passes.

Screenshot Screenshot

Documentation and general stuff

  • Add instructions to README.md
  • Build dependencies and Mixxx for iOS in CI

Porting the dependencies to iOS

  • Fix the dependencies (running scripts/install-vcpkg-deps with the arguments given in the aforementioned instructions should pass)
    • Fix ffmpeg build by setting --disable-audiotoolbox
    • Skip libusb and hidapi for now
    • Add patched ports for iOS under vcpkg/overlay/ios
      • Fix mp3lame by setting --disable-frontend (otherwise the build would error with missing curses.h headers)
      • Fix portaudio by patching in an experimental iOS CoreAudio backend (source)
      • Fix portmidi by patching use of legacy Carbon APIs and unavailable CoreAudio APIs (e.g. by replacing the hosttime calls with the mach time APIs as suggested by this Q&A doc)
      • Disable rubberband due to licensing issues (GPL + App Store) and build issues
      • Patch Qt as needed (it builds but hasn't been tested yet)
        • Disable _debug suffix for libraries (not needed since we already place them in a /debug subfolder, additionally they cause the Mixxx build to fail as Qt5CoreConfig.cmake looks for unsuffixed libraries (e.g. libQt5Core.a instead of the actual libQt5Core_debug.a))
      • Update to Qt 6
        • Add gles3 feature to qtbase (otherwise the port is identical to upstream vcpkg)
        • Figure out the right combination of features (Notably opengl, gles2, gles3 and sql-sqlite, but not sql-psql)
      • Figure out if we can link Qt and all non-permissively/non-App Store-clause-licensed libraries dynamically or ideally exclude them/make them optional (this includes Rubberband, xwax, libkeyfinder and potentially others)
        • For libkeyfinder it might be worth asking the rightholders nicely for a relicensing under GPL + App Store clause, given how essential the library has become
      • Patch harfbuzz with iOS sdkroot
  • Support building a patched version of Qt 5 too (as an alternative to Qt 6)
    • Build Mixxx for iOS 12
  • Add support for targeting iOS simulator

Porting Mixxx to iOS

  • Successfully configure mixxx.xcodeproj with the cmake command in the README
  • Use QIOSIntegrationPlugin
  • Add option for disabling rubberband (RUBBERBAND)
    • Fix build issues (see CI logs, we probably want to test this extensively with the regular desktop macOS build)
    • Perhaps we can upstream this?
  • Figure out potential OpenGL build issues (on iOS we only have OpenGL ES)
  • Successfully build iOS target in generated Xcode project
  • Successfully run Mixxx on an actual iOS device
  • Fix missing precision qualifier in shader
  • Bundle skins for small screen sizes:
  • Successfully load a track from within the sandbox (i.e. Mixxx's documents directory, which the user can access via the files app, e.g. to import music or to export recordings)
  • Implement screen lock suspension for iOS
  • Disable tool tips on iOS
  • Default audio backend to patched PortAudio's "iOS Audio"
    • Figure out why we still don't get any sound when using speakers (headphones work, strangely)
  • Investigate how to read files within the iOS sandbox (especially user-picked ones, e.g. via QFileChooser in MixxxMainWindow::slotFileLoadSongPlayer, which is invoked by File > Load Track to Deck ...)
    • Perhaps "import" files by always copying them to the sandbox/documents folder when loading them to a deck?
      • This would probably be required anyway to (permanently) add them to the library
  • Investigate how much of the macOS sandboxing logic we can reuse
  • Set dragMode to scrolling on scrollable views (library, preferences etc.)
  • Make preferences (and other modals such as "about"?) full-screen
    • Ideally, these modals should probably be a sheet-presented view controllers, but it is unclear whether Qt supports this natively
  •  Use MediaPlayer (instead of iTunesLibrary) framework to access music library on iOS
    • Figure out how we can make the sandbox play these tracks (the same issue as for files outside the sandbox)

Packaging Mixxx for iOS

  • Bundle resources with iOS app
  • Update qResourcePath logic to handle iOS app bundles (which use a flatter file structure than macOS bundles)
  • Add iOS app icon (custom SVG, derived from the macOS icon without rounded corners + script for rendering it)
  • Add custom Info.plist (including the permission for users to access Mixxx's documents directory via the Files app)
  • Customize LaunchScreen to use Mixxx logo
  • Investigate why the IOS variable is not automatically set by CMake when setting CMAKE_SYSTEM_NAME to iOS
    • This variable is first set on the project call. We check the vcpkg triplet instead now and set CMAKE_SYSTEM_NAME automatically as needed.

Upstreaming the Mixxx patches

TBD:

  • Disable features (RUBBERBAND, HID, BATTERY, QTKEYCHAIN) for iOS in upstream CMakeLists and remove them from our README (and user presets as needed)
    • rubberband and qtkeychain-qt6 have been fixed, so we could investigate reenabling them
  • The LateNight Mini skin
    • Should be discussed on Zulip first, though a general purpose "small screen" skin would probably be useful for other use cases too (e.g. Raspberry Pis)

Upstreaming the vcpkg patches

to microsoft/vcpkg

to mixxxdj/vcpkg

TBD:

  • Upstream our updated vcpkg.json manifest
  • Figure out a solution to the SDKROOT workarounds

to upstream projects

TBD:

  • Find a way to get rid of the workaround of explicitly setting an SDKROOT for some ports

Ideas for future work

  • Investigate replacing the native (deprecated) OpenGL ES framework with ANGLE, which runs on top of Metal
  • Hot reloading for skins over the network

Fix code signature

We should run xattr -cr Mixxx.app on the binary since otherwise macOS won't let us run the app by default due to an invalid signature:

image

Add build instructions

Once the scripts from #9 are merged, we should update the README with a short description on how to build Mixxx locally on arm64 macOS.

Use Apple Silicon runners once available

This would let us produce proper dependency archives (the current ones cannot really be used to compile Mixxx on arm64 hosts since the Qt tools are still built for x86_64 in CI).

Default triplets to the correct macOS deployment target

i.e. use arm64-osx-min1100-release instead of arm64-osx-release and x64-osx-min1015-release instead of x64-osx-release etc. by default in scripts/install-vcpkg-deps. Both our and upstream's CI already uses these by explicitly specifying the corresponding triplets, but it would be nice to do this for local developers too to fix the corresponding linker warnings when building Mixxx.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.