Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: dlopen failed: has bad ELF magic

Tags:

python

android

Issue:

ImportError: dlopen failed: "/data/python/lib/python2.7/_io.so" has bad ELF magic

Background: I am working on some internal android apk's that supports python interpreter. I have to use that apk to run some test cases which are abd pushed into /sdcards/scripts/XXXX location(same place where python files/packages resides). Now when running the test cases io module is imported which calls _io.so module. This _io.so module is not in the python which come by default with the APK. So I thought may be I will locate the _io.so file on my mac and do adb push to /data/python/lib/python2.7/lib-dynload location where all other .so files are located. I thought pushing _io.so file to this location will solve the issue but it did not. Can some one give me an idea what is going on and what is the root cause so that this issue can be resolved.

root@condor_umts:/data/python/lib/python2.7/lib-dynload # ls -l              
-rw------- root     root        53660 2014-05-30 12:12 _bisect.so
-rw------- root     root       180956 2014-05-30 12:12 _codecs_cn.so
-rw------- root     root       191196 2014-05-30 12:12 _codecs_hk.so
-rw------- root     root        81064 2014-05-30 12:12 _codecs_iso2022.so
-rw------- root     root       285092 2014-05-30 12:12 _codecs_jp.so
-rw------- root     root       175016 2014-05-30 12:12 _codecs_kr.so
-rw------- root     root       145036 2014-05-30 12:12 _codecs_tw.so
-rw------- root     root        96396 2014-05-30 12:12 _collections.so
-rw------- root     root        86588 2014-05-30 12:12 _csv.so

Truncated for brevity env:

Python 2.7.3 (default, Apr 15 2014, 13:44:15) 
[GCC 4.6 20120106 (prerelease)] on linux-armv7l
like image 976
vector8188 Avatar asked May 30 '14 20:05

vector8188


1 Answers

you can not use a mac-x86 so file for android(linux-arm supported).

like image 80
Jiang YD Avatar answered Oct 11 '22 18:10

Jiang YD