vayerx / shadowgrounds

Shadowgrounds and Shadowgrounds Survivor games
Other
53 stars 18 forks source link

SDLMAIN_LIBRARY not set in cmake #15

Closed montaropdf closed 8 years ago

montaropdf commented 8 years ago

Hi,

I am trying to compile the game but I face the following issue:

[roland@farsight build]$ cmake -DCMAKE_BUILD_TYPE=Release ..
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Boost version: 1.55.0
-- Found the following Boost libraries:
--   program_options
--   thread
--   system
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found SDL: /usr/lib64/libSDL.so;-lpthread (found version "1.2.15") 
-- Found SDL_sound: /usr/lib64/libSDL_sound.so (found version "1.0.3") 
-- Found VORBIS: /usr/include  
-- Found SDL_image: /usr/lib64/libSDL_image.so (found version "1.2.12") 
-- Found SDL_ttf: /usr/lib64/libSDL_ttf.so (found version "2.0.11") 
-- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so
-- Looking for XOpenDisplay in /usr/lib64/libX11.so;/usr/lib64/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib64/libX11.so
-- Found OpenGL: /usr/lib64/libGL.so  
-- Found GTK2_GTK: /usr/lib64/libgtk-x11-2.0.so  
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.8") 
-- Found OpenAL: /usr/lib64/libopenal.so  
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.28") 
-- checking for module 'libavcodec'
--   found libavcodec, version 56.1.100
-- checking for module 'libavformat'
--   found libavformat, version 56.4.101
-- checking for module 'libavdevice'
--   found libavdevice, version 56.0.100
-- checking for module 'libavutil'
--   found libavutil, version 54.7.100
-- checking for module 'libswscale'
--   found libswscale, version 3.0.100
-- checking for module 'libpostproc'
--   found libpostproc, version 53.0.100
-- Found FFmpeg: /usr/lib64/libavcodec.so;/usr/lib64/libavformat.so;/usr/lib64/libavutil.so  
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
SDLMAIN_LIBRARY
    linked by target "shadowgrounds" in directory /home/roland/games/git/shadowgrounds
    linked by target "survivor" in directory /home/roland/games/git/shadowgrounds

-- Configuring incomplete, errors occurred!
See also "/home/roland/games/git/shadowgrounds/build/CMakeFiles/CMakeOutput.log".
See also "/home/roland/games/git/shadowgrounds/build/CMakeFiles/CMakeError.log".

I am working on a Fedora Linux 21 64 bits.

Below is the list of packages installed related to SDL on my system:

SDL.i686                                                                                 1.2.15-17.fc21
SDL.x86_64                                                                               1.2.15-17.fc21
SDL-devel.x86_64                                                                         1.2.15-17.fc21
SDL2.i686                                                                                2.0.3-5.fc21
SDL2.x86_64                                                                              2.0.3-5.fc21
SDL2_image.i686                                                                          2.0.0-7.fc21
SDL2_image.x86_64                                                                        2.0.0-7.fc21
SDL_image.i686                                                                           1.2.12-11.fc21
SDL_image.x86_64                                                                         1.2.12-11.fc21
SDL_image-devel.x86_64                                                                   1.2.12-11.fc21
SDL_mixer.i686                                                                           1.2.12-10.fc21
SDL_mixer.x86_64                                                                         1.2.12-10.fc21
SDL_sound.i686                                                                           1.0.3-14.fc21
SDL_sound.x86_64                                                                         1.0.3-14.fc21
SDL_sound-devel.x86_64                                                                   1.0.3-14.fc21
SDL_ttf.i686                                                                             2.0.11-6.fc21
SDL_ttf.x86_64                                                                           2.0.11-6.fc21
SDL_ttf-devel.x86_64                                                                     2.0.11-6.fc21

What can I possibly miss that prevent cmake from preparing the compilation?

Thanks.

vayerx commented 8 years ago

Hi,

Looks like cmake was not able to find SDL core library. From cmake's FindSDL.cmake:

Additional Note: If you see an empty SDL_LIBRARY_TEMP in your configuration and no SDL_LIBRARY, it means CMake did not find your SDL library (SDL.dll, libsdl.so, SDL.framework, etc). Set SDL_LIBRARY_TEMP to point to your SDL library, and configure again. Similarly, if you see an empty SDLMAIN_LIBRARY, you should set this value as appropriate. These values are used to generate the final SDL_LIBRARY variable, but when these values are unset, SDL_LIBRARY does not get created.

Does 64-bit version of libSDL.so exist in default libraries location (/usr/lib/ or /usr/lib64/)? It should be installed by SDL.x86_64, I guess. Make sure it is SDL-1, but not SDL-2. What cmake version do you use?

montaropdf commented 8 years ago

Details on libSDL.so:

[roland@farsight build]$ ls -l /usr/lib64/libSDL.so
lrwxrwxrwx. 1 root root 20 15 aoû  2014 /usr/lib64/libSDL.so -> libSDL-1.2.so.0.11.4

Version of CMake is 3.0.2

vayerx commented 8 years ago

As I can see in cmake-3.5's FindSDL.cmake, there is hardcoded version of SDLmain library:

find_library(SDLMAIN_LIBRARY NAMES SDLmain SDLmain-1.1

I've got /usr/lib64/libSDLmain.a on my machine. Maybe there is a versioned libSDLmain on yours? If you are using SDL-1.2 this could be a problem. Could you please run cmake with following additional arguments: -DSDL_LIBRARY_TEMP=/usr/lib64/libSDL.so -DSDLMAIN_LIBRARY=PATH-TO-YOUR-SDLmain-LIBRARY

montaropdf commented 8 years ago

SDLmain was not installed on my system, after spending sometimes searching I find the package that contained it. I install it and cmake and make works as described in the wiki/build.

The package for fedora 21 is SDL-static.x86_64, maybe you could add this to the wiki.

I don't really get it on how to specify the location of the data files. The --data argument must be provided to cmake or make?

vayerx commented 8 years ago

You can specify data location at run-time: shadowgrounds --data=/usr/share/games/shadowgrounds. You can also change the default path at compile-time: cmake -DSHADOWGROUNDS_DATA_PATH=/usr/share/games/shadowgrounds ... or via CMAKE_DATA_PATH -- it is a prefix of data directory: /usr/share/games/shadowgrounds . Similarly for Survivor.

$ shadowgrounds --help
Shadowgrounds for Linux, version 1.0.4
  -h [ --help ]                         Display this help message
  -v [ --version ]                      Display the game version
  -w [ --windowed ]                     Run the game windowed
  -f [ --fullscreen ]                   Run the game in fullscreen mode
  -s [ --nosound ]                      Do not access the sound card
  -m [ --nomouse ]                      Disable mouse
  -k [ --nokeyboard ]                   Disable keyboard
  -j [ --nojoystick ]                   Disable joystick
  -d [ --data ] arg (=/usr/share/games/shadowgrounds)
                                        Path to game-data directory

I'll update wiki in a few days.

montaropdf commented 8 years ago

Thanks. I can start shadowgrounds (I have not installed my copy of survivor yet), but it crashes at some point. I will open an issue for it.