ViZDoom icon indicating copy to clipboard operation
ViZDoom copied to clipboard

problems with sdl compilation on Mac OS

Open BSVogler opened this issue 7 years ago • 9 comments

Why I try to compile with cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_PYTHON=ON -DBUILD_JAVA=ON -DBUILD_LUA=ON and make I get a lot of SDL errors. The first error is:

In file included from ./ViZDoom/src/vizdoom/src/oplsynth/music_opldumper_mididevice.cpp:37: In file included from ./ViZDoom/src/vizdoom/src/sound/i_musicinterns.h:20: In file included from ./ViZDoom/src/vizdoom/src/oplsynth/opl_mus_player.h:1: In file included from ./ViZDoom/src/vizdoom/src/posix/sdl/critsec.h:9: In file included from /Library/Frameworks/SDL.framework/Headers/SDL_thread.h:32: /Library/Frameworks/SDL.framework/Headers/SDL_stdinc.h:94:2: error: redefinition of enumerator 'SDL_FALSE' SDL_FALSE = 0, ^ /usr/local/include/SDL2/SDL_stdinc.h:141:5: note: previous definition is here SDL_FALSE = 0,

Then a list of similar errors follow. I tried adding SLD with brew install SDL but the error persists. SDL2 is installed.

BSVogler avatar Feb 10 '18 12:02 BSVogler

Hi @BSVogler, you should install SDL2 package (brew install SDL2), SDL is the first version and it is available as separate package in brew.

mwydmuch avatar Feb 12 '18 01:02 mwydmuch

@nwydmuch You probably did not saw my edit. I have sdl2 installed.

BSVogler avatar Feb 12 '18 10:02 BSVogler

It seems that you have two versions of SDL2 in your system that conflict. One in /Library/Frameworks/SDL.framework/Headers/SDL_stdinc.h and other in /usr/local/include/SDL2/SDL_stdinc.h (from brew). You should remove one.

mwydmuch avatar Feb 12 '18 11:02 mwydmuch

You were right. I uninstalled the brew one. make says that it found the one in /Library/Frameworks/SDL.framework However I am still getting the same error. :(

BSVogler avatar Feb 12 '18 13:02 BSVogler

  • Are you still getting this message: ?
/Library/Frameworks/SDL.framework/Headers/SDL_stdinc.h:94:2: error: redefinition of enumerator 'SDL_FALSE'
SDL_FALSE = 0,
^
/usr/local/include/SDL2/SDL_stdinc.h:141:5: note: previous definition is here
SDL_FALSE = 0,
  • Are you sure that you removed SLD2 from brew?

  • Is this working for you: ?

sdl2-config
sdl2-config --version
  • Did you rerun:
rm CMakeCache.txt
cmake -DCMAKE_BUILD_TYPE=Release ...
make

mwydmuch avatar Feb 12 '18 14:02 mwydmuch

I can confirm every point but this one: There is not such command as sdl2-config on my system. After all it's just a framework in the frameworks folder.

BSVogler avatar Feb 12 '18 19:02 BSVogler

SDL2 should have sdl2-config app that provides information for building. But it is strange that you are still getting same error. Did you check if files were really removed from /usr/local/include/SDL2/? You can try to edit cmake_modules/FindSDL2.cmake and remove all searching paths and left only /Library/Frameworks/. Also I suggest to remove all SDL versions and install only one from brew.

mwydmuch avatar Feb 12 '18 23:02 mwydmuch

I found a solution. The problem is that /Library/Frameworks/SDL.framework version 1 is being used even if cmake says it found the installed SDL2 version. Can this be caused because "sdl.h" is used in vizdoom? Is there something like "sdl2.h?"

BSVogler avatar Feb 13 '18 17:02 BSVogler

No, SDL2 doesn't use '2' in its headers, sdl.h is correct include for SDL2.

mwydmuch avatar Feb 13 '18 17:02 mwydmuch

Old issue, closing.

mwydmuch avatar Dec 02 '22 02:12 mwydmuch