Cross compilation problems
-
doragasu
- Newbie
- Posts: 14
- Joined: Mon Nov 14, 2011 11:27 am
- Projects: Port of Ren'Py to OpenPandora
- Contact:
Cross compilation problems
I'm trying to cross compile Ren'Py 6.13.7 to the OpenPandora console. As I'm far from being an expert in cross compiling, and I know almost nothing about Python, I'm facing a lot of problems. Compiling the dependencies has been a pain in the ass, but I have compiled almost all (libGLEW failed, but I think it's not mandatory).
Now I'm trying to compile renpy module, but I'm out of luck. It looks like compilation works, but linking fails, because the setup.py script is calling "gcc" instead of "arm-angstrom-linux-gnueabi-gcc" (the cross compiler/linker).
This is the build log: http://pastebin.com/dbvRFdi7
As you can see in line 14, gcc is called, but previous invocations to the compiler are properly made (i.e., line 12 calls arm-angstrom-linux-gnueabi-gcc).
I have also tried defining LD=arm-angstrom-linux-gnueabi-gcc and LD_D="arm-angstrom-linux-gnueabi-gcc -shared -Xlinker -x", but they have no effect, the scripts always calls "gcc" to link.
Any suggestions?
Now I'm trying to compile renpy module, but I'm out of luck. It looks like compilation works, but linking fails, because the setup.py script is calling "gcc" instead of "arm-angstrom-linux-gnueabi-gcc" (the cross compiler/linker).
This is the build log: http://pastebin.com/dbvRFdi7
As you can see in line 14, gcc is called, but previous invocations to the compiler are properly made (i.e., line 12 calls arm-angstrom-linux-gnueabi-gcc).
I have also tried defining LD=arm-angstrom-linux-gnueabi-gcc and LD_D="arm-angstrom-linux-gnueabi-gcc -shared -Xlinker -x", but they have no effect, the scripts always calls "gcc" to link.
Any suggestions?
- PyTom
- Ren'Py Creator
- Posts: 15893
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Cross compilation problems
Have you tried CC=arm-angstrom-linux-gnueabi-gcc ?
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom
-
doragasu
- Newbie
- Posts: 14
- Joined: Mon Nov 14, 2011 11:27 am
- Projects: Port of Ren'Py to OpenPandora
- Contact:
Re: Cross compilation problems
Thanks for help.
That was the first I tried
. It's indeed working for the compilation steps, but fails when linking.
I think it's some weird problem with distutils, but have no clue on how to fix it. (By the way I know almost nothing about Python and distutils).
That was the first I tried
I think it's some weird problem with distutils, but have no clue on how to fix it. (By the way I know almost nothing about Python and distutils).
- PyTom
- Ren'Py Creator
- Posts: 15893
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Cross compilation problems
IIRC, the key is that you want to cross-compile python, and install it in its own directory - call it python-cross. So you'll have python-cross/bin, python-cross/lib, and so on. In python-cross/bin, there will be a python binary that you won't be able to run on the host. Copy the host's python binary alongside it, so you have python-cross/bin/python.host. You can then run python-cross/bin/python.host, and it will use the cross-compiled distutils, which will likely have the correct linker.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom
-
doragasu
- Newbie
- Posts: 14
- Joined: Mon Nov 14, 2011 11:27 am
- Projects: Port of Ren'Py to OpenPandora
- Contact:
Re: Cross compilation problems
That was a good idea, but unfortunately didn't work.
Copied /usr/bin/python to /home/jalon/Pandora/renpy/renpy-deps/install/python/bin/python.host and ran this copy to build the module. Nothing changed
The way distutils behaves, calling arm-angstrom-linux-gnueabi-gcc to compile and gcc to link, makes me think that maybe there's a problem with the way I built Python. According to Distutils documentation, the same compiler and linker flags used to build Python are used to build modules:

Copied /usr/bin/python to /home/jalon/Pandora/renpy/renpy-deps/install/python/bin/python.host and ran this copy to build the module. Nothing changed
The way distutils behaves, calling arm-angstrom-linux-gnueabi-gcc to compile and gcc to link, makes me think that maybe there's a problem with the way I built Python. According to Distutils documentation, the same compiler and linker flags used to build Python are used to build modules:
The documentation explains how to modify the compiler and linker flags, and specifies you can also use CC and CFLAGS variables. Unfortunately, doesn't explain how to choose a linkerWhenever possible, the Distutils try to use the configuration information made available by the Python interpreter used to run the setup.py script. For example, the same compiler and linker flags used to compile Python will also be used for compiling extensions.
- PyTom
- Ren'Py Creator
- Posts: 15893
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Cross compilation problems
You set LD when building Python, I think. Which cross-compile patch for Python are you using? On the android port, the commands I use to configure and build Python are:
Code: Select all
./configure --host=arm-eabi --prefix="$PGS4A_ROOT/python-install" --enable-shared
make HOSTPYTHON=./hostpython HOSTPGEN=./hostpgen CROSS_COMPILE=arm-eabi- CROSS_COMPILE_TARGET=yes INSTSONAME=libpython2.7.so
make install HOSTPYTHON=./hostpython HOSTPGEN=./hostpgen CROSS_COMPILE=arm-eabi- CROSS_COMPILE_TARGET=yes INSTSONAME=libpython2.7.so
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom
-
doragasu
- Newbie
- Posts: 14
- Joined: Mon Nov 14, 2011 11:27 am
- Projects: Port of Ren'Py to OpenPandora
- Contact:
Re: Cross compilation problems
Thanks a lot, watching your post I guessed the problem. The problem is I was calling python instead of hostpython to compile. Now that problem is gone. The problem I have now is that as the console doesn't support OpenGL, and I have not built libGLEW, the process fails because it can't find libglew32:
Is there a way to compile the modules without OpenGL support?
Also, Android port supports OpenGL? AFAIK, android devices only supports OpenGL ES. Do Ren'Py work with OpenGL ES?
Code: Select all
/usr/local/angstrom/arm/lib/gcc/arm-angstrom-linux-gnueabi/4.3.3/../../../../arm-angstrom-linux-gnueabi/bin/ld: cannot find -lglew32
collect2: ld devolvió el estado de salida 1
error: command 'arm-angstrom-linux-gnueabi-gcc' failed with exit status 1Also, Android port supports OpenGL? AFAIK, android devices only supports OpenGL ES. Do Ren'Py work with OpenGL ES?
- PyTom
- Ren'Py Creator
- Posts: 15893
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Cross compilation problems
Ren'Py works with OpenGL ES 1, at the moment. Take a look at setup.py and glcompat.h in the module directory. There should be various conditionals and defines that let you choose GLES.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom
-
doragasu
- Newbie
- Posts: 14
- Joined: Mon Nov 14, 2011 11:27 am
- Projects: Port of Ren'Py to OpenPandora
- Contact:
Re: Cross compilation problems
Thanks for the tips. I modified glcompat.h and setup.py, and it has succesfully compiled using libGLESv2. I have put everything in the console, ran the launcher and it popped up
.
Unfortunately, it's not working as expected. When I launch the tutorial game, it starts, but shows me a warning telling it's in software mode due to a driver problem
. I accept and the welcome screen with the menu is displayed. Good. But when I click a button (for example Start Game), the game window dissapears and this is shown in the console window:
http://pastebin.com/brXCW6V7
Any ideas? Is there a way to view a detailed log? Also, is there a way to start the game fullscreen?
EDIT: I have added two screenshots.
Unfortunately, it's not working as expected. When I launch the tutorial game, it starts, but shows me a warning telling it's in software mode due to a driver problem
http://pastebin.com/brXCW6V7
Any ideas? Is there a way to view a detailed log? Also, is there a way to start the game fullscreen?
EDIT: I have added two screenshots.
- PyTom
- Ren'Py Creator
- Posts: 15893
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Cross compilation problems
The software mode warning comes into effect when it can't load the GL libraries. Check renpy.gl.gldraw.so, and see if it has any missing dependencies.
Ren'Py creates a log.txt in the directory with renpy.sh.
I don't know why the display isn't initializing. Check that logfile, and maybe instrument the call to renpy.display.init in swdraw.py.
Ren'Py creates a log.txt in the directory with renpy.sh.
I don't know why the display isn't initializing. Check that logfile, and maybe instrument the call to renpy.display.init in swdraw.py.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom
-
doragasu
- Newbie
- Posts: 14
- Joined: Mon Nov 14, 2011 11:27 am
- Projects: Port of Ren'Py to OpenPandora
- Contact:
Re: Cross compilation problems
gldraw.so throws and "undefined symbol: glewInit". It looks like I have to build libGLEW, that is the only dependency I wasn't able to build. I'll have to try harder 
- PyTom
- Ren'Py Creator
- Posts: 15893
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Cross compilation problems
You shouldn't need to build glew. IIRC, on Android, I simply stub that symbol out in glcompat.h
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom
-
doragasu
- Newbie
- Posts: 14
- Joined: Mon Nov 14, 2011 11:27 am
- Projects: Port of Ren'Py to OpenPandora
- Contact:
Re: Cross compilation problems
I think you're right. I think I was not properly building the module, because I was not defining ANDROID. Anyway, I discovered it too late, before compiling glew.
But I'm still not able to make GLES work. Now I get a "Failed loading libGL.so.1"
Maybe the process I'm using to compile the module is wrong. I do these steps:
1.- Add "-DANDROID" to CFLAGS.
2.- Edit setup.py and add near the begining "android = True"
3.- In the android libraries, change "sdl" with "SDL", "GLESv1_CM" with "GLES_CM" and remove "log". I have to do these changes because in my system, liblog doesn't exist, and the other two libraries are named differently.
Am I missing something? Is libGL.so also for OpenGL ES, or only form OpenGL?
But I'm still not able to make GLES work. Now I get a "Failed loading libGL.so.1"
Maybe the process I'm using to compile the module is wrong. I do these steps:
1.- Add "-DANDROID" to CFLAGS.
2.- Edit setup.py and add near the begining "android = True"
3.- In the android libraries, change "sdl" with "SDL", "GLESv1_CM" with "GLES_CM" and remove "log". I have to do these changes because in my system, liblog doesn't exist, and the other two libraries are named differently.
Am I missing something? Is libGL.so also for OpenGL ES, or only form OpenGL?
- PyTom
- Ren'Py Creator
- Posts: 15893
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: Cross compilation problems
You can't just use the android path, you have to come up with your own path. Along with using GLES, android adds in the Android-specific log library.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom
-
doragasu
- Newbie
- Posts: 14
- Joined: Mon Nov 14, 2011 11:27 am
- Projects: Port of Ren'Py to OpenPandora
- Contact:
Re: Cross compilation problems
Hum... Looks like this is going to be more difficult than I thought... 
A difficult port for a newbie in the cross compiling world
But I'll not give up easily
EDIT: Playing a bit with setup.py and setuplib.py I managed to build a semi-working version. Now games can be started and played, but:
- It's still working in software mode so...
- Performance is very slow and effects (for example soft transitions) don't work.
- Sound is not working
Even though GLES is still not working, I think I have partially solved the problem (at least the problem with Ren'Py). Before, the problem was renpy was trying to load libGL.so. Now pygame is who is trying to load libGL.so, so I suppose the problem is I need to recompile pygame (and maybe also SDL?) with GLES support.
I don't know what's the problem with sound. The log file shows no errors about sound. The only thing that I think might be causing this problem is that I changed Ren'Py build script to compile SDL without PulseAudio support, because it was causing errors. Is PulseAudio needed? I tried to play one of the .ogg files included in the tutorial with the built version of ffplay and it played perfectly, so I suppose fflplay is not used to play audio files and is not the problem.
A difficult port for a newbie in the cross compiling world
But I'll not give up easily
EDIT: Playing a bit with setup.py and setuplib.py I managed to build a semi-working version. Now games can be started and played, but:
- It's still working in software mode so...
- Performance is very slow and effects (for example soft transitions) don't work.
- Sound is not working
Even though GLES is still not working, I think I have partially solved the problem (at least the problem with Ren'Py). Before, the problem was renpy was trying to load libGL.so. Now pygame is who is trying to load libGL.so, so I suppose the problem is I need to recompile pygame (and maybe also SDL?) with GLES support.
I don't know what's the problem with sound. The log file shows no errors about sound. The only thing that I think might be causing this problem is that I changed Ren'Py build script to compile SDL without PulseAudio support, because it was causing errors. Is PulseAudio needed? I tried to play one of the .ogg files included in the tutorial with the built version of ffplay and it played perfectly, so I suppose fflplay is not used to play audio files and is not the problem.
Who is online
Users browsing this forum: No registered users