cxong / cdogs-sdl

Classic overhead run-and-gun game
https://cxong.github.io/cdogs-sdl/
GNU General Public License v2.0
891 stars 114 forks source link

Build failing for me on Mac, can't find SDL frameworks #502

Closed dsouth closed 7 years ago

dsouth commented 7 years ago

On my Mac (OSX 10.10.5) I've used the build/macosx/install-sdl2.sh script to install the SDL frameworks and then run cmake:

$ cmake .
-- The C compiler identification is AppleClang 6.0.0.6000057
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.29.1") 
-- Checking for one of the modules 'sdl2'
-- Checking for one of the modules 'SDL2_image'
-- Checking for one of the modules 'SDL2_mixer'
-- Found OpenGL: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/OpenGL.framework  
Data dir is ../
-- The CXX compiler identification is AppleClang 6.0.0.6000057
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for fcntl
-- Looking for fcntl - found
-- Looking for poll
-- Looking for poll - found
-- Looking for inet_pton
-- Looking for inet_pton - found
-- Looking for inet_ntop
-- Looking for inet_ntop - found
-- Performing Test HAS_MSGHDR_FLAGS
-- Performing Test HAS_MSGHDR_FLAGS - Success
-- Check size of socklen_t
-- Check size of socklen_t - done
INSTALL_NAME_DIR: /usr/local/lib
running /usr/local/Cellar/cmake/3.5.2/bin/cmake -E copy_if_different /Users/dsouth/development/code/games/cdogs-sdl/src/cdogs/yajl/api/yajl_parse.h /Users/dsouth/development/code/games/cdogs-sdl/src/cdogs/yajl/..//include/yajl  2>&1
running /usr/local/Cellar/cmake/3.5.2/bin/cmake -E copy_if_different /Users/dsouth/development/code/games/cdogs-sdl/src/cdogs/yajl/api/yajl_gen.h /Users/dsouth/development/code/games/cdogs-sdl/src/cdogs/yajl/..//include/yajl  2>&1
running /usr/local/Cellar/cmake/3.5.2/bin/cmake -E copy_if_different /Users/dsouth/development/code/games/cdogs-sdl/src/cdogs/yajl/api/yajl_common.h /Users/dsouth/development/code/games/cdogs-sdl/src/cdogs/yajl/..//include/yajl  2>&1
running /usr/local/Cellar/cmake/3.5.2/bin/cmake -E copy_if_different /Users/dsouth/development/code/games/cdogs-sdl/src/cdogs/yajl/api/yajl_tree.h /Users/dsouth/development/code/games/cdogs-sdl/src/cdogs/yajl/..//include/yajl  2>&1
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/dsouth/development/code/games/cdogs-sdl

and then make, but make fails:

