<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
<br>
I pulled the experimental branch (2011-06-09) but I still cannot load
my testing GPS library:<br>
<br>
.<i><small>..<br>
D/dalvikvm(  408): Trying to load lib
/data/local/qt/plugins/platforms/android/libandroid-8.so 0x44ede2c0<br>
D/dalvikvm(  408): Added shared lib
/data/local/qt/plugins/platforms/android/libandroid-8.so 0x44ede2c0<br>
I/Qt      (  408): qt start<br>
<b>D/dalvikvm(  408): Trying to load lib
/mnt/sdcard/Android/data/org.ilri.</b></small></i><b><i><small>GPSTest</small></i><i><small>/</small></i><i><small>libGPSInterface</small></i><i><small>.so
0x44ede2c0<br>
I/dalvikvm(  408): Unable to dlopen(/mnt/sdcard/Android/data/org.ilri.</small></i><i><small>GPSTest</small></i><i><small>/</small></i><i><small>libGPSInterface</small></i><i><small>.so):
Cannot load library: load_segments[907]: 33 failed to map segment from '</small></i><i><small>libGPSInterface</small></i></b><i><small><b>.so'
@ 0x81900000 (0x00003470). p_vaddr=0x00000000 p_offset=0x00000000</b><br>
....</small></i><br>
<br>
<br>
I though It was because I was not defining the PRO in the right way..
Here is the pro that builds the library:<br>
<br>
<small><i># -------------------------------------------------<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
Card<br>
DESTDIR = /mnt/sdcard/Android/data/org.ilri.GPSTest</i></small><br>
<br>
I added the code the tries to load my library into QTApplication.java
just after loading the QT libraries:<br>
<i>...<br>
<small>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.</small><small>GPSTest</small><small>/libGPSInterface</small><small>.so");<br>
            if (f.exists())<br>
                System.load(storage+"/Android/data/org.ilri.</small><small>GPSTest</small><small>/libGPSInterface</small><small>.so");<br>
        }<br>
        catch (SecurityException e)<br>
        {<br>
            Log.i(QtTAG, "Security: Can't load </small><small></small><small>libGPSInterface</small><small>.so",
e);<br>
        }<br>
        catch (UnsatisfiedLinkError e)<br>
        {<br>
            Log.i(QtTAG, "Link: Can't load </small><small>libGPSInterface</small><small>.so",
e);<br>
        }</small><br>
...</i><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:
<blockquote cite="mid:769192.12651.qm@web121402.mail.ne1.yahoo.com"
 type="cite">
  <div
 style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: times new roman,new york,times,serif; font-size: 12pt;">
  <div>Done, please pull "experimental" branch of android-qt
(android-lighthouse) repo !<br>
  </div>
  <div><br>
  </div>
  <div>Cheers,</div>
  <div>BogDan.<br>
  <br>
>________________________________<br>
>From: Frameworks <a class="moz-txt-link-rfc2396E" href="mailto:frameworks@qlands.com"><frameworks@qlands.com></a><br>
>To: <a class="moz-txt-link-rfc2396E" href="mailto:necessitas-devel@kde.org">"necessitas-devel@kde.org"</a> <a class="moz-txt-link-rfc2396E" href="mailto:necessitas-devel@kde.org"><necessitas-devel@kde.org></a><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:
System.load(libraries[i])  So as an example I added my custom library
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>
><a class="moz-txt-link-abbreviated" href="mailto:Necessitas-devel@kde.org">Necessitas-devel@kde.org</a><br>
><a moz-do-not-send="true" 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>
</blockquote>
<br>
</body>
</html>