damonkohler / sl4a

SL4A brings scripting languages to Android by allowing you to edit and execute scripts and interactive interpreters directly on the Android device.
Apache License 2.0
2.44k stars 800 forks source link

Can't load lua modules mime and socket at the same time (android linker problem) #278

Open damonkohler opened 9 years ago

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:24

What steps will reproduce the problem?
1. run "lua -l socket -l mime"
2. or run a script with require "socket" require "mime"

This means you can't use the Lua http client, for instance

What is the expected output? What do you see instead?
Loading of the second library fails, no matter which order you load them 
in. It says symbol not found.

What version of the product are you using? On what operating system?
Head revision of ASE, android 1.5 & 2.1

Please provide any additional information below.

The reason for the failure is that apparently the Android linker won't load 
two shared libraries with the same name - so mime/core.so and 
mime/socket.so can't both be loaded as it thinks they are the same library. 
So it tries to load the symbol it needs for the second from the first which 
fails, naturally.

One solution is to rename both the shared libraries and change the code 
that loads them, as in the attached patch.

Original issue reported on code.google.com by charlto...@gmail.com on 16 Feb 2010 at 10:57

Attachments:

Copied from original issue: damonkohler/android-scripting#192

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:24

Thanks for the patch! I'll check it out and try to get it into the next release.

Original comment by damonkoh...@gmail.com on 22 Feb 2010 at 10:14

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:24

I think I'm still having this issue with release 6:

> require("socket.http")
error loading module 'mime.core' from file 
'/data/data/com.googlecode.luaforandroid/files/lua/lib/lua/5.1/mime/core.so':
    Symbol not found: 
stack traceback:
    [C]: ?
    [C]: in function 'require'
    ...ecode.luaforandroid/files/lua/share/lua/5.1/mime.lua:13: in main chunk
    [C]: in function 'require'
    ...uaforandroid/files/lua/share/lua/5.1/socket/http.lua:14: in main chunk
    [C]: in function 'require'
    [string "print(require("socket.http"))..."]:1: in main chunk
    [...]

Original comment by hyperhac...@gmail.com on 14 Jul 2012 at 5:13