Problems trying to compile Ren'Py


doragasu

Member
Joined
Jun 2, 2008
Messages
325
Some months ago I started trying to port Ren'Py, had some problems (discussed here). Then I got out of time and paused the porting process.


Now I have some time to try again. I was able to compile most dependencies, but I'm stuck trying to compile pygame. The setup.py script outputs some warnings and then errors because it can't find "Python.h" (See line 33 of the error log. Sorry error message is in spanish, but it's something like "File or directory doesn't exist").


How can I find a suitable Python.h file? Do I have to compile Python to get it?


NOTE: Besides pygame and a lot more of dependencies are already available for Pandora, I'm recompiling them again because the build script provided in Ren'Py sources expect them to be recompiled and placed in a particular path. I can try to modify the script to not compile the dependencies and use the already available ones, but first I was trying the "compile everything" approach avoid doing this.
 
Last edited by a moderator:
I got to compile all dependencies excepting libGLEW (that I think is not mandatory, and I suppose it's not easily portable to Pandora) and Ren'Py.


I hope I will be able to solve the problem with Ren'Py.
 
I ALMOST got it.


I have compiled Python following this tutorial. Then tried to compile renpy module and it looks like all source files get compiled, but fails when linking, because the setup.py script is calling gcc to link, instead of arm-angstrom-linux-gnueabi-gcc.


Any ideas to make it work? I have tried defining LD=arm-angstrom-linux-gnueabi, but it didn't work :-(.


EDIT: This is the build log: http://pastebin.com/dbvRFdi7


As you can see, every source file is built, but the link step fails.
 
Last edited by a moderator:
Did you just use LD=arm-angstrom-linux-gnueabi or LD=arm-angstrom-linux-gnueabi-gcc ?
 
Code:
jalon@jalon-d:~/Pandora/renpy/renpy-6.13.7/module$ echo $LD

/usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-gcc


But if you have a look to the build log, it's obvious LD variable is ignored (it always calls 'gcc').


I have also tried defining LD_D (as I have seen googling a bit that some people define it) but also doesn't work.


I have also tried with grep, searching strings like "link" or "ld" inside the python setup code, but didn't find anything useful. (Too bad I don't know python).
 
The only coincidences are in binary files already compiled by the setup.py script:



Code:
jalon@jalon-d:~/Pandora/renpy/renpy-6.13.7/module$ grep -R gcc *

Coincidencia en el archivo binario build/temp.linux-i686-2.6/gen/_renpy.o

Coincidencia en el archivo binario build/temp.linux-i686-2.6/core.o

Coincidencia en el archivo binario build/temp.linux-i686-2.6/subpixel.o

Coincidencia en el archivo binario build/temp.linux-i686-2.6/rwobject.o

Coincidencia en el archivo binario build/temp.linux-i686-2.6/IMG_savepng.o
 
More information (maybe useful):



Code:
jalon@jalon-d:~/Pandora/renpy/renpy-6.13.7/module$ printenv | grep gcc

CC=/usr/local/angstrom/arm/bin/arm-angstrom-linux-gnueabi-gcc

HOST_CC=gcc


Despite I know it makes no sense, I also tried replacing HOST_CC=gcc with HOST_CC=arm-angstrom-linux-gnueabi-gcc. But as expected, it didn't affect the process. As always gcc is called.
 
Last edited by a moderator:
I don't know Python, but I'm trying to follow the code in setup.py and it looks like the module in charge of compilation and installation of renpy is called distutils. The script calls distutils, and distutils does its "magic".



Code:
def setup(name, version):

    """

    Calls the distutils setup function.

    """


    distutils.core.setup(

        name = name,

        version = version,

        ext_modules = extensions,

        py_modules = py_modules,

        )


I had a quick look to distutils documentation, but still I don't know from where it gets the linker command. Reading this, it looks like distutils reads the config file from 3 places:

  1. System: prefix/lib/pythonver/distutils/distutils.cfg: Doesn't exist in my system
  2. Personal: $HOME/.pydistutils.cfg: Doesn't exist
  3. Local: setup.cfg: Doesn't exist.


Any distutils gurus over here?
 
Last edited by a moderator:
I'm kind of a Distutils guru, but I've almost never had to deal with its interface to GCC.


But I can tell you that you can create a setup.cfg file without hassle. Put it in the same directory as setup.py; any options in the .cfg will override those in the .py, but otherwise the .py will behave the same.


Again, I'm not too familiar here, but try giving options to the "build" command. I'm guessing the "compiler" or "plat-name" options are the ones you want.


Speaking of, what exact commands are you running with the setup script? Also, I couldn't find the setup script in Ren'Py's source; if you could link me to it, I might be better able to help.


EDIT: Ah, I see in your build log that you're running install_lib. So passing options to build should help, I think.


EDIT2: Also found the setup script, and my analysis continues to be unchanged. Run "python setup.py build --help-compiler" to see what compilers are shown as available. Assuming your ARM compiler is in there, make a setup.cfg containing this:



Code:
[build]

compiler=<arm compiler identifier>
 
Last edited by a moderator:
Thanks a lot for help, I'm really stuck here.



Code:
jalon@jalon-d:~/Pandora/renpy/renpy-6.13.7/module$ python setup.py build --help-compiler

List of available compilers:

  --compiler=bcpp 	Borland C++ Compiler

  --compiler=cygwin   Cygwin port of GNU C Compiler for Win32

  --compiler=emx      EMX port of GNU C Compiler for OS/2

  --compiler=mingw32  Mingw32 port of GNU C Compiler for Win32

  --compiler=msvc 	Microsoft Visual C++

  --compiler=mwerks   MetroWerks CodeWarrior

  --compiler=unix 	standard UNIX-style compiler



It looks like the compiler I'm using is not listed :-(



Edit: Tried playing with the platform without luck. First I tried calling with the -p arm-angstrom-linux-gnueabi switch:





Code:
jalon@jalon-d:~/Pandora/renpy/renpy-6.13.7/module$ python setup.py install_lib -p arm-angstrom-linux-gnueabi -d $PYTHONPATH

usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]

   or: setup.py --help [cmd1 cmd2 ...]

   or: setup.py --help-commands

   or: setup.py cmd --help


