From caaecfd42d769227d8e69bed94efc3a0918efcd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20K=C3=BChling?= Date: Thu, 29 Mar 2012 02:28:41 +0200 Subject: [PATCH] alpy: fix (workaround) segfault caused by openwrt dynamic linker pecularities --- alpy/Makefile | 4 ++-- alpy/patches/005-dl.patch | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/alpy/Makefile b/alpy/Makefile index da0833e..363e84d 100644 --- a/alpy/Makefile +++ b/alpy/Makefile @@ -58,7 +58,7 @@ endef # $(PKG_BUILD_DIR)/setup.py build # endef -TARGET_LDFLAGS += -lalleg -lm -lpthread +TARGET_LDFLAGS += -lm -lpthread -ldl -lrt -lalleg define Build/Install $(call Build/Compile/PyMod,, \ @@ -80,5 +80,5 @@ $(eval $(call BuildPackage,alpy)) # The following comments configure the Emacs editor. Just ignore them. # 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: diff --git a/alpy/patches/005-dl.patch b/alpy/patches/005-dl.patch index 58d1181..a404069 100644 --- a/alpy/patches/005-dl.patch +++ b/alpy/patches/005-dl.patch @@ -25,3 +25,29 @@ Index: Alpy-0.1.5/alpy.py m = __import__('_alpy') handle.close() 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 + #include ++#include + + 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++; +