Closed ell1e closed 9 months ago
The linker flags for alsa come from pkgconfig. So they should be correct if your distribution didn't mess something up.
Can you check the output of it? I'm not at a Linux system right now to check. Think the command was pkgconfig --cflags --lib alsa
(or pretty close to this).
Also check if you can find the libraries on your system and where they are located.
Hm I couldn't quite get it to print out anything useful:
$ pkg-config --cflags --libs alsa
Package alsa was not found in the pkg-config search path.
Perhaps you should add the directory containing `alsa.pc'
to the PKG_CONFIG_PATH environment variable
No package 'alsa' found
$ pkg-config --cflags --libs asound
Package asound was not found in the pkg-config search path.
Perhaps you should add the directory containing `asound.pc'
to the PKG_CONFIG_PATH environment variable
No package 'asound' found
$ pkg-config --cflags --libs asound2
Package asound2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `asound2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'asound2' found
$ pkg-config --cflags --libs libalsa
Package libalsa was not found in the pkg-config search path.
Perhaps you should add the directory containing `libalsa.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libalsa' found
$
Booted now my Linux to check this:
> pkg-config --cflags alsa
> pkg-config --cflags --libs alsa
-lasound
> pkg-config --static --cflags --libs alsa
-lasound -lm -lpthread -lrt
So you don't have ALSA installed? How do you play sound on your system?
Though considering that it is not installed I wonder where these library names are coming from.
Maybe one if the other dependencies pulls it in? The only one I can think of is SDL2. 🤔
configure
and cmake
print a summary after the configuration step. Just to check if ALSA was detected or not:
midi (Native, ALSA)
. Is it yes or no?MIDI playback:
. Does it mention Native
?ALSA is installed, there's libasound2 in /usr/lib64 and all the usual. This is what the EasyRPG cmake feature section gives me:
-- Target system: SDL2
--
-- Audio backend: SDL2
--
-- WAV playback: built-in (dr_wav);libsndfile
-- MIDI playback: WildMidi;built-in (FmMidi)
-- MP3 playback: mpg123
-- Ogg Vorbis playback: libvorbis
-- MOD playback: None
-- Opus playback: None
-- Resampler: speexdsp
--
-- Font rendering: Freetype and built-in
okay this means that ALSA was not detected (because there is no pkg-config file). No idea why your distribution doesn't ship one.
Though that still doesn't explain where -lasound
is coming from if you don't even have this library.
Guess to figure this out I have to install the distribution you use :/.
Right now I can only guess. You are the first one with this issue:
Search in /usr/lib/pkgconfig
and /usr/lib64/pkgconfig
for lasound
if there is any library that lists this one as a dependency.
When building with CMake you can also try -DCMAKE_FIND_PACKAGE_PREFER_CONFIG=OFF
when configuring (delete CMakeCache.txt first!). This will use our own CMake find scripts instead of the systemwide config files to find the dependencies.
ooh. Reminder from fdelapena in the chat:
When your distribution provides development packages check that you have the corresponding -dev
or -devel
header for ALSA installed.
On deb distros, libasound2-dev
. On rpm distros, alsa-lib-devel
usually.
So I assumed the devel package was installed because the headers were present. As were the .so
files. But for some absurd reason I don't understand, on this OpenSUSE install the way they packaged it apparently it wasn't, and installing it made the already present headers and already present libraries suddenly work for linking...?
Don't ask me, I don't understand it :laughing: but in any case, yeah, my bad. It's not a cmake problem, I lacked alsa-devel.
The build of the latest dev version fails on my Linux system due to the Makefile inexplicably adding
-lasound
and-lts
multiple times, and that even more weirdly breaking the build:Now the absurd thing is, if I just copy and paste the final build command while removing
-lasound
and-lts
flags, there is no problem. So I don't think they should be there in the first place, it seems to be some problem with the cmake script.