update:

so i captured the output of python into a log file that might help diagnose this problem.  it seems that the call to dlopen(madmodule.so, 2) is what's failing.  i'm thinking now that dlopen doesn't know where to start the address of the text section, and is just defaulting to 0 or it's own text section.  that would lead to this spurious error as dlopen clearly can't write to the read-only text section of the module.  (log files included below)  

i'd appreciate any insight that anyone has to offer.


commands & log output
__________

here's the command i run, after trying to import mad (all output is being sent to the log so, but stdin is still being read python crashes and returns me to the shell.


#python -vvvv > log 2>&1
import mad
#

here's the contents of log (scroll down to the end to see where dlopen fails).

#cat log
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# trying /usr/lib/python24.zip/site.so
# trying /usr/lib/python24.zip/sitemodule.so
# trying /usr/lib/python24.zip/site.py
# trying /usr/lib/python24.zip/site.pyc
# trying /usr/lib/python2.4/site.so
# trying /usr/lib/python2.4/sitemodule.so
# trying /usr/lib/python2.4/site.py
# /usr/lib/python2.4/site.pyc matches /usr/lib/python2.4/site.py
import site # precompiled from /usr/lib/python2.4/site.pyc
# trying /usr/lib/python24.zip/os.so
# trying /usr/lib/python24.zip/osmodule.so
# trying /usr/lib/python24.zip/os.py
# trying /usr/lib/python24.zip/os.pyc
# trying /usr/lib/python2.4/os.so
# trying /usr/lib/python2.4/osmodule.so
# trying /usr/lib/python2.4/os.py
# /usr/lib/python2.4/os.pyc matches /usr/lib/python2.4/os.py
import os # precompiled from /usr/lib/python2.4/os.pyc
import posix # builtin
# trying /usr/lib/python24.zip/posixpath.so
# trying /usr/lib/python24.zip/posixpathmodule.so
# trying /usr/lib/python24.zip/posixpath.py
# trying /usr/lib/python24.zip/posixpath.pyc
# trying /usr/lib/python2.4/posixpath.so
# trying /usr/lib/python2.4/posixpathmodule.so
# trying /usr/lib/python2.4/posixpath.py
# /usr/lib/python2.4/posixpath.pyc matches /usr/lib/python2.4/posixpath.py
import posixpath # precompiled from /usr/lib/python2.4/posixpath.pyc
# trying /usr/lib/python24.zip/stat.so
# trying /usr/lib/python24.zip/statmodule.so
# trying /usr/lib/python24.zip/stat.py
# trying /usr/lib/python24.zip/stat.pyc
# trying /usr/lib/python2.4/stat.so
# trying /usr/lib/python2.4/statmodule.so
# trying /usr/lib/python2.4/stat.py
# /usr/lib/python2.4/stat.pyc matches /usr/lib/python2.4/stat.py
import stat # precompiled from /usr/lib/python2.4/stat.pyc
# trying /usr/lib/python24.zip/UserDict.so
# trying /usr/lib/python24.zip/UserDictmodule.so
# trying /usr/lib/python24.zip/UserDict.py
# trying /usr/lib/python24.zip/UserDict.pyc
# trying /usr/lib/python2.4/UserDict.so
# trying /usr/lib/python2.4/UserDictmodule.so
# trying /usr/lib/python2.4/UserDict.py
# /usr/lib/python2.4/UserDict.pyc matches /usr/lib/python2.4/UserDict.py
import UserDict # precompiled from /usr/lib/python2.4/UserDict.pyc
# trying /usr/lib/python24.zip/copy_reg.so
# trying /usr/lib/python24.zip/copy_regmodule.so
# trying /usr/lib/python24.zip/copy_reg.py
# trying /usr/lib/python24.zip/copy_reg.pyc
# trying /usr/lib/python2.4/copy_reg.so
# trying /usr/lib/python2.4/copy_regmodule.so
# trying /usr/lib/python2.4/copy_reg.py
# /usr/lib/python2.4/copy_reg.pyc matches /usr/lib/python2.4/copy_reg.py
import copy_reg # precompiled from /usr/lib/python2.4/copy_reg.pyc
# trying /usr/lib/python24.zip/types.so
# trying /usr/lib/python24.zip/typesmodule.so
# trying /usr/lib/python24.zip/types.py
# trying /usr/lib/python24.zip/types.pyc
# trying /usr/lib/python2.4/types.so
# trying /usr/lib/python2.4/typesmodule.so
# trying /usr/lib/python2.4/types.py
# /usr/lib/python2.4/types.pyc matches /usr/lib/python2.4/types.py
import types # precompiled from /usr/lib/python2.4/types.pyc
# trying /usr/lib/python24.zip/sitecustomize.so
# trying /usr/lib/python24.zip/sitecustomizemodule.so
# trying /usr/lib/python24.zip/sitecustomize.py
# trying /usr/lib/python24.zip/sitecustomize.pyc
# trying /usr/lib/python2.4/sitecustomize.so
# trying /usr/lib/python2.4/sitecustomizemodule.so
# trying /usr/lib/python2.4/sitecustomize.py
# trying /usr/lib/python2.4/sitecustomize.pyc
# trying /usr/lib/python2.4/plat-linux2/sitecustomize.so
# trying /usr/lib/python2.4/plat-linux2/sitecustomizemodule.so
# trying /usr/lib/python2.4/plat-linux2/sitecustomize.py
# trying /usr/lib/python2.4/plat-linux2/sitecustomize.pyc
# trying /usr/lib/python2.4/lib-tk/sitecustomize.so
# trying /usr/lib/python2.4/lib-tk/sitecustomizemodule.so
# trying /usr/lib/python2.4/lib-tk/sitecustomize.py
# trying /usr/lib/python2.4/lib-tk/sitecustomize.pyc
# trying /usr/lib/python2.4/lib-dynload/sitecustomize.so
# trying /usr/lib/python2.4/lib-dynload/sitecustomizemodule.so
# trying /usr/lib/python2.4/lib-dynload/sitecustomize.py
# trying /usr/lib/python2.4/lib-dynload/sitecustomize.pyc
# trying /usr/lib/python2.4/site-packages/sitecustomize.so
# trying /usr/lib/python2.4/site-packages/sitecustomizemodule.so
# trying /usr/lib/python2.4/site-packages/sitecustomize.py
# trying /usr/lib/python2.4/site-packages/sitecustomize.pyc
# trying /usr/lib/python24.zip/warnings.so
# trying /usr/lib/python24.zip/warningsmodule.so
# trying /usr/lib/python24.zip/warnings.py
# trying /usr/lib/python24.zip/warnings.pyc
# trying /usr/lib/python2.4/warnings.so
# trying /usr/lib/python2.4/warningsmodule.so
# trying /usr/lib/python2.4/warnings.py
# /usr/lib/python2.4/warnings.pyc matches /usr/lib/python2.4/warnings.py
import warnings # precompiled from /usr/lib/python2.4/warnings.pyc
# trying /usr/lib/python24.zip/linecache.so
# trying /usr/lib/python24.zip/linecachemodule.so
# trying /usr/lib/python24.zip/linecache.py
# trying /usr/lib/python24.zip/linecache.pyc
# trying /usr/lib/python2.4/linecache.so
# trying /usr/lib/python2.4/linecachemodule.so
# trying /usr/lib/python2.4/linecache.py
# /usr/lib/python2.4/linecache.pyc matches /usr/lib/python2.4/linecache.py
import linecache # precompiled from /usr/lib/python2.4/linecache.pyc
# trying /usr/lib/python24.zip/encodings.so
# trying /usr/lib/python24.zip/encodingsmodule.so
# trying /usr/lib/python24.zip/encodings.py
# trying /usr/lib/python24.zip/encodings.pyc
import encodings # directory /usr/lib/python2.4/encodings
# trying /usr/lib/python2.4/encodings/__init__.so
# trying /usr/lib/python2.4/encodings/__init__module.so
# trying /usr/lib/python2.4/encodings/__init__.py
# /usr/lib/python2.4/encodings/__init__.pyc matches /usr/lib/python2.4/encodings/__init__.py
import encodings # precompiled from /usr/lib/python2.4/encodings/__init__.pyc
# trying /usr/lib/python2.4/encodings/codecs.so
# trying /usr/lib/python2.4/encodings/codecsmodule.so
# trying /usr/lib/python2.4/encodings/codecs.py
# trying /usr/lib/python2.4/encodings/codecs.pyc
# trying /usr/lib/python24.zip/codecs.so
# trying /usr/lib/python24.zip/codecsmodule.so
# trying /usr/lib/python24.zip/codecs.py
# trying /usr/lib/python24.zip/codecs.pyc
# trying /usr/lib/python2.4/codecs.so
# trying /usr/lib/python2.4/codecsmodule.so
# trying /usr/lib/python2.4/codecs.py
# /usr/lib/python2.4/codecs.pyc matches /usr/lib/python2.4/codecs.py
import codecs # precompiled from /usr/lib/python2.4/codecs.pyc
import _codecs # builtin
# trying /usr/lib/python2.4/encodings/exceptions.so
# trying /usr/lib/python2.4/encodings/exceptionsmodule.so
# trying /usr/lib/python2.4/encodings/exceptions.py
# trying /usr/lib/python2.4/encodings/exceptions.pyc
# trying /usr/lib/python2.4/encodings/types.so
# trying /usr/lib/python2.4/encodings/typesmodule.so
# trying /usr/lib/python2.4/encodings/types.py
# trying /usr/lib/python2.4/encodings/types.pyc
# trying /usr/lib/python2.4/encodings/aliases.so
# trying /usr/lib/python2.4/encodings/aliasesmodule.so
# trying /usr/lib/python2.4/encodings/aliases.py
# /usr/lib/python2.4/encodings/aliases.pyc matches /usr/lib/python2.4/encodings/aliases.py
import encodings.aliases # precompiled from /usr/lib/python2.4/encodings/aliases.pyc
# trying /usr/lib/python2.4/encodings/ascii.so
# trying /usr/lib/python2.4/encodings/asciimodule.so
# trying /usr/lib/python2.4/encodings/ascii.py
# /usr/lib/python2.4/encodings/ascii.pyc matches /usr/lib/python2.4/encodings/ascii.py
import encodings.ascii # precompiled from /usr/lib/python2.4/encodings/ascii.pyc
Python 2.4.2 (#1, Jul 25 2006, 18:40:36)
[GCC 3.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
# trying readline.so
# trying readlinemodule.so
# trying readline.py
# trying readline.pyc
# trying /usr/lib/python24.zip/readline.so
# trying /usr/lib/python24.zip/readlinemodule.so
# trying /usr/lib/python24.zip/readline.py
# trying /usr/lib/python24.zip/readline.pyc
# trying /usr/lib/python2.4/readline.so
# trying /usr/lib/python2.4/readlinemodule.so
# trying /usr/lib/python2.4/readline.py
# trying /usr/lib/python2.4/readline.pyc
# trying /usr/lib/python2.4/plat-linux2/readline.so
# trying /usr/lib/python2.4/plat-linux2/readlinemodule.so
# trying /usr/lib/python2.4/plat-linux2/readline.py
# trying /usr/lib/python2.4/plat-linux2/readline.pyc
# trying /usr/lib/python2.4/lib-tk/readline.so
# trying /usr/lib/python2.4/lib-tk/readlinemodule.so
# trying /usr/lib/python2.4/lib-tk/readline.py
# trying /usr/lib/python2.4/lib-tk/readline.pyc
# trying /usr/lib/python2.4/lib-dynload/readline.so
# trying /usr/lib/python2.4/lib-dynload/readlinemodule.so
# trying /usr/lib/python2.4/lib-dynload/readline.py
# trying /usr/lib/python2.4/lib-dynload/readline.pyc
# trying /usr/lib/python2.4/site-packages/readline.so
# trying /usr/lib/python2.4/site-packages/readlinemodule.so
# trying /usr/lib/python2.4/site-packages/readline.py
# trying /usr/lib/python2.4/site-packages/readline.pyc
>>> # trying mad.so
# trying madmodule.so
# trying mad.py
# trying mad.pyc
# trying /usr/lib/python24.zip/mad.so
# trying /usr/lib/python24.zip/madmodule.so
# trying /usr/lib/python24.zip/mad.py
# trying /usr/lib/python24.zip/mad.pyc
# trying /usr/lib/python2.4/mad.so
# trying /usr/lib/python2.4/madmodule.so
# trying /usr/lib/python2.4/mad.py
# trying /usr/lib/python2.4/mad.pyc
# trying /usr/lib/python2.4/plat-linux2/mad.so
# trying /usr/lib/python2.4/plat-linux2/madmodule.so
# trying /usr/lib/python2.4/plat-linux2/mad.py
# trying /usr/lib/python2.4/plat-linux2/mad.pyc
# trying /usr/lib/python2.4/lib-tk/mad.so
# trying /usr/lib/python2.4/lib-tk/madmodule.so
# trying /usr/lib/python2.4/lib-tk/mad.py
# trying /usr/lib/python2.4/lib-tk/mad.pyc
# trying /usr/lib/python2.4/lib-dynload/mad.so
# trying /usr/lib/python2.4/lib-dynload/madmodule.so
# trying /usr/lib/python2.4/lib-dynload/mad.py
# trying /usr/lib/python2.4/lib-dynload/mad.pyc
# trying /usr/lib/python2.4/site-packages/mad.so
# trying /usr/lib/python2.4/site-packages/madmodule.so
dlopen("/usr/lib/python2.4/site-packages/madmodule.so", 2);
Can't modify /usr/lib/python2.4/site-packages/madmodule.so's text section. Use GCC option -fPIC for shared objects, please.

On Jul 24, 2006, at 4:00 AM, G Elliott wrote:

hi all,

i'm looking to import a few python modules, such as pybluez, pymad, and pysqlite2.  
for pymad, i cross-compiled the source for pymad using the buildroot's arm-linux-gcc into madmodule.so (commands below).  i then uploaded the .so to my gumstix, and attempted to import it.  i got this message:

Can't modify ./madmodule.so's text section. Use GCC option -fPIC for shared objects, please.

i found mickey's python for arm site (http://www.vanille.de/projects/python.spy), downloaded his madmodule.so, uploaded it to the gumstix and got the same error.  for reference, i tried this with pysqlite2 as well and got the same error.


here are my compilation commands

arm-linux-uclibc-gcc -c -g -fPIC -I/home/greg/gumstix/gumstix-buildroot/build_arm_nofpu/staging_dir/include -I/usr/local/include/python2.4 -c src/madmodule.c -o madmodule.o

arm-linux-uclibc-gcc -c -g -fPIC -I/home/greg/gumstix/gumstix-buildroot/build_arm_nofpu/staging_dir/include -I/usr/local/include/python2.4 -c src/pymadfile.c -o pymadfile.o

arm-linux-uclibc-gcc -c -g -fPIC -I/home/greg/gumstix/gumstix-buildroot/build_arm_nofpu/staging_dir/include -I/usr/local/include/python2.4 -c src/xing.c -o xing.o

arm-linux-gcc -pthread -shared madmodule.o pymadfile.o xing.o -L/home/greg/gumstix/gumstix-buildroot/build_arm_nofpu/staging_dir/lib -lmad -o madmodule.so


any ideas?

thanks,
greg


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________
gumstix-users mailing list
gumstix-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gumstix-users