Problem linking with shared lib in Harmattan



  • Hi all,

    I am trying a simple project which links to a shared lib like
    LIBS += -L$$OUT_PWD/../mylib/ -lmylib

    I can see that my lib is being generated and added it to the project via Qt Creator'ss Add Library wizard (by right clicking on project).
    However when deploying to N9 via Qt Creator I am struck with the following error.

    @dpkg-shlibdeps: failure: couldn't find library libmylib.so.1 needed by debian/bigtest/opt/hell/bin/hell (its RPATH is '').
    Note: libraries are not searched in other binary packages that do not have any shlibs or symbols file.
    To help dpkg-shlibdeps find private libraries, you might need to set LD_LIBRARY_PATH.
    dh_shlibdeps: command returned error code 512
    make: *** [binary-arch] Error 1
    dpkg-buildpackage: failure: debian/rules binary gave error exit status 2
    Packaging Error: Command '/home/srikanth/QtSDK/Madde/bin/mad dpkg-buildpackage -nc -uc -us' failed.Exit code: 2
    Error while building project bigtest (target: Harmattan)
    When executing build step 'Create Debian Package'
    @
    I have seen a "bug":https://bugreports.qt.nokia.com/browse/QTSDK-71 raised but no solid solution there.
    Linking to a custom lib is a very basic app requirement. This surprises me why Harmattan did not receive this love.
    Any solution/workaround is much appreciated.

    Thanks in adavance,
    Srikanth



  • Have you found a solution to this issue? I'm currently trying to link to Herqq which is a uPnP-library written using the Qt Framework. I'm able to use it in the emulator and to link to it locally, but I'm not sure how to do it on the actual device.



  • I looked around and found some information on Nokias developer wiki:
    http://www.developer.nokia.com/Community/Wiki/index.php?title=How_to_deploy_and_link_a_shared_library_on_Harmattan

    which contained most of what I needed.

    My solution (for the library specific parts) looks like this:
    @
    INCLUDEPATH += $$PWD/hupnp/include

    Section to install libHUpnp

    contains(MEEGO_EDITION,harmattan):CONFIG(debug, debug|release): hupnp.files += $$PWD/hupnp/lib/harmattan/debug/libHUpnp.so.1
    contains(MEEGO_EDITION,harmattan):CONFIG(release, debug|release): hupnp.files += $$PWD/hupnp/lib/harmattan/release/libHUpnp.so.1
    contains(MEEGO_EDITION,harmattan):CONFIG(debug, debug|release): hupnp.files += $$PWD/hupnp/lib/harmattan/debug/libQtSolutions_SOAP-2.7.so.1
    contains(MEEGO_EDITION,harmattan):CONFIG(release, debug|release): hupnp.files += $$PWD/hupnp/lib/harmattan/release/libQtSolutions_SOAP-2.7.so.1
    contains(MEEGO_EDITION,harmattan):hupnp.path = /opt/LinnKontrol/hupnp/lib
    contains(MEEGO_EDITION,harmattan):INSTALLS += hupnp

    win32:CONFIG(release, debug|release): LIBS += -L$$PWD/hupnp/lib/release -lHUpnp -lQtSolutions_SOAP-2.7
    else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/hupnp/lib/debug -lHUpnp -lQtSolutions_SOAP-2.7
    else:unix:!contains(MEEGO_EDITION,harmattan):CONFIG(release, debug|release): LIBS += -L$$PWD/hupnp/lib/unix/release -lHUpnp -lQtSolutions_SOAP-2.7
    else:unix:!contains(MEEGO_EDITION,harmattan):CONFIG(debug, debug|release): LIBS += -L$$PWD/hupnp/lib/unix/debug -lHUpnp -lQtSolutions_SOAP-2.7
    else:contains(MEEGO_EDITION,harmattan):CONFIG(release, debug|release): LIBS += -L$$PWD/hupnp/lib/harmattan/release -lHUpnp -lQtSolutions_SOAP-2.7
    else:contains(MEEGO_EDITION,harmattan):CONFIG(debug, debug|release): LIBS += -L$$PWD/hupnp/lib/harmattan/debug -lHUpnp -lQtSolutions_SOAP-2.7
    #else:symbian: LIBS += -lHUpnp -lQtSolutions_SOAP-2.7

    contains(MEEGO_EDITION,harmattan):CONFIG(debug, debug|release): DEPENDPATH += -L$$PWD/hupnp/harmattan/lib/debug
    contains(MEEGO_EDITION,harmattan):CONFIG(release, debug|release): DEPENDPATH += -L$$PWD/hupnp/harmattan/lib/release

    contains(MEEGO_EDITION,harmattan):QMAKE_LFLAGS += -Wl,--rpath=/opt/LinnKontrol/hupnp/lib
    else:unix:!contains(MEEGO_EDITION,harmattan):QMAKE_LFLAGS += -Wl,--rpath=./hupnp/lib
    @

    What this does (I think) is essentially to say that I'm linking to the library, where the files of the library reside on my disk, where it should install the library on the phone and where to find it on the phone (where to find the dependency).
    I'm not sure everything is needed, but at least it works for my N9.

    So my library is called hupnp, and I'm installing it within my programs (LinnKontrol) directory on the phone, since that's what Nokia recommends in their guide.

    Hope it helps!



  • It worked on Maemo, thank you. the only thing that I found different was that I used

    @folder_01.source = ./lib/
    folder_01.target = /
    DEPLOYMENTFOLDERS = folder_01@

    to copy the lib folder


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.