Page 1 of 1

Python make errors

Posted: Sun Oct 28, 2012 5:26 am
by segfault
Hey there, just trying to compile on Arch from latest SVN (revision 13423) and getting the following out of cmake:

Code: Select all

In file included from /home/luke/Src/VegaStrike/vegastrike/src/cmd/ai/aggressive.cpp:24:0:
/home/luke/Src/VegaStrike/vegastrike/src/vs_random.h: In member function 'unsigned int VSRandom::genrand_int32()':
/home/luke/Src/VegaStrike/vegastrike/src/vs_random.h:132:57: warning: narrowing conversion of 'VSRandom::MATRIX_A()' from 'int' to 'unsigned int' inside { } is ill-formed in C++11 [-Wnarrowing]
In file included from /home/luke/Src/VegaStrike/vegastrike/src/cmd/ai/aggressive.cpp:25:0:
/home/luke/Src/VegaStrike/vegastrike/src/python/python_compile.h: In member function 'PyObject* PythonBasicType::NewObject() const':
/home/luke/Src/VegaStrike/vegastrike/src/python/python_compile.h:43:57: error: 'PyString_FromString' was not declared in this scope
/home/luke/Src/VegaStrike/vegastrike/src/cmd/ai/aggressive.cpp: In member function 'bool Orders::AggressiveAI::ProcessCurrentFgDirective(Flightgroup*)':
/home/luke/Src/VegaStrike/vegastrike/src/cmd/ai/aggressive.cpp:759:22: warning: unused variable 'callme' [-Wunused-variable]
make[2]: *** [CMakeFiles/engine_com.dir/src/cmd/ai/aggressive.o] Error 1
make[1]: *** [CMakeFiles/engine_com.dir/all] Error 2
make: *** [all] Error 2

Looking online a bit I found that in the new Python3 PyString_FromString() call seems to have been replaced by PyBytes_FromString() according to this post:
https://github.com/OpenImageIO/oiio/issues/197

A quick grep of the source shows the depricated call being used in other files as well. Just wondering if I should sumbit this as a bug and work on fixing it or do I just have an incorrect version of python?
I am running Python 3.3.0-1 it looks like.

I also just hit another error also linked to python it looks like;

Code: Select all

/home/luke/Src/VegaStrike/vegastrike/src/python/python_compile.cpp: In function 'void CompileRunPython(const string&)':
/home/luke/Src/VegaStrike/vegastrike/src/python/python_compile.cpp:85:84: error: cannot convert 'PyCodeObject*' to 'PyObject* {aka _object*}' for argument '1' to 'PyObject* PyEval_EvalCode(PyObject*, PyObject*, PyObject*)'
make[2]: *** [CMakeFiles/engine_com.dir/src/python/python_compile.o] Error 1
make[1]: *** [CMakeFiles/engine_com.dir/all] Error 2
make: *** [all] Error 2
Will dig into this error a little as well.
Thanks.

Re: Python make errors

Posted: Sun Oct 28, 2012 5:58 am
by klauss
That's because you're building against python3. We don't support python3 yet.

Re: Python make errors

Posted: Sun Oct 28, 2012 6:00 am
by segfault
perfect, will downgrade.

Thanks for the quick reply... you are a machine, Klauss.

Re: Python make errors

Posted: Sun Oct 28, 2012 6:07 am
by segfault
..... do we want to support Python3?
Wonder how much work it would be to convert.

Re: Python make errors

Posted: Sun Oct 28, 2012 3:53 pm
by loki1950
Going to have too before too long ;) BTW you did not need to down grade from 3 you just needed to install 2.6 and the relevant dev libraries.


Enjoy the Choice :)

Re: Python make errors

Posted: Sun Oct 28, 2012 10:12 pm
by segfault
Ah, thanks. Good to know.

Re: Python make errors

Posted: Mon Oct 29, 2012 12:57 am
by klauss
segfault wrote:..... do we want to support Python3?
Wonder how much work it would be to convert.
Well, I'm pretty sure most of our python code won't work in python3, so we'd have to stick to one version or carry multiple versions of the code. I'm leaning towards the first, but we can't stick to 3 just yet, it'd make it harder for the folks running old distros.

