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

redefinition of 'struct timespec' #668

Open
inunix3 opened this issue Feb 16, 2025 · 0 comments
Open

redefinition of 'struct timespec' #668

inunix3 opened this issue Feb 16, 2025 · 0 comments

Comments

@inunix3
Copy link

inunix3 commented Feb 16, 2025

When trying to compile SDL_mixer from sources along with my project, I get this error (output from ninja generated by cmake):

[116/438] Building C object third-party/SDL_mixer/CMakeFiles/SDL3_mixer-shared.dir/src/codecs/native_midi/native_midi_linux_alsa.c.o
FAILED: third-party/SDL_mixer/CMakeFiles/SDL3_mixer-shared.dir/src/codecs/native_midi/native_midi_linux_alsa.c.o
/usr/bin/gcc -DBUILD_SDL -DDLL_EXPORT -DFLUIDSYNTH_DYNAMIC=\"libfluidsynth.so.3\" -DGME_DYNAMIC=\"libgme.so.0\" -DMUSIC_FLAC_DRFLAC -DMUSIC_GME -DMUSIC_MID_FLUIDSYNTH -DMUSIC_MID_NATIVE -DMUSIC_MID_TIMIDITY -DMUSIC_MP3_MINIMP3 -DMUSIC_OGG -DMUSIC_OPUS -DMUSIC_WAV -DMUSIC_WAVPACK -DOGG_USE_STB -DOPUS_DYNAMIC=\"libopusfile.so.0\" -DSDL_BUILD_MAJOR_VERSION=3 -DSDL_BUILD_MICRO_VERSION=0 -DSDL_BUILD_MINOR_VERSION=0 -DWAVPACK_DYNAMIC=\"libwavpack.so.1\" -I/home/eax_ebx/projects/tetris/third-party/SDL_mixer/include -I/home/eax_ebx/projects/tetris/third-party/SDL_mixer/src -I/home/eax_ebx/projects/tetris/third-party/SDL_mixer/src/codecs -I/usr/include/opus -I/usr/include/gme -I/home/eax_ebx/projects/tetris/build/debug-gcc/third-party/SDL/include-revision -I/home/eax_ebx/projects/tetris/third-party/SDL/include -g -std=c11 -fPIC -fvisibility=hidden -Wall -Wextra -MD -MT third-party/SDL_mixer/CMakeFiles/SDL3_mixer-shared.dir/src/codecs/native_midi/native_midi_linux_alsa.c.o -MF third-party/SDL_mixer/CMakeFiles/SDL3_mixer-shared.dir/src/codecs/native_midi/native_midi_linux_alsa.c.o.d -o third-party/SDL_mixer/CMakeFiles/SDL3_mixer-shared.dir/src/codecs/native_midi/native_midi_linux_alsa.c.o -c /home/eax_ebx/projects/tetris/third-party/SDL_mixer/src/codecs/native_midi/native_midi_linux_alsa.c
In file included from /usr/include/alsa/asoundlib.h:51,
                 from /home/eax_ebx/projects/tetris/third-party/SDL_mixer/src/codecs/native_midi/native_midi_linux_alsa.c:32:
/usr/include/alsa/global.h:144:8: error: redefinition of ‘struct timespec’
  144 | struct timespec {
      |        ^~~~~~~~
In file included from /usr/include/time.h:42,
                 from /usr/include/alsa/global.h:32:
/usr/include/bits/types/struct_timespec.h:11:8: note: originally defined here
   11 | struct timespec
      |        ^~~~~~~~
[133/438] Building C object third-party/SDL/CMakeFiles/SDL3-shared.dir/src/dynapi/SDL_dynapi.c.o
ninja: build stopped: subcommand failed.

It seems that the commit which introduced this bug is afdec3e. Checking out some older commit before the native linux MIDI was added helps to compile SDL_mixer.

This error appears on both clang and gcc.

My system is Arch Linux x86_64, kernel version is 6.13.2-arch1-1. Version of alsa-lib, which owns /usr/include/alsa, is 1.2.13-1.

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

1 participant