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