I'm not sure we can make our python code work with both versions. So, until distributions start pushing py3 as default, I'd stick with py2.

Re: Python make errors

Posted: Tue Nov 13, 2012 9:49 am
by nanite
Just to follow up on this... Since the prebuilt Ubuntu 12.04 package isn't compatible with the current Ubuntu (12.10) I decided to try to compile it. I initially got the same error as the original poster.

I noticed that the CMake spits out the following:

Code: Select all

Found PythonLibs: /usr/lib/python3.2/config/libpython3.2.so (found version "2.7.3") 
If python3-dev happens to be installed then it's even worse:

Code: Select all

Found PythonLibs: /usr/lib/libpython3.2mu.so (found version "3.2.3") 
So as the original poster indicated, it is probably necessary to totally deinstall python 3 to get the Cmake script to see python 2.7.


The ./configure script however seems to find python 2.7 correctly, ignoring python 3. The following is the output of grep -i python config.log

Code: Select all

| #define BOOST_PYTHON_NO_PY_SIGNATURES 1
| #define BOOST_PYTHON_STATIC_LIB 1
| #define BOOST_PYTHON_NO_PY_SIGNATURES 1
| #define BOOST_PYTHON_STATIC_LIB 1
| #define BOOST_PYTHON_NO_PY_SIGNATURES 1
| #define BOOST_PYTHON_STATIC_LIB 1
| #define BOOST_PYTHON_NO_PY_SIGNATURES 1
| #define BOOST_PYTHON_STATIC_LIB 1
| #define BOOST_PYTHON_NO_PY_SIGNATURES 1
| #define BOOST_PYTHON_STATIC_LIB 1
| #define BOOST_PYTHON_NO_PY_SIGNATURES 1
| #define BOOST_PYTHON_STATIC_LIB 1
| #define BOOST_PYTHON_NO_PY_SIGNATURES 1
| #define BOOST_PYTHON_STATIC_LIB 1
| #define BOOST_PYTHON_NO_PY_SIGNATURES 1
| #define BOOST_PYTHON_STATIC_LIB 1
configure:18031: Compiling with CPPFLAGS: -DBOOST_PYTHON_NO_PY_SIGNATURES -DBOOST_PYTHON_STATIC_LIB -I$(top_srcdir)/$(BOOSTDIR)/1_45    -DHAVE_SDL=1 -DSDL_WINDOWING=1      -DHAVE_AL=1   -DHAVE_OGG  -DNV_CUBE_MAP=1 -DHAVE_FFMPEG -D__STDC_CONSTANT_MACROS  -I/usr/include/python2.7 -DHAVE_PYTHON=1    -I$(top_srcdir)/src .
configure:18035: Compiling with LIBS:    -lvorbisfile -lvorbis -logg   -L/usr/lib/x86_64-linux-gnu -lSDL  -lGL  -lGLU -lXmu -lXi  -lglut  -lexpat  -lpng  -ljpeg  -lopenal  -lvorbisfile -lvorbis -logg  -lavcodec -lavformat -lavutil -lswscale -L/usr/lib -lpython2.7 -Xlinker -export-dynamic -pthread .
BOOST_CPPFLAGS='-DBOOST_PYTHON_NO_PY_SIGNATURES -DBOOST_PYTHON_STATIC_LIB -I$(top_srcdir)/$(BOOSTDIR)/1_45'
CPPFLAGS='-DBOOST_PYTHON_NO_PY_SIGNATURES -DBOOST_PYTHON_STATIC_LIB -I$(top_srcdir)/$(BOOSTDIR)/1_45    -DHAVE_SDL=1 -DSDL_WINDOWING=1      -DHAVE_AL=1   -DHAVE_OGG  -DNV_CUBE_MAP=1 -DHAVE_FFMPEG -D__STDC_CONSTANT_MACROS  -I/usr/include/python2.7 -DHAVE_PYTHON=1    -I$(top_srcdir)/src '
LIBS='   -lvorbisfile -lvorbis -logg   -L/usr/lib/x86_64-linux-gnu -lSDL  -lGL  -lGLU -lXmu -lXi  -lglut  -lexpat  -lpng  -ljpeg  -lopenal  -lvorbisfile -lvorbis -logg  -lavcodec -lavformat -lavutil -lswscale -L/usr/lib -lpython2.7 -Xlinker -export-dynamic -pthread '
PYTHON_CPPFLAGS=' -I/usr/include/python2.7 -DHAVE_PYTHON=1 '
PYTHON_LIBS='-L/usr/lib -lpython2.7 -Xlinker -export-dynamic'
#define BOOST_PYTHON_NO_PY_SIGNATURES 1
#define BOOST_PYTHON_STATIC_LIB 1

