Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build or package for MacOS? #279

Open
palmerj opened this issue Dec 5, 2022 · 4 comments
Open

Build or package for MacOS? #279

palmerj opened this issue Dec 5, 2022 · 4 comments
Labels

Comments

@palmerj
Copy link

palmerj commented Dec 5, 2022

Does anyone have build instructions or a package for MacOS.

Thanks

@palmerj palmerj added the bug label Dec 5, 2022
@Linkid
Copy link
Member

Linkid commented Dec 5, 2022

Hello.
Which version are you using ? Did you try to install python requirements and OS requirements like SDL 1.2 ?
Currently, there are only some python wheels for python requirements, but no installer for the v4. But if you would like to help to package it for mac, you're very welcome !
Thanks :).

@palmerj
Copy link
Author

palmerj commented Dec 5, 2022

I tried to build from source, but ran into issues. I'm using Python 3.9 and MacOS 12.6. Many packages were not available as wheels. e.g pygame 1.9.6. Also fretwork wouldn't build for some reason.

More than happy to help out if you can provide some direction e.g point me to the old process to package.

Any plans to upgrade to pygame >= 2.0?

@Linkid
Copy link
Member

Linkid commented Dec 5, 2022

About versions, you will need python 2 or python 3.6 / 3.7 to install pygame 1.9.6. If possible could you paste your errors there to see what is going wrong, please ?

About pygame 2, this is in progress. Some updates are needed and we still working on it.

@palmerj
Copy link
Author

palmerj commented Dec 6, 2022

Ok thanks for the tips.

I got 4.0-allpha version to start, but couldn't get it into gameplay, and many menu graphics didn't load. I couldn't get the last v3.123 version to build, and couldn't find any instructions on how to do so.

Here's what I see:
Screen Shot 2022-12-06 at 4 22 52 pm

Screen Shot 2022-12-06 at 4 24 52 pm

Screen Shot 2022-12-06 at 4 25 15 pm

As soon as I click play on a song I don't see much, then I click again and it crashes:

❯ python FoFiX.py --verbose
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "FoFiX.py", line 171, in <module>
    main.run()
  File "/Users/jpalmer/Documents/Development/fofix/fofix/game/Main.py", line 132, in run
    while self.engine.run():
  File "/Users/jpalmer/Documents/Development/fofix/fofix/core/GameEngine.py", line 649, in run
    rtn = self.mainloop()
  File "/Users/jpalmer/Documents/Development/fofix/fofix/core/GameEngine.py", line 631, in main
    done = self.task.run()
  File "/Users/jpalmer/.pyenv/versions/fofix/lib/python3.7/site-packages/fretwork/task.py", line 118, in run
    self.runTask(taskData['task'])
  File "/Users/jpalmer/.pyenv/versions/fofix/lib/python3.7/site-packages/fretwork/task.py", line 93, in runTask
    task.run(tick)
  File "/Users/jpalmer/Documents/Development/fofix/fofix/core/Input.py", line 324, in run
    self.broadcastEvent(self.keyListeners, "keyPressed", event.key, event.unicode)
  File "/Users/jpalmer/Documents/Development/fofix/fofix/core/Input.py", line 235, in broadcastEvent
    if getattr(l, function)(*args):
  File "/Users/jpalmer/Documents/Development/fofix/fofix/game/SongChoosingScene.py", line 794, in keyPressed
    self.startGame()
  File "/Users/jpalmer/Documents/Development/fofix/fofix/game/SongChoosingScene.py", line 564, in startGame
    ready = Dialogs.choosePartDiffs(self.engine, choose, info, self.players)
  File "/Users/jpalmer/Documents/Development/fofix/fofix/game/Dialogs.py", line 1934, in choosePartDiffs
    _runDialog(engine, d)
  File "/Users/jpalmer/Documents/Development/fofix/fofix/game/Dialogs.py", line 1844, in _runDialog
    engine.run()
  File "/Users/jpalmer/Documents/Development/fofix/fofix/core/GameEngine.py", line 649, in run
    rtn = self.mainloop()
  File "/Users/jpalmer/Documents/Development/fofix/fofix/core/GameEngine.py", line 631, in main
    done = self.task.run()
  File "/Users/jpalmer/.pyenv/versions/fofix/lib/python3.7/site-packages/fretwork/task.py", line 118, in run
    self.runTask(taskData['task'])
  File "/Users/jpalmer/.pyenv/versions/fofix/lib/python3.7/site-packages/fretwork/task.py", line 93, in runTask
    task.run(tick)
  File "/Users/jpalmer/Documents/Development/fofix/fofix/core/Input.py", line 323, in run
    if not self.broadcastEvent(self.priorityKeyListeners, "keyPressed", event.key, event.unicode):
  File "/Users/jpalmer/Documents/Development/fofix/fofix/core/Input.py", line 235, in broadcastEvent
    if getattr(l, function)(*args):
  File "/Users/jpalmer/Documents/Development/fofix/fofix/game/Dialogs.py", line 1253, in keyPressed
    self.players[i].difficulty = self.info.partDifficulties[self.players[i].part.id][self.selected[i]]
IndexError: list index out of range

Note getting this to build was a mission, and heaps of little snags. Here's some notes:

  • I used pyenv to create a python 3.7 environment. e.g pyenv virtualenv 3.7.15 fofix then pyenv local fofix
  • I couldn't run pip install -r requirements.txt successfully within the fofix master branch.
  • I had to install dependencies via homebrew to help with the build process. i.e brew install sdl sdl_image sdl_mixer sdl_ttf portaudio
  • videoplayer-1.0 wouldn't install from release, and there is no wheel. The build issue relates to the setup config not finding OpenGL framework. Likely using pkg-config is the wrong approach on MacOS when a framework is needed in this case. I found that I could get 1.0-dev building locally so I used that.
  • OpenGL package doesn't find the system OpenGL library. I had to patch .pyenv/versions/fofix/lib/python3.7/site-packages/OpenGL/platform/ctypesloader.py and replaced fullName = util.find_library( name ) with fullName = "/System/Library/Frameworks/{}.framework/{}".format(name,name). This has been fixed in newer python versions. I found help here https://stackoverflow.com/questions/63475461/unable-to-import-opengl-gl-in-python-on-macos
  • I had DLL hell trying to run the program. I have symbols being loaded from multiple places, and had to play around to get the right libraries loading.Doesn't seem good that both SDL 1 and 2 is being used. I suspect this could be fixed with an app bundle. libraries that caused issue:
  • pyenv/versions/3.7.15/envs/fofix/lib/python3.7/site-packages/fretwork/.dylibs/libSDL-1.2.0.dylib
  • pyenv/versions/3.7.15/envs/fofix/lib/python3.7/site-packages/pygame/.dylibs/libSDL-1.2.0.dylib
  • /Library/Frameworks/SDL2.framework
  • /usr/local/Cellar/sdl2/2.26.1/lib/libSDL2-2.0.0.dylib
  • I found the config is stored in ~Library/Preferences/fofix

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

No branches or pull requests

2 participants