Closed estefan3112 closed 6 months ago
You could copy the SDL2.framework into the correct location inside the qmc2-sdlmame application package.
The other option is to add -rpath /Library/Frameworks
to the link options for qmc2 on macOS.
@belegdol do you have an opinion on which way to go with this?
I would suggest to go with whatever is common practice on macOS. Are frameworks usually bundled like on Windows? Or are users expected to install them system-wide?
Looks like mame uses rpath: https://github.com/mamedev/mame/blob/a4cf1316fa003f73193c3010984a373015051e02/scripts/src/osd/sdl.lua#L255 I guess it would make sense for qmc2 to do the same then. I will see if I can make a PR.
You could copy the SDL2.framework into the correct location inside the qmc2-sdlmame application package.
The other option is to add
-rpath /Library/Frameworks
to the link options for qmc2 on macOS.@belegdol do you have an opinion on which way to go with this?
I tried to copy the sdl2.framework into the app container and codesigned it, but it still gives me a codesigning error on that framework. So I have probably exhausted my capabilities...
PS edit: For some reason, the old build from 2 years ago failed to compile with newer sdl2 frameworks (headers not found), but after compiling with older sdl2 frameworks, this old build still finds the installed sdl2 feameworks ... kind of odd
I would suggest to go with whatever is common practice on macOS. Are frameworks usually bundled like on Windows? Or are users expected to install them system-wide?
It used to be common to install frameworks in /Library/Frameworks (carried over from NeXTStep). Lately Apple has been encouraging developers to bundle all required frameworks in application packages, hence removing /Library/Frameworks from the default framework search path. MAME (and other command line tools) can’t do this because because it isn’t an application package, just an executable.
@estefan3112, could you try artefact from PR #45 once it builds?
@estefan3112, could you try artefact from PR #45 once it builds? Artefact works standalone! But for whatever reason, I still fail properly codesign the newly bundled app. Probably not of your concern, need to find out what's wrong here. The standalone binary is blazingly fast on my M2 Mac!
@estefan3112, could you try artefact from PR #45 once it builds? Artefact works standalone! But for whatever reason, I still fail properly codesign the newly bundled app. Probably not of your concern, need to find out what's wrong here. The standalone binary is blazingly fast on my M2 Mac!
I can't help you with that, sorry. I do not have access to a Mac to try anything, it is somewhat a miracle I got this far.
@estefan3112, could you try artefact from PR #45 once it builds? Artefact works standalone! But for whatever reason, I still fail properly codesign the newly bundled app. Probably not of your concern, need to find out what's wrong here. The standalone binary is blazingly fast on my M2 Mac!
I can't help you with that, sorry. I do not have access to a Mac to try anything, it is somewhat a miracle I got this far.
So I tried another local build with my buildscript (exactly identical qmake build instructions as in the github action), but the binary still cannot find the sdl2 framework. Do I have to include something in my local buildscript? These are the relevant lines:
echo 'export PATH="/opt/homebrew/opt/qt@5/bin:$PATH"' >> ~/.zshrc export LDFLAGS="-L/opt/homebrew/opt/qt@5/lib" export CPPFLAGS="-I/opt/homebrew/opt/qt@5/include" export PKG_CONFIG_PATH="/usr/local/opt/qt@5/lib/pkgconfig"
qmake -makefile -o Makefile.qmake -spec macx-clang VERSION=0.244 QMC2_MINGW=0 SDL=2 TARGET=qmc2-sdlmame CONFIG+=warn_off CONFIG+=release 'DEFINES+=QMC2_SDLMAME QMC2_VERSION=0.244 BUILD_OS_NAME=Darwin BUILD_OS_RELEASE=23.3.0 BUILD_MACHINE=arm64 PREFIX=/usr/local QMC2DATADIR="/Library/Application:Support" SYSCONFDIR="/Library/Application:Support" QMC2_JOYSTICK=1 QMC2_PHONON=0 QMC2_MULTIMEDIA=1 QMC2_FADER_SPEED=500 QMC2_GIT_REV=beaf02d QMC2_MAC_UNIVERSAL=0 QMC2_BROWSER_EXTRAS_ENABLED QMC2_BROWSER_PLUGINS_ENABLED QMC2_BROWSER_JAVA_ENABLED QMC2_BROWSER_JAVASCRIPT_ENABLED QMC2_YOUTUBE_ENABLED QMC2_BUNDLED_MINIZIP QMC2_BUNDLED_ZLIB' qmc2.pro
make -j8 sudo make install
Then comes the local codesigning...
@belegdol - maybe better asking this way: If I am building qmc2 locally by downloading the master and build with exactly the same qmake line as in the workflow, the result is still that the binary does not find the sdl2 framework.
This is what the terminal tells me: dyld[11185]: Library not loaded: @rpath/SDL2.framework/Versions/A/SDL2 Because it still does not look for /Library/Frameworks/, but only in the binary directory. So is there something missing in the code that it builds properly locally? Many thanks!
The pr is not merged yet so you need to built the PR branch, not master. rpath is missing otherwise.
Works with the PR! Having a fully functional, code signed app bundle in Apple Silicon, which starts even faster now. Great work! Would close this already now.
FYI - I uploaded App Bundles for Apple Silicon and Intel Macs, both code signed: https://mameonmacs.blogspot.com/2022/04/welcome-back-qmc2.html Feel free to use them, but they will be available via Google Drive anyways.
Hi, many thanks for making QMC2 compile with the latest SDL2 again. However, the own compile crashes, and it seems that it cannot find SDL any longer:
Termination Reason: Namespace DYLD, Code 1 Library missing Library not loaded: @rpath/SDL2.framework/Versions/A/SDL2 Referenced from: <4A45C253-5716-3C27-935F-E42698D98265> /Applications/qmc2-sdlmame.app/Contents/MacOS/qmc2-sdlmame Reason: tried: '/Applications/qmc2-sdlmame.app/Contents/Frameworks/SDL2.framework/Versions/A/SDL2' (no such file), '/Applications/qmc2-sdlmame.app/Contents/Frameworks/SDL2.framework/Versions/A/SDL2' (no such file) (terminated at launch; ignore backtrace)
I also downloaded the latest artifact from Github actions with the same result. Anything I can try?
Many thanks for reviving QMC2!!!