1
0
mirror of git://projects.qi-hardware.com/openwrt-packages.git synced 2024-11-22 12:41:53 +02:00

alpy: fix (workaround) segfault caused by openwrt dynamic linker pecularities

This commit is contained in:
David Kühling 2012-03-29 02:28:41 +02:00
parent 2ee0f6e91f
commit caaecfd42d
2 changed files with 28 additions and 2 deletions

View File

@ -58,7 +58,7 @@ endef
# $(PKG_BUILD_DIR)/setup.py build # $(PKG_BUILD_DIR)/setup.py build
# endef # endef
TARGET_LDFLAGS += -lalleg -lm -lpthread TARGET_LDFLAGS += -lm -lpthread -ldl -lrt -lalleg
define Build/Install define Build/Install
$(call Build/Compile/PyMod,, \ $(call Build/Compile/PyMod,, \
@ -80,5 +80,5 @@ $(eval $(call BuildPackage,alpy))
# The following comments configure the Emacs editor. Just ignore them. # The following comments configure the Emacs editor. Just ignore them.
# Local Variables: # Local Variables:
# compile-command: "make -C ~/h/src/qi/openwrt-xburst package/alpy/compile -j2 V=99" # compile-command: "cd ~/src/nanonote/Alpy-0.1.5 && ~/bin/quilt-export target && make -C ~/h/src/qi/openwrt-xburst package/alpy/compile -j2 V=99"
# End: # End:

View File

@ -25,3 +25,29 @@ Index: Alpy-0.1.5/alpy.py
m = __import__('_alpy') m = __import__('_alpy')
handle.close() handle.close()
return m return m
Index: Alpy-0.1.5/_alpymodule.c
===================================================================
--- Alpy-0.1.5.orig/_alpymodule.c 2012-03-29 00:20:15.351117567 +0200
+++ Alpy-0.1.5/_alpymodule.c 2012-03-29 00:27:10.017151329 +0200
@@ -29,6 +29,7 @@
#include "allegro.h"
#include <stdlib.h>
#include <string.h>
+#include <dlfcn.h>
static const char *_utf8 = "utf8";
@@ -237,6 +238,13 @@
{
int result, alpy_system = SYSTEM_AUTODETECT;
+ /* this is an ugly hack added for OpenWRT: seems that recursive library
+ dependencies won't get the treatment configured in alpy.py via
+ sys.setdlopenflags(), so that aleg-fbcon.so references into liballegro
+ are not referenced. Of course we could also go and fix liballegro to
+ make all modules explicitely link to liballegro themselves. */
+ dlopen("liballeg.so", RTLD_NOW|RTLD_GLOBAL);
+
if (!alpy_allegro_installed) {
alpy_allegro_installed++;