Python make errors

Trying to build your own version of Vega Strike and having problems? Unix users, paste your config.log here (stderr output alone is not helpful).
Post Reply
segfault
Merchant
Merchant
Posts: 39
Joined: Tue Aug 17, 2010 3:50 am
Location: Ottawa, Canada

Python make errors

Post 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.
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Python make errors

Post by klauss »

That's because you're building against python3. We don't support python3 yet.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
segfault
Merchant
Merchant
Posts: 39
Joined: Tue Aug 17, 2010 3:50 am
Location: Ottawa, Canada

Re: Python make errors

Post by segfault »

perfect, will downgrade.

Thanks for the quick reply... you are a machine, Klauss.
segfault
Merchant
Merchant
Posts: 39
Joined: Tue Aug 17, 2010 3:50 am
Location: Ottawa, Canada

Re: Python make errors

Post by segfault »

..... do we want to support Python3?
Wonder how much work it would be to convert.
loki1950
The Shepherd
Posts: 5841
Joined: Fri May 13, 2005 8:37 pm
Location: Ottawa
Contact:

Re: Python make errors

Post 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 :)
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 19.2/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and Lenovo ideapad 320-15ARB Win 10/Mint 19.2
segfault
Merchant
Merchant
Posts: 39
Joined: Tue Aug 17, 2010 3:50 am
Location: Ottawa, Canada

Re: Python make errors

Post by segfault »

Ah, thanks. Good to know.
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Python make errors

Post 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.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
nanite
Insys Pilot
Insys Pilot
Posts: 2
Joined: Tue Nov 13, 2012 9:15 am

Re: Python make errors

Post 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
nanite
Insys Pilot
Insys Pilot
Posts: 2
Joined: Tue Nov 13, 2012 9:15 am

Re: Python make errors

Post 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
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Python make errors

Post 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.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
shahidjee
Atmospheric Pilot
Atmospheric Pilot
Posts: 1
Joined: Thu Jan 24, 2013 10:32 am

Re: Python make errors

Post 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?
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Python make errors

Post 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.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
Eutrot
Insys Pilot
Insys Pilot
Posts: 2
Joined: Sat Feb 16, 2013 10:16 pm

Re: Python make errors

Post 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.
loki1950
The Shepherd
Posts: 5841
Joined: Fri May 13, 2005 8:37 pm
Location: Ottawa
Contact:

Re: Python make errors

Post by loki1950 »

Welcome aboard Eutrot that's a simple workaround that keeps things whole in system land :)

Enjoy the Choice :)
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 19.2/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and Lenovo ideapad 320-15ARB Win 10/Mint 19.2
Eutrot
Insys Pilot
Insys Pilot
Posts: 2
Joined: Sat Feb 16, 2013 10:16 pm

Re: Python make errors

Post by Eutrot »

Thank you Loki. I suppose that's just what ccmake is for...
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Re: Python make errors

Post by klauss »

Yes. You ought to be able to do a similar thing in autotools land with configure --with-python=2.7
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
Post Reply