error: option -p not recognized



Then created a setup.cfg file with the contents:





Code:
[build]

platform=arm-angstrom-linux-gnueabi





Code:
jalon@jalon-d:~/Pandora/renpy/renpy-6.13.7/module$ python setup.py install_lib -d $PYTHONPATH

running install_lib

error: error in setup.cfg: command 'build' has no such option 'platform'



Finally changed platform with plat-name in setup.cfg:



Code:
[build]

plat-name=arm-angstrom-linux-gnueabi





Code:
jalon@jalon-d:~/Pandora/renpy/renpy-6.13.7/module$ python setup.py install_lib -d $PYTHONPATH

running install_lib

error: --plat-name only supported on Windows (try using './configure --help' on your platform)
 
Last edited by a moderator:
I thought I almost got it, but I was wrong.


I found this code in sysconfig.py file, inside python/lib/python2.6/distutils directory:



Code:
def customize_compiler(compiler):

    """Do any platform-specific customization of a CCompiler instance.


    Mainly needed on Unix, so we can plug in the information that

    varies across Unices and is stored in Python's Makefile.

    """

    if compiler.compiler_type == "unix":

        (cc, cxx, opt, cflags, ccshared, ldshared, so_ext) = \

            get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',

                            'CCSHARED', 'LDSHARED', 'SO')


        if 'CC' in os.environ:

            cc = os.environ['CC']

        if 'CXX' in os.environ:

            cxx = os.environ['CXX']

        if 'LDSHARED' in os.environ:

            ldshared = os.environ['LDSHARED']

        if 'CPP' in os.environ:

            cpp = os.environ['CPP']

        else:

            cpp = cc + " -E"       	# not always

        if 'LDFLAGS' in os.environ:

            ldshared = ldshared + ' ' + os.environ['LDFLAGS']

        if 'CFLAGS' in os.environ:

            cflags = opt + ' ' + os.environ['CFLAGS']

            ldshared = ldshared + ' ' + os.environ['CFLAGS']

        if 'CPPFLAGS' in os.environ:

            cpp = cpp + ' ' + os.environ['CPPFLAGS']

            cflags = cflags + ' ' + os.environ['CPPFLAGS']

            ldshared = ldshared + ' ' + os.environ['CPPFLAGS']

Then I hurried up to define LDSHARED, CCSHARED and SO as "arm-angstrom-linux-gnueabi-gcc -shared", but again, nothing changes, gcc is called to link instead of arm-angstrom-linux-gnueabi-gcc :-(.


Also tried with and without using a setup.cfg file with compiler set to "unix".
 
Finally I solved this problem, with help from the original author and the #python channel in the IRC. The problem is I was calling python (the one installed in my Ubuntu distro) instead of hostpython (the one created in the cross-compiling process).


Now it doesn't completely build, but that's because it lacks lglew32 library. I'll have a look to the script to see if I can compile it without OpenGL support.
 
Got it to compile, and it's supposed to use OpenGL ES 2.0 :) . Too bad I have not my Pandora right here to test it...
 
Last edited by a moderator:
I have another question por Python experts. OK, I have everything cross-compiled, and now I want to test it. I have a directory with a lot of subdirectories with libraries, binaries, python scripts and a lot more useless things. I suppose I must add binaries to the PATH, and libraries to the LD_LIBRARY_PATH. The question is what do I have to do with python modules? I have compiled two modules. The first one is already in the pandora (pygame) and thus I suppose I can ignore it. The other module is Ren'Py module. How can I install it? I think usually modules are installed in /usr/lib/pythonX.Y/site-packages, but I don't know a way for a PND to put files there.


Can modules be installed in other places? How can I do it?


EDIT: The directory tree, in case anyone wants to have a look: http://pastebin.com/z7GdFx44
 
Last edited by a moderator:
Got it to run, using the Python package I compiled (that allows me to install it where I want and to put packages there).


shot1.png


shot2.png


Unfortunately, it doesn't run as expected. When it starts, warns because it starts in software mode, it's slow, and the worst of all, when you click a button (for example Start Game), the game window dissapears and this appears in the terminal:


http://pastebin.com/brXCW6V7


Could it be an issue with GLESv2? Should I try with GLESv1?
 
I have been working on this without much success. First the log of the engine showed an error message about not being able to load libGLEW.so, so I compiled libGLEW and tried again. Now the problem is it isn't able to load libGL.so.1. I noticed this library isn't distributed by default in the console, but is included in the SDK, so I copied the one in the SDK to the directory where the other libraries I'm compiling are. Tried again and nothing: Failed loading libGL.so.1.


I have verified libGL.so.1 has all permisions (rwx for all users) but this doesn't work. Do I need to run a command or something for this library to get registered? Is libGL only compatible with OpenGL and not with OpenGL ES?
 
Back
Top