Closed incanus closed 2 years ago
I'll add that ./pc-basic
from a source checkout runs just fine in SDL graphical mode. 🤷♂️
Looks like you have Apple Silicon (ARM), the included libraries for SDL2 only have dylibs for for Intel CPUs. If you first install SDL2 separately for your Mac, do you still get this? It should use a previously installed SDL2 in preference to the included libraries.
We may need some code to identify ARM vs Intel Macs and ensure it looks at the correct dylib
On Sat, 23 Jul 2022, 00:45 Justin R. Miller, @.***> wrote:
Sorry to pile on the Mac issues, but might as well capture this one for completeness...
Installing from pip install pcbasic won't run from the CLI, giving this:
/Users/incanus/.pyenv/versions/3.10.3/lib/python3.10/site-packages/pcbasic/interface/sdl2.py:163: DLLWarning:
OSError("dlopen(/Users/incanus/.pyenv/versions/3.10.3/lib/python3.10/site-packages/pcbasic/lib/darwin/libSDL2.dylib, 0x0006): tried: '/Users/incanus/.pyenv/versions/3.10.3/lib/python3.10/site-packages/pcbasic/lib/darwin/libSDL2.dylib' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))") warnings.warn(repr(exc), DLLWarning) [16:41:37.0755] INFO: Could not initialise video plugin sdl2: Module sdl2 not found [16:41:37.0756] ERROR: Failed to initialise any video plugin.
(emphasis added)
I will try to get to the bottom of this as well.
— Reply to this email directly, view it on GitHub https://github.com/robhagemans/pcbasic/issues/204, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB25REWHJC7QRP2H2HMD3C3VVMXARANCNFSM54NBP2ZQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Yeah, I've ensured all the right SDL2 stuff. I can look more into the area where this decision can/should be made, now that I have some context on expected behavior. But ultimately, per https://github.com/robhagemans/pcbasic/issues/189 it would be nice to handle this without external dependencies.
Yes, and I think it should be possible so long as the correct dylib can be found and included. When I built all the mac stuff apple silicon did not exist, so all the code that checks for the Mac platform assumes 64-bit intel hardware.
Some of the relevant lines are these: https://github.com/robhagemans/pcbasic/blob/master/pcbasic/interface/video_sdl2.py#L62 https://github.com/robhagemans/pcbasic/blob/master/pcbasic/interface/sdl2.py#L115
If universal dylibs across Intel and ARM exist, then it will be a matter if including one of those. If not, we'll need more code to identify the architecture and distinguish the two in different directories.
Apropos, what does sys.platform
report on Apple Silicon?
By the way once this works we may also need to look into SDL2_gfx, it's used for only one function but without that the screen looks grainy and a bit ugly. Though it's not as bad on retina screens. Unfortunately gfx has no binary distribution so would need to be compiled. But first things first.
Another aside - fixing the dylib will make this work out of the box from pip
which would be great. The packaged dmg is another issue. Usually cx_Freeze will only build a package for the platform it is used on. The included mac package was built on intel, so would probably only run on intel even if we include the dylib. We'd probably need someone to build on ARM and someone on Intel macs separately, and have two packages. Unless all required libraries are universal, which would be lucky.
This looks very promising: https://pypi.org/project/pysdl2-dll/
I'm going to see if I can make this work with PC-BASIC, which would then need to be tried on an ARM Mac. Additional advantage is that I can stop bundling DLL's and dylibs because someone else is already doing this :)
I've rearranged things so that it now relies on https://pypi.org/project/pysdl2-dll/ to provide the SDL2 binaries and no longer includes them directly. From what I gather, their latest version should include MacOS universal binaries. See also #131. I hope it works.
I expect this to be solved with release 2.0.6.
Indeed it is. Details in https://github.com/robhagemans/pcbasic/issues/131#issuecomment-1207498630
Sorry to pile on the Mac issues, but might as well capture this one for completeness...
Installing from
pip install pcbasic
won't run from the CLI, giving this:(emphasis added)
I will try to get to the bottom of this as well.