$ make
Scanning dependencies of target json
[  1%] Building C object src/json/CMakeFiles/json.dir/json.c.o
[  1%] Linking C static library libjson.a
[  1%] Built target json
Scanning dependencies of target enet
[  1%] Building C object src/cdogs/enet/CMakeFiles/enet.dir/callbacks.c.o
[  2%] Building C object src/cdogs/enet/CMakeFiles/enet.dir/compress.c.o
[  2%] Building C object src/cdogs/enet/CMakeFiles/enet.dir/host.c.o
[  3%] Building C object src/cdogs/enet/CMakeFiles/enet.dir/list.c.o
[  3%] Building C object src/cdogs/enet/CMakeFiles/enet.dir/packet.c.o
[  4%] Building C object src/cdogs/enet/CMakeFiles/enet.dir/peer.c.o
[  4%] Building C object src/cdogs/enet/CMakeFiles/enet.dir/protocol.c.o
[  4%] Building C object src/cdogs/enet/CMakeFiles/enet.dir/unix.c.o
[  5%] Building C object src/cdogs/enet/CMakeFiles/enet.dir/win32.c.o
[  5%] Linking C static library libenet.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libenet.a(win32.c.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libenet.a(win32.c.o) has no symbols
[  5%] Built target enet
Scanning dependencies of target c_hashmap
[  6%] Building C object src/cdogs/c_hashmap/CMakeFiles/c_hashmap.dir/hashmap.c.o
[  6%] Linking C static library libc_hashmap.a
[  6%] Built target c_hashmap
Scanning dependencies of target SDL_joystickbuttonnames
[  6%] Building C object src/cdogs/SDL_JoystickButtonNames/CMakeFiles/SDL_joystickbuttonnames.dir/SDL_joystickbuttonnames.c.o
In file included from /Users/dsouth/development/code/games/cdogs-sdl/src/cdogs/SDL_JoystickButtonNames/SDL_joystickbuttonnames.c:25:
/Users/dsouth/development/code/games/cdogs-sdl/src/cdogs/SDL_JoystickButtonNames/SDL_joystickbuttonnames.h:28:10: fatal error: 
      'SDL_gamecontroller.h' file not found
#include <SDL_gamecontroller.h>
         ^
1 error generated.
make[2]: *** [src/cdogs/SDL_JoystickButtonNames/CMakeFiles/SDL_joystickbuttonnames.dir/SDL_joystickbuttonnames.c.o] Error 1
make[1]: *** [src/cdogs/SDL_JoystickButtonNames/CMakeFiles/SDL_joystickbuttonnames.dir/all] Error 2
make: *** [all] Error 2

The frameworks have been installed in /Library/Frameworks and the header file it can find is in the framework.

cxong commented 7 years ago

Can't reproduce your problem ☹️ what is the value of SDL2_INCLUDE_DIRS in your cmake? It should be /Library/Frameworks/SDL2.framework/Headers

dsouth commented 7 years ago

Probably something I did on my end. Apparently had a few libraries 'lying about' on my system that made the build process unhappy. I've cleaned them up and the build is a bit happier now. SDL2_INCLUDE_DIRS now points to /Library/Frameworks/SDL2.framework/Headers. However I now get a new build failure:

...
Scanning dependencies of target minkowski_hex_test
[ 82%] Building C object src/tests/CMakeFiles/minkowski_hex_test.dir/minkowski_hex_test.c.o
[ 83%] Building C object src/tests/CMakeFiles/minkowski_hex_test.dir/__/cdogs/collision/minkowski_hex.c.o
[ 83%] Building C object src/tests/CMakeFiles/minkowski_hex_test.dir/__/cdogs/utils.c.o
In file included from /Users/dsouth/development/code/games/cdogs-sdl/src/cdogs/utils.c:60:
In file included from /Users/dsouth/development/code/games/cdogs-sdl/src/cdogs/events.h:34:
In file included from /Users/dsouth/development/code/games/cdogs-sdl/src/cdogs/player.h:30:
In file included from /Users/dsouth/development/code/games/cdogs-sdl/src/cdogs/character.h:33:
In file included from /Users/dsouth/development/code/games/cdogs-sdl/src/cdogs/weapon.h:51:
In file included from /Users/dsouth/development/code/games/cdogs-sdl/src/cdogs/bullet_class.h:56:
In file included from /Users/dsouth/development/code/games/cdogs-sdl/src/cdogs/sounds.h:53:
/Library/Frameworks/SDL2_mixer.framework/Headers/SDL_mixer.h:27:10: fatal error: 'SDL2/SDL_stdinc.h' file not found
#include <SDL2/SDL_stdinc.h>
         ^
1 error generated.
make[2]: *** [src/tests/CMakeFiles/minkowski_hex_test.dir/__/cdogs/utils.c.o] Error 1
make[1]: *** [src/tests/CMakeFiles/minkowski_hex_test.dir/all] Error 2
make: *** [all] Error 2

SDL_stdin.h is in /Library/Frameworks/SDL2.framework/Headers so I'm a bit confused about that one...

dsouth commented 7 years ago

Confirmed this fixes the new build failure. Thanks!