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

Kivy doesn't compile with SDL_mixer v2.0.2 #5457

Closed
lordjabez opened this issue Oct 27, 2017 · 14 comments
Closed

Kivy doesn't compile with SDL_mixer v2.0.2 #5457

lordjabez opened this issue Oct 27, 2017 · 14 comments

Comments

@lordjabez
Copy link

Versions

  • Python: 3.6.2
  • OS: ArchLinux
  • Kivy: Latest master branch as of 2017.10.27
  • Kivy installation method: Compiling from source

Description

Kivy fails to compile with the error listed below. The reason is that some flags were removed/renamed in SDL2_mixer release 2.0.2, specifically MIX_INIT_MODPLUG and MIX_INIT_FLUIDSYNTH were removed from SDL_mixer.h.

I'm willing to take a crack at a fix, but presumably we want to maintain backwards compatibility, so my thought is to redefine these flags locally if they don't exist in the header.

Code and Logs

gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -march=armv8-a -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -march=armv8-a -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -march=armv8-a -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -fPIC -Ikivy/include -I/usr/include/SDL2 -I/usr/local/include/SDL2 -I/usr/include/SDL2 -I/usr/include/SDL2 -I/usr/include/python3.6m -c kivy/core/audio/audio_sdl2.c -o build/temp.linux-aarch64-3.6/kivy/core/audio/audio_sdl2.o
kivy/core/audio/audio_sdl2.c: In function '__pyx_f_4kivy_4core_5audio_10audio_sdl2_mix_init':
kivy/core/audio/audio_sdl2.c:1647:63: error: 'MIX_INIT_MODPLUG' undeclared (first use in this function); did you mean 'MIX_INIT_MOD'?
   __pyx_v_want_flags = (__pyx_v_want_flags | ((MIX_INIT_MOD | MIX_INIT_MODPLUG) | MIX_INIT_FLUIDSYNTH));
                                                               ^~~~~~~~~~~~~~~~
                                                               MIX_INIT_MOD
kivy/core/audio/audio_sdl2.c:1647:63: note: each undeclared identifier is reported only once for each function it appears in
kivy/core/audio/audio_sdl2.c:1647:83: error: 'MIX_INIT_FLUIDSYNTH' undeclared (first use in this function); did you mean 'MIX_INIT_MID'?
   __pyx_v_want_flags = (__pyx_v_want_flags | ((MIX_INIT_MOD | MIX_INIT_MODPLUG) | MIX_INIT_FLUIDSYNTH));
                                                                                   ^~~~~~~~~~~~~~~~~~~
                                                                                   MIX_INIT_MID
kivy/core/audio/audio_sdl2.c: In function '__pyx_pf_4kivy_4core_5audio_10audio_sdl2_9MusicSDL2_extensions':
kivy/core/audio/audio_sdl2.c:4936:69: error: 'MIX_INIT_MODPLUG' undeclared (first use in this function); did you mean 'MIX_INIT_MOD'?
   __pyx_t_2 = ((__pyx_v_4kivy_4core_5audio_10audio_sdl2_mix_flags & MIX_INIT_MODPLUG) != 0);
                                                                     ^~~~~~~~~~~~~~~~
                                                                     MIX_INIT_MOD
 error: command 'gcc' failed with exit status 1
@lordjabez
Copy link
Author

This is the new definition in SDL_mixer.h in v2.0.2:

typedef enum
{
    MIX_INIT_FLAC   = 0x00000001,
    MIX_INIT_MOD    = 0x00000002,
    MIX_INIT_MP3    = 0x00000008,
    MIX_INIT_OGG    = 0x00000010,
    MIX_INIT_MID    = 0x00000020
} MIX_InitFlags;

@lordjabez
Copy link
Author

And the prior one for comparison:

typedef enum
{
    MIX_INIT_FLAC        = 0x00000001,
    MIX_INIT_MOD         = 0x00000002,
    MIX_INIT_MODPLUG     = 0x00000004,
    MIX_INIT_MP3         = 0x00000008,
    MIX_INIT_OGG         = 0x00000010,
    MIX_INIT_FLUIDSYNTH  = 0x00000020
} MIX_InitFlags;

@tito
Copy link
Member

tito commented Oct 30, 2017

I'm 100% sure nobody use fluidsynth. If you provide a patch directly, we'll merge it.

@gpark1005
Copy link

Where do you enter in the new definitions? Please bare with me. I am new to this.

@lordjabez
Copy link
Author

Looks like someone took a crack at a fix here: #5459

@alibitek
Copy link

alibitek commented Oct 31, 2017

The ArchLinux Kivy package somehow manages to get around this compilation issue:

The python-kivy 1.10.0 package depends on sdl2_mixer 2.0.2 and it works without the patch mentioned.

I was trying to install Kivy in a Python 3 virtual environment with a requirements.txt file containing:
Cython==0.25.2
Kivy==1.10.0
and failed with the same error: ‘MIX_INIT_MODPLUG’ undeclared (first use in this function); did you mean ‘MIX_INIT_MOD’? error

After installing the package from the repository: sudo pacman -S python-kivy and adding the path to the global Python installation where Kivy was installed to:
PYTHONPATH=/usr/lib/python3.6/site-packages/:/usr/local/lib/python3.6/site-packages/ python3 main.py , Kivy module gets loaded successfully.

@lordjabez
Copy link
Author

That's interesting. Unfortunately I need to compile the latest master branch because I'm running Arch on a Raspberry Pi, and if I use the 1.10.0 version from the repository performance is dreadful.

@alibitek
Copy link

Indeed, building a python-kivy Arch package from master branch, via makepkg -s && makepkg --skipinteg, fails with the same error.

Applying the the patch to the PKGBUILD works for building master Kivy on x86_64 desktop

Building for ARM should work the same as for the desktop, just need to update the respective PKGBUILD file:
https://archlinuxarm.org/packages/arm/python-kivy
https://archlinuxarm.org/packages/arm/sdl_mixer

Replace 'arm' in the URL with the ARM version of the Raspberry Pi you have:

Raspberry Pi 1 - armv6
Raspberry Pi 2 - armv7
Raspberry Pi 3 - armv8

However, I see that the package for sdl_mixer in ArchLinux for ARM is 1.2.12-5 , would need to update that as well.

@KeyWeeUsr
Copy link
Contributor

Closed by #5459

@duaneking
Copy link

This still exists on MacOS High Sierra

@fantastechit
Copy link

@duaneking
If you install development version like pip install https://github.com/kivy/kivy/archive/master.zip (see https://kivy.org/docs/installation/installation-osx.html) then it works on High Sierra.

@duaneking
Copy link

Not an option for me; I'm looking for non-kiva options now since HS has been around long enough that if the community doesn't care to ship/maintain this, then I shouldn't let myself depend on it.

@jabdoa2
Copy link
Contributor

jabdoa2 commented Apr 28, 2018

Is there any change that you could release a Kivy version with this fix? Since Ubuntu 18.04 just got released this will affect practically 95% of our Linux user base.

@ccbran
Copy link

ccbran commented May 31, 2018

installing Kivy Development Version worked on High Sierra. Thanks fantastechit!

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

No branches or pull requests

9 participants