And one final unrelated thing, I found that I had to install the following to make CMake happy, in addition to the things mentioned on the wiki page http://wiki.vega-strike.org/HowTo:Compile_from_SVN

Code: Select all

apt-get install libavcodec-dev libavformat-dev libavutil-dev  libogre-dev  libswscale-dev

Re: Python make errors

Posted: Tue Nov 13, 2012 9:51 am
by nanite
Ah but to follow up to the last message, now I get this error during the make:

Code: Select all

./src/resizable.h:19:9: error: ‘memcpy’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
Never mind, I just should have done ./configure --enable-permissive as explained in this other thread http://forums.vega-strike.org/viewtopic.php?f=5&t=18164

Re: Python make errors

Posted: Tue Nov 13, 2012 12:47 pm
by klauss
I see. We have to fix our configure scripts to let them know py3 is no good.

Notice tough that we do have 12.10 builds now. I'll update the 0.5.1 announcement with a link to them.

Re: Python make errors

Posted: Thu Jan 24, 2013 10:35 am
by shahidjee
Thats why I decided to use the ifdef. The server code doesn't need sound event while the client does. Though I wrongly assumed that the CLIENT define from my earlier win32 code would have also been used for all OSes. I can add the required files into the win32 build but I don't see any real need for it to be there on any build since the server does use sound events. Same for a lot of things. Doesn't need to render anything or use any shaders.. no need for sound, though it may need mesh code if it does any collision testing (and it has access to a collision mesh).

*EDIT* Anyone else find their threads hijacked by new users?

Re: Python make errors

Posted: Thu Jan 24, 2013 4:20 pm
by klauss
This seems to be on the wrong topic. But, in any case, please notice SoundContainer contains no sound in itself, and the instance of SoundContainer created in the server is pretty much empty. If that is undesirable, we discussed a way to get around even that with pheonixstorm, I'd have to dig the conversation up. I don't think it's worth it, they only exist for the player.

Re: Python make errors

Posted: Sat Feb 16, 2013 11:27 pm
by Eutrot
Actually, using ccmake resolves the problem without removing python3 from the system.

I experienced the same error (PyString_FromString not found during compilation). I am running Debian Wheezy and have Python3 installed.

I have used the procedure recommended here : http://wiki.vega-strike.org/HowTo:Compile_from_SVN.

However when running ccmake, after pressing "c" to autoconfigure :
- I pressed "t" to toggle advanced mode,
- then I scrolled to the options PYTHON_INCLUDE_DIR and PYTHON_LIBRARY, which were set to Python3 paths,
- I set them respectively to /usr/include/python2.7 and /usr/lib/libpython2.7.a
- I pressed "c" again, then "g".

Then I could compile Vega Strike with make without any error.

Re: Python make errors

Posted: Sun Feb 17, 2013 12:56 am
by loki1950
Welcome aboard Eutrot that's a simple workaround that keeps things whole in system land :)

Enjoy the Choice :)

Re: Python make errors

Posted: Sun Feb 17, 2013 2:07 am
by Eutrot
Thank you Loki. I suppose that's just what ccmake is for...

Re: Python make errors

Posted: Sun Feb 17, 2013 2:36 am
by klauss
Yes. You ought to be able to do a similar thing in autotools land with configure --with-python=2.7