Grumbel / sdl-jstest

Simple SDL joystick test application for the console
GNU General Public License v3.0
57 stars 32 forks source link

Compilation fails #9

Closed Chais closed 7 years ago

Chais commented 7 years ago

I get this on Archlinux when trying to build.

$ cmake .                                                                                                                                                             12:24 
-- The C compiler identification is GNU 7.2.0
-- The CXX compiler identification is GNU 7.2.0
-- 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
-- Detecting C compile features
-- Detecting C compile features - 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
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Curses: /usr/lib/libcurses.so  
-- Looking for pthread.h
-- Looking for 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/lib/libSDLmain.a;/usr/lib/libSDL.so;-lpthread (found version "1.2.15") 
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2") 
-- Checking for one of the modules 'sdl2'
-- docbook2x-man: not found
-- Configuring done
-- Generating done
-- Build files have been written to: /home/chais/AUR/sdl2-jstest-git/src/sdl-jstest
$ make
Scanning dependencies of target sdl2-jstest
[ 25%] Building C object CMakeFiles/sdl2-jstest.dir/sdl2-jstest.c.o
[ 50%] Linking C executable sdl2-jstest
/usr/bin/ld: CMakeFiles/sdl2-jstest.dir/sdl2-jstest.c.o: undefined reference to symbol 'stdscr'
/usr/lib/libtinfo.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/sdl2-jstest.dir/build.make:97: sdl2-jstest] Error 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/sdl2-jstest.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

Versions:
ncurses 6.0+20170902
sdl2 2.0.7
docbook2x 0.8.8

Grumbel commented 7 years ago

Something wrong with ncurses/tinfo. stdscr is provided by libtinfo, so it's probably missing a -ltinfo, cmake should however check for that. You could try:

Make sure that tinfo is installed.

In CMakeLists.txt add the line:

set(CURSES_NEED_NCURSES TRUE)

before:

find_package(Curses REQUIRED)

compile with:

make VERBOSE=1

Start compilation from a clean checkout if you haven't. ncurses6 is relatively new, no there might be issues when it was previously compiled with ncurses5.

Chais commented 7 years ago

It compiles fine with the the variable set, thanks.

$ make VERBOSE=1                                                                                                                                                  15:24 
/usr/bin/cmake -H/home/chais/AUR/sdl2-jstest-git/src/sdl-jstest -B/home/chais/AUR/sdl2-jstest-git/src/sdl-jstest --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/chais/AUR/sdl2-jstest-git/src/sdl-jstest/CMakeFiles /home/chais/AUR/sdl2-jstest-git/src/sdl-jstest/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/chais/AUR/sdl2-jstest-git/src/sdl-jstest'
make -f CMakeFiles/sdl2-jstest.dir/build.make CMakeFiles/sdl2-jstest.dir/depend
make[2]: Entering directory '/home/chais/AUR/sdl2-jstest-git/src/sdl-jstest'
cd /home/chais/AUR/sdl2-jstest-git/src/sdl-jstest && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/chais/AUR/sdl2-jstest-git/src/sdl-jstest /home/chais/AUR/sdl2-jstest-git/src/sdl-jstest /home/chais/AUR/sdl2-jstest-git/src/sdl-jstest /home/chais/AUR/sdl2-jstest-git/src/sdl-jstest /home/chais/AUR/sdl2-jstest-git/src/sdl-jstest/CMakeFiles/sdl2-jstest.dir/DependInfo.cmake --color=
make[2]: Leaving directory '/home/chais/AUR/sdl2-jstest-git/src/sdl-jstest'
make -f CMakeFiles/sdl2-jstest.dir/build.make CMakeFiles/sdl2-jstest.dir/build
make[2]: Entering directory '/home/chais/AUR/sdl2-jstest-git/src/sdl-jstest'
[ 25%] Linking C executable sdl2-jstest
/usr/bin/cmake -E cmake_link_script CMakeFiles/sdl2-jstest.dir/link.txt --verbose=1
/usr/bin/cc  -std=c99  -rdynamic CMakeFiles/sdl2-jstest.dir/sdl2-jstest.c.o  -o sdl2-jstest -lSDL2 -lncurses -ltinfo -lform 
make[2]: Leaving directory '/home/chais/AUR/sdl2-jstest-git/src/sdl-jstest'
[ 50%] Built target sdl2-jstest
make -f CMakeFiles/doc.dir/build.make CMakeFiles/doc.dir/depend
make[2]: Entering directory '/home/chais/AUR/sdl2-jstest-git/src/sdl-jstest'
cd /home/chais/AUR/sdl2-jstest-git/src/sdl-jstest && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/chais/AUR/sdl2-jstest-git/src/sdl-jstest /home/chais/AUR/sdl2-jstest-git/src/sdl-jstest /home/chais/AUR/sdl2-jstest-git/src/sdl-jstest /home/chais/AUR/sdl2-jstest-git/src/sdl-jstest /home/chais/AUR/sdl2-jstest-git/src/sdl-jstest/CMakeFiles/doc.dir/DependInfo.cmake --color=
Dependee "/home/chais/AUR/sdl2-jstest-git/src/sdl-jstest/CMakeFiles/doc.dir/DependInfo.cmake" is newer than depender "/home/chais/AUR/sdl2-jstest-git/src/sdl-jstest/CMakeFiles/doc.dir/depend.internal".
Dependee "/home/chais/AUR/sdl2-jstest-git/src/sdl-jstest/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/chais/AUR/sdl2-jstest-git/src/sdl-jstest/CMakeFiles/doc.dir/depend.internal".
Scanning dependencies of target doc
make[2]: Leaving directory '/home/chais/AUR/sdl2-jstest-git/src/sdl-jstest'
make -f CMakeFiles/doc.dir/build.make CMakeFiles/doc.dir/build
make[2]: Entering directory '/home/chais/AUR/sdl2-jstest-git/src/sdl-jstest'
make[2]: Nothing to be done for 'CMakeFiles/doc.dir/build'.
make[2]: Leaving directory '/home/chais/AUR/sdl2-jstest-git/src/sdl-jstest'
[ 50%] Built target doc
make -f CMakeFiles/sdl-jstest.dir/build.make CMakeFiles/sdl-jstest.dir/depend
make[2]: Entering directory '/home/chais/AUR/sdl2-jstest-git/src/sdl-jstest'
cd /home/chais/AUR/sdl2-jstest-git/src/sdl-jstest && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/chais/AUR/sdl2-jstest-git/src/sdl-jstest /home/chais/AUR/sdl2-jstest-git/src/sdl-jstest /home/chais/AUR/sdl2-jstest-git/src/sdl-jstest /home/chais/AUR/sdl2-jstest-git/src/sdl-jstest /home/chais/AUR/sdl2-jstest-git/src/sdl-jstest/CMakeFiles/sdl-jstest.dir/DependInfo.cmake --color=
Dependee "/home/chais/AUR/sdl2-jstest-git/src/sdl-jstest/CMakeFiles/sdl-jstest.dir/DependInfo.cmake" is newer than depender "/home/chais/AUR/sdl2-jstest-git/src/sdl-jstest/CMakeFiles/sdl-jstest.dir/depend.internal".
Dependee "/home/chais/AUR/sdl2-jstest-git/src/sdl-jstest/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/chais/AUR/sdl2-jstest-git/src/sdl-jstest/CMakeFiles/sdl-jstest.dir/depend.internal".
Scanning dependencies of target sdl-jstest
make[2]: Leaving directory '/home/chais/AUR/sdl2-jstest-git/src/sdl-jstest'
make -f CMakeFiles/sdl-jstest.dir/build.make CMakeFiles/sdl-jstest.dir/build
make[2]: Entering directory '/home/chais/AUR/sdl2-jstest-git/src/sdl-jstest'
[ 75%] Building C object CMakeFiles/sdl-jstest.dir/sdl-jstest.c.o
/usr/bin/cc  -I/usr/include/SDL  -std=c99   -o CMakeFiles/sdl-jstest.dir/sdl-jstest.c.o   -c /home/chais/AUR/sdl2-jstest-git/src/sdl-jstest/sdl-jstest.c
[100%] Linking C executable sdl-jstest
/usr/bin/cmake -E cmake_link_script CMakeFiles/sdl-jstest.dir/link.txt --verbose=1
/usr/bin/cc  -std=c99  -rdynamic CMakeFiles/sdl-jstest.dir/sdl-jstest.c.o  -o sdl-jstest -Wl,-Bstatic -lSDLmain -Wl,-Bdynamic -lSDL -lpthread -lncurses -ltinfo -lform 
make[2]: Leaving directory '/home/chais/AUR/sdl2-jstest-git/src/sdl-jstest'
[100%] Built target sdl-jstest
make[1]: Leaving directory '/home/chais/AUR/sdl2-jstest-git/src/sdl-jstest'
/usr/bin/cmake -E cmake_progress_start /home/chais/AUR/sdl2-jstest-git/src/sdl-jstest/CMakeFiles 0

I can see no other issues in the verbose output.