Port Mixxx to Emscripten/WebAssembly #69
Labels
enhancement
New feature or request
help wanted
Extra attention is needed
port
Porting Mixxx and vcpkg dependencies to a new platform
Status
The
wasm
branch contains experimental forks ofmixxx
andvcpkg
for targetingwasm32-emscripten
.You can try it out, there is a GitHub Pages-hosted build at https://fwcd.github.io/m1xxx, but be warned: It may take a while to load (the 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).
On the technical side, there are still some major roadblocks to be resolved:
-sASSERTIONS
, see-sASSERTIONS
, any multiple in-flight async operations are effectively undefined behavior and manifest themselves in hard-to-debug failures at runtime (e.g. "unreachable" errors in the console, freezes, etc.)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#20413Given 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
andvcpkg
, along with an integration branch inm1xxx
, then gradually upstream the required changes.Porting the dependencies to WebAssembly
dbus
libflac
,libmad
andlibmodplug
sleef
build by usingfftw
as an alternative FFT backendqttools
build (or figure out how to remove non-hostqttools
dependency fromqttranslations
)qttools
_qt_test_emscripten_version
inQt6WasmMacros.cmake
during Mixxx configurePorting Mixxx to WebAssembly
WrapRt
cannot be found when configuring Mixxx:FindWrapRt.cmake
shows that thecheck_cxx_source_compiles
failed, which (asbuild/CMakeFiles/CMakeConfigureLog.yaml
revealed), failed due a missingclang-scan-deps
binary:FindWrapRt
check).-pthread
(as per this discussion). This should in principle be possible via the triplet, just settingVCPKG_C(XX)_FLAGS
does not work, however:How do I pass compiler/linker arguments to Emscripten? microsoft/vcpkg#30108
wasm32-emscripten-pthread(-release)
) and settingUpstreaming the Mixxx patches
PORTMIDI
flag for compiling with(out) PortMidi mixxxdj/mixxx#12913MUSICBRAINZ
flag for compiling with(out) MusicBrainz mixxxdj/mixxx#12914QWasmIntegrationPlugin
when targeting WebAssembly mixxxdj/mixxx#12915!defined(__EMSCRIPTEN__)
where intrinsics are unavailable on WASM mixxxdj/mixxx#12917WASM_ASSERTIONS
option mixxxdj/mixxx#12931--preload-file
mixxxdj/mixxx#12944Qt::FramelessWindowHint
mixxxdj/mixxx#12945~/Music
as a music directory on Wasm and iOS mixxxdj/mixxx#13498Upstreaming the vcpkg patches
to
microsoft/vcpkg
wchar_t
check microsoft/vcpkg#37105asyncify
feature microsoft/vcpkg#37230to
mixxxdj/vcpkg
libid3tag
andlibmad
to!osx & !ios
(to fix Wasm MP3 support) mixxxdj/vcpkg#139TBD:
to upstream projects
Nice to have
IDBFS
to persist the.mixxx
directorycpack -G TGZ
is usedbin
etc.mixxx.{data,html,js,wasm,worker.js}
,qtloader.js
andqtlogo.svg
emrun mixxx.html
can be used to launch the web app locallyUseful resources
The text was updated successfully, but these errors were encountered: