pursuedpybear icon indicating copy to clipboard operation
pursuedpybear copied to clipboard

Linux "ppb.systems._sdl_utils.SdlMixerError: Error calling Mix_Init: OGG support not available"

Open abixadamj opened this issue 5 years ago • 9 comments

I have tried your code from README file (about Ship), and I got an error:

Traceback (most recent call last):
  File "ship.py", line 14, in <module>
    ppb.run(setup=setup)
  File "/home/adasiek/.local/lib/python3.6/site-packages/ppb/__init__.py", line 122, in run
    with make_engine(setup, starting_scene=starting_scene, title=title, **engine_opts) as eng:
  File "/home/adasiek/.local/lib/python3.6/site-packages/ppb/engine.py", line 107, in __enter__
    self.start_systems()
  File "/home/adasiek/.local/lib/python3.6/site-packages/ppb/engine.py", line 124, in start_systems
    self.exit_stack.enter_context(system)
  File "/usr/lib/python3.6/contextlib.py", line 330, in enter_context
    result = _cm_type.__enter__(cm)
  File "/home/adasiek/.local/lib/python3.6/site-packages/ppb/systems/sound.py", line 88, in __enter__
    mix_call(Mix_Init, MIX_INIT_FLAC | MIX_INIT_MOD | MIX_INIT_MP3 | MIX_INIT_OGG)
  File "/home/adasiek/.local/lib/python3.6/site-packages/ppb/systems/_sdl_utils.py", line 94, in mix_call
    raise SdlMixerError(f"Error calling {func.__name__}: {err.decode('utf-8')}")
ppb.systems._sdl_utils.SdlMixerError: Error calling Mix_Init: OGG support not available

My system is:

adasiek@mint-desktop:~/tmp$ python3 
Python 3.6.9 (default, Apr 18 2020, 01:56:04) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
adasiek@mint-desktop:~/tmp$ lsb_release -a
No LSB modules are available.
Distributor ID:	LinuxMint
Description:	Linux Mint 19.3 Tricia
Release:	19.3
Codename:	tricia
adasiek@mint-desktop:~/tmp$ uname -a
Linux mint-desktop 4.15.0-108-generic #109-Ubuntu SMP Fri Jun 19 11:33:10 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

I have tried to remark (comment out) every one type in line 88: mix_call(Mix_Init, MIX_INIT_FLAC | MIX_INIT_MOD | MIX_INIT_MP3 | MIX_INIT_OGG)

but with no success.

Python bindings to SDL2 in my system is: ii python3-sdl2 0.9.3+dfsg2-1 all Python bindings to the SDL2 C-library (Python 3 Zrzut ekranu z 2020-07-20 17-48-12

abixadamj avatar Jul 20 '20 15:07 abixadamj

Linux?

My guess is that the ogg libraries aren't a required dependency on your distro, and you don't have them installed for other reasons. I only checked a few distros when I wrote those instructions.

Long term, I'd like to add Linux binaries to the dependant wheels.

AstraLuma avatar Jul 20 '20 23:07 AstraLuma

I just hit this in WSL2.

I think it's this: https://discourse.libsdl.org/t/bug-sdl2-mixer-init-error-format-support-not-available/23705

I reordered the init and open calls and that seems to have done it.

bildzeitung avatar Sep 23 '20 14:09 bildzeitung

😱

I'm going to have to test this--Assets can be created (and loaded) at any time, so it's impossible to have every Mix_OpenAudio() called before Mix_Init.

AstraLuma avatar Sep 23 '20 15:09 AstraLuma

Eek! Ok -- I'll throw up the PR with the understanding that it might not be the right thing, but at least it'll be there if it turns out to be ok :)

bildzeitung avatar Sep 23 '20 15:09 bildzeitung

With respect to WSL, I'm really hoping that the init / sound / driver issues are resolved in the upcoming support for X apps: https://github.com/microsoft/wslg . I'll try to test whenever I get a computer on the preview release, but 🤞

bildzeitung avatar May 26 '21 03:05 bildzeitung

Even if they don't, PPB should work without wsl.

AstraLuma avatar May 26 '21 03:05 AstraLuma

Fair enough; won't see me arguing that.

I suppose the broader concern is whether PPB should work without audio if there ain't any. Not sure if the asset loading has been re-worked to sort out the init issues -- it's been a while since I dug into that stuff.

That being said, the WSL experience is pretty miserable (not due to PPB) for a bunch of reasons -- a bunch of add'l setup notwithstanding, so I thought I'd at least mention that the experience might be getting more stable (audio seemed particularly prone to failure and I while I had a procedure where it would work .. it would work just once and then involved stopping / starting daemons and I didn't think that'd be a good thing to even try to advertise, given PPB's goals). Of course, I ought to have mentioned that as a follow-on to the comments above but that dropped on the floor -- & for that I apologize.

bildzeitung avatar May 26 '21 04:05 bildzeitung

A good thing to note: We should see how the new SDL wheels affect WSL when we get a chance.

pathunstrom avatar May 26 '21 04:05 pathunstrom

I'm hoping that pysdl2-dll shipping Linux fixes this.

AstraLuma avatar May 20 '24 19:05 AstraLuma