Remove accidental hard dependency on libpulse on linux
Schmavery opened this issue · 6 comments
As you can see here: bsansouci/reprocessing-example#2, we currently require libpulse-dev to be installed when on linux.
This is a mistake due to some badly specified dependencies here: https://github.com/bsansouci/SDL-mirror/blob/2f5920d702e435f4a2b21c263ff5becae796a591/postinstall.js#L135
This list of dependencies comes from the Libs.private
section of the sdl2.pc
file that gets generated during the build of sdl2.
I believe the presence of these audio libraries is an artifact of when we were attempting to statically link audio libraries on linux, and that we have since enabled dynamic linking of them and can afford to not specify -lpulse and -lpulse-simple in the link step. We would need someone on linux to verify this.
Alternatively, we need the postinstall.js
script to parse the generated sdl2.pc file and use its list of static libraries when generating the bsconfig.json
.
Ideally, the end result here is that on linux, the sdl2 configure script determines how best to access audio devices on your platform and is able to set up the build accordingly. Anyone who is interested in improving this should feel free to ask any additional questions necessary to give it a shot 😄
cc @zploskey
I'm happy to look into this. Just out of curiosity, is there any reason not to dynamically link to the system SDL on Linux if it is available? On Fedora 27 I have the following:
$ dnf list SDL2*
Last metadata expiration check: 2:06:30 ago on Tue 20 Mar 2018 02:54:30 PM PDT.
Installed Packages
SDL2.x86_64 2.0.7-2.fc27 @updates
SDL2-devel.x86_64 2.0.7-2.fc27 @updates
SDL2_gfx.x86_64 1.0.3-1.fc27 @updates
SDL2_gfx-devel.x86_64 1.0.3-1.fc27 @updates
SDL2_gfx-docs.noarch 1.0.3-1.fc27 @updates
SDL2_image.x86_64 2.0.2-2.fc27 @updates
SDL2_image-devel.x86_64 2.0.2-2.fc27 @updates
SDL2_mixer.x86_64 2.0.2-1.fc27 @updates
SDL2_mixer-devel.x86_64 2.0.2-1.fc27 @updates
SDL2_net.x86_64 2.0.1-5.fc27 @fedora
SDL2_net-devel.x86_64 2.0.1-5.fc27 @fedora
SDL2_ttf.x86_64 2.0.14-5.fc27 @fedora
SDL2_ttf-devel.x86_64 2.0.14-5.fc27 @fedora
Leaving out the i686
packages.
Hadn't given it much thought because I didn't think it came by default on most linux installs. If that's not the case, we can definitely look into this.
In general, what we want is an install where the user doesn't have to add or modify any global dependencies they have on their system, if at all possible.
It's definitely not installed by default, but on most Linux distributions it can be installed with a single command. Having it build it if not installed makes sense, I think.
Also are you specifically referring to the fast branch that the line you linked is in? Master doesn't seem to specify -lpulse
or -lpulse-simple
.
Yes, sorry, it's a little confusing, I should have linked more directly.
Currently the fast branch is the only one that is depended on by reasongl/reprocessing.
It will download prebuilt binaries on mac and windows and download a zip of the src on linux, then configure and build it.
It all happens in the postinstall.js script (again, on the fast branch), which is a tad hairy, so let us know if you get confused there.
Ah I see. Well, it seems to build fine after this commit: zploskey/SDL-mirror@fd835e3
My sdl2.pc looks like this before and after that commit.
# sdl pkg-config source file
prefix=/home/zach/src/SDL-mirror
exec_prefix=${prefix}
libdir=/home/zach/src/SDL-mirror
includedir=${prefix}/include
Name: sdl2
Description: Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer.
Version: 2.0.5
Requires:
Conflicts:
Libs: -L${libdir} -Wl,-rpath,${libdir} -Wl,--enable-new-dtags -lSDL2
Libs.private: -lSDL2 -Wl,--no-undefined -lm -ldl -lpthread -lrt
Cflags: -I${includedir}/SDL2 -D_REENTRANT
Looks like this is fixed now! Thanks :)
For context, the sdl2.pc wouldn't have changed if you didn't change the configure command or your global system installed packages.