Mobility GPS plugin -- Fail to load custom library

BogDan bog_dan_ro at yahoo.com
Thu Jun 9 13:21:32 CEST 2011


Hi,


AFAIK you are not allowed to load libs from sdcard, try pushing your library to phone memory (e.g. /data/local )

BogDan.


>
>
>Hi,
>
>I pulled the experimental branch (2011-06-09) but I still cannot load
my testing GPS library:
>
>...
>D/dalvikvm(  408): Trying to load lib
/data/local/qt/plugins/platforms/android/libandroid-8.so 0x44ede2c0
>D/dalvikvm(  408): Added shared lib
/data/local/qt/plugins/platforms/android/libandroid-8.so 0x44ede2c0
>I/Qt      (  408): qt start
>D/dalvikvm(  408): Trying to load lib
/mnt/sdcard/Android/data/org.ilri.GPSTest/libGPSInterface.so
0x44ede2c0
>I/dalvikvm(  408): Unable to dlopen(/mnt/sdcard/Android/data/org.ilri.GPSTest/libGPSInterface.so):
Cannot load library: load_segments[907]: 33 failed to map segment from 'libGPSInterface.so'
@ 0x81900000 (0x00003470). p_vaddr=0x00000000 p_offset=0x00000000
>....
>
>
>I though It was because I was not defining the PRO in the right way..
Here is the pro that builds the library:
>
># -------------------------------------------------
># Project created by QtCreator 2010-04-30T11:56:42
># -------------------------------------------------
>QT += sql
>TARGET = GPSInterface
>CONFIG += qt plugin dll
>
>TEMPLATE = lib
>
>DEFINES = QT_STATICPLUGIN
>
>SOURCES += \ 
>    ../../interfaces.cpp
>HEADERS += ../../interfaces.h
>#DestDir is on my linux system then I copy the so into the virtual SD
Card
>DESTDIR = /mnt/sdcard/Android/data/org.ilri.GPSTest
>
>I added the code the tries to load my library into QTApplication.java
just after loading the QT libraries:
>...
>try
>        {
>            File str;
>            String storage;
>            str = Environment.getExternalStorageDirectory();
>            storage = str.getAbsolutePath();
>
>            File f = new File(storage+"/Android/data/org.ilri.GPSTest/libGPSInterface.so");
>            if (f.exists())
>                System.load(storage+"/Android/data/org.ilri.GPSTest/libGPSInterface.so");
>        }
>        catch (SecurityException e)
>        {
>            Log.i(QtTAG, "Security: Can't load libGPSInterface.so",
e);
>        }
>        catch (UnsatisfiedLinkError e)
>        {
>            Log.i(QtTAG, "Link: Can't load libGPSInterface.so",
e);
>        }
>...
>
>Any idea what do I need to do or doing wrong?
>
>Many thanks,
>Carlos.
>
>On 06/03/2011 05:51 PM, BogDan wrote: 
>Done, please pull "experimental" branch of android-qt
(android-lighthouse) repo !
>>
>>
>>
>>Cheers,
>>BogDan.
>>
>>>________________________________
>>>From: Frameworks <frameworks at qlands.com>
>>>To: "necessitas-devel at kde.org" <necessitas-devel at kde.org>
>>>Sent: Friday, June 3, 2011 5:43 PM
>>>Subject: Mobility GPS plugin -- Fail to load custom library
>>>
>>>
>>>Hi,
>>>
>>>This is Carlos Quiros.
>>>
>>>I am working on a mobility GPS plugin. For this I am playing around
>>loading libraries. I created the library with the same Necessitas QT
>>creator that I use in the testing example. So I create this library libIMPInterface.so. This has the following pro:
>>>
>>>QT += sql
>>>TARGET = $$qtLibraryTarget(Interface)
>>>TEMPLATE = lib
>>>SOURCES += \ 
>>>    ../../interfaces.cpp
>>>HEADERS += ../../interfaces.h
>>>INCLUDEPATH += ../../ 
>>>DESTDIR = /sdcard/Android/data/org.ilri.GPSTest
>>>
>>>
>>>Note:
>>>DESTDIR for now is fixed... Because is a test
>>>
>>>I saw that QApplication.java load the QT libraries using:
System.load(libraries[i])  So as an example I added my custom library
like:
>>>
>>>try
>>>        {
>>>           
>>System.load("/sdcard/Android/data/org.ilri.GPSTest/libInterface.so");
>>//This is fix... I am just testing loading my GPS library!
>>>        }
>>>        catch (SecurityException e)
>>>        {
>>>            Log.i(QtTAG, "Can't load '" + "'", e);
>>>        }
>>>        catch (Exception e)
>>>        {
>>>            Log.i(QtTAG, "Can't load '" + "'", e);
>>>        }
>>>
>>>But I am getting the following error:
>>>
>>>D/dalvikvm(  292): Trying to load lib
>>/sdcard/Android/data/org.ilri.GPSTest/libInterface.so 0x44edea38
>>>I/dalvikvm(  292): Unable to
>>dlopen(/sdcard/Android/data/org.ilri.GPSTest/libInterface.so): Cannot
>>load library: load_segments[907]: 33 failed to map segment from
>>'libInterface.so' @ 0x80b00000 (0x00003e28). p_vaddr=0x00000000
>>p_offset=0x00000000
>>>
>>>And then of course I get:
>>>
>>>E/AndroidRuntime(  292): java.lang.UnsatisfiedLinkError: Library
>>/sdcard/Android/data/org.ilri.IMPACTLight/libIMPInterface.so not found
>>>
>>>
>>>Any idea what I am doing wrong? Do the libraries need to have any
>>special signature/form for the Dalvik VM to load them? Or I cannot use
>>Necessitas QT creator to make libraries?
>>>
>>>Many thanks guys and girls!
>>>
>>>Carlos.
>>>
>>>_______________________________________________
>>>Necessitas-devel mailing list
>>>Necessitas-devel at kde.org
>>>https://mail.kde.org/mailman/listinfo/necessitas-devel
>>>
>>>
>>>
>
>_______________________________________________
>Necessitas-devel mailing list
>Necessitas-devel at kde.org
>https://mail.kde.org/mailman/listinfo/necessitas-devel
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/necessitas-devel/attachments/20110609/a11bceea/attachment.htm 


More information about the Necessitas-devel mailing list