karolherbst / Gamekeeper-Framework

Library for hooking up game stores and merging them into one single library
GNU Lesser General Public License v2.1
2 stars 0 forks source link

Compiling with option WITH_PYTHON_BINDINGS=ON fails on Python >=3.3. #122

Closed makson96 closed 9 years ago

makson96 commented 9 years ago

System: Xubuntu 14.04 64 bit. Command: cmake .. -DCMAKE_INSTALL_PREFIX=/home/tomek/Publiczny/Gamekeeper-Framework/install -DBUILD_PROTOTYPES=ON -DWITH_NCURSES=ON -DWITH_PYTHON_BINDINGS=ON Output:

-- The C compiler identification is GNU 4.8.2
-- The CXX compiler identification is GNU 4.8.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
-- using GCC
-- 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  
-- Could NOT find HYPODERMIC (missing:  HYPODERMIC_LIBRARIES HYPODERMIC_INCLUDE_DIRS) 
-- Boost version: 1.54.0
-- Found the following Boost libraries:
--   filesystem
--   program_options
--   system
--   signals
-- Found CURL: /usr/lib/x86_64-linux-gnu/libcurl.so (found version "7.35.0") 
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26") 
-- checking for module 'jansson'
--   found jansson, version 2.5
-- Found JANSSON: jansson  
-- checking for module 'log4cpp'
--   found log4cpp, version 1.0
-- Found LOG4CPP: log4cpp;nsl  
-- checking for module 'pugixml'
--   package 'pugixml' not found
-- Found PUGIXML: /usr/lib/x86_64-linux-gnu/libpugixml.so  
-- Found SWIG: /usr/bin/swig2.0 (found version "2.0.11") 
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.4m.so (found suitable version "3.4.0", minimum required is "3") 
-- cotire 1.6.3 loaded.
-- CXX target gamekeeperModel cotired without precompiled header. Too few applicable sources.
-- CXX target gamekeeperClient cotired.
-- CXX target gamekeeperClientMain cotired without precompiled header. Too few applicable sources.
-- CXX target gamekeeperCore cotired.
-- CXX target gamekeeperBackend cotired.
-- CXX target GenericPrototype cotired without precompiled header. Too few applicable sources.
-- checking for module 'cwidget'
--   found cwidget, version 0.5.16
-- Found CWIDGET: cwidget;ncursesw;sigc-2.0  
-- CXX target CursesPrototype cotired without precompiled header. Too few applicable sources.
-- CXX target HBPrototype cotired without precompiled header excluding /home/tomek/Publiczny/Gamekeeper-Framework/tests/prototyping/hb1/hbprototype.py. Too few applicable sources.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/tomek/Publiczny/Gamekeeper-Framework/build_dir

Command: make install Error Output:

[ 94%] Building CXX object src/bindings/model/python/CMakeFiles/_GameKeeperModelPy.dir/__/gamePYTHON_wrap.cxx.o

/home/tomek/Publiczny/Gamekeeper-Framework/build_dir/src/bindings/model/python/../gamePYTHON_wrap.cxx:4184:38: error: expected primary-expression before ‘,’ token
     (Py_ssize_t)offsetof(SwigPyObject, dict), /* tp_dictoffset */
                                      ^
/home/tomek/Publiczny/Gamekeeper-Framework/build_dir/src/bindings/model/python/../gamePYTHON_wrap.cxx:4184:40: error: ‘dict’ was not declared in this scope
     (Py_ssize_t)offsetof(SwigPyObject, dict), /* tp_dictoffset */
                                        ^
/home/tomek/Publiczny/Gamekeeper-Framework/build_dir/src/bindings/model/python/../gamePYTHON_wrap.cxx:4184:44: error: ‘offsetof’ was not declared in this scope
     (Py_ssize_t)offsetof(SwigPyObject, dict), /* tp_dictoffset */
                                            ^
make[2]: *** [src/bindings/model/python/CMakeFiles/_GameKeeperModelPy.dir/__/gamePYTHON_wrap.cxx.o] Error 1
make[1]: *** [src/bindings/model/python/CMakeFiles/_GameKeeperModelPy.dir/all] Error 2
make: *** [all] Error 2

Removing "-builtin" from " Gamekeeper-Framework/src/bindings/model/python/CMakeLists.txt" solves the issue

karolherbst commented 9 years ago

I am pretty sure this is a bug in swig: http://sourceforge.net/p/swig/bugs/1345/

I never encountered this issue on any of my machines (swig-2.0.12 and swig-2.0.10 or 2.0.8?)

Jookia commented 9 years ago

Arch has 3.0.2. Could you try using 2.0.12, makson?

karolherbst commented 9 years ago

seems to be fixed for swig-3.0.0: https://github.com/swig/swig/commit/0e54a51c104ecf1c1a68892132d9506890a99036 swig-2.0.12: https://github.com/swig/swig/commit/5602a61bb6fa2b6de419c251fceb2e5cd499893d

karolherbst commented 9 years ago

the thing is, how should we handle this case? According to http://www.swig.org/Doc2.0/Python.html#Python_builtin_types it may be not good to support both ways

karolherbst commented 9 years ago

it also fails with python3.3

karolherbst commented 9 years ago

I think we will go with requiring swig-2.0.12

Jookia commented 9 years ago

If worst comes to worst you could always just disable Python bindings given 3.3 or higher with a low SWIG version.

karolherbst commented 9 years ago

or just install a newer one