December 27, 2011

sriks sriks
Lab Rat
122 posts

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.

  1. dpkg-shlibdeps: failure: couldn't find library libmylib.so.1 needed by debian/bigtest/opt/hell/bin/hell (its RPATH is '').
  2. Note: libraries are not searched in other binary packages that do not have any shlibs or symbols file.
  3. To help dpkg-shlibdeps find private libraries, you might need to set LD_LIBRARY_PATH.
  4. dh_shlibdeps: command returned error code 512
  5. make: *** [binary-arch] Error 1
  6. dpkg-buildpackage: failure: debian/rules binary gave error exit status 2
  7. Packaging Error: Command '/home/srikanth/QtSDK/Madde/bin/mad dpkg-buildpackage -nc -uc -us' failed.Exit code: 2
  8. Error while building project bigtest (target: Harmattan)
  9. When executing build step 'Create Debian Package'

I have seen a bug [bugreports.qt.nokia.com] 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

3 replies

April 9, 2012

Azpegath Azpegath
Lab Rat
12 posts

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.

August 12, 2012

Azpegath Azpegath
Lab Rat
12 posts

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:

  1. INCLUDEPATH += $$PWD/hupnp/include
  2.  
  3. # Section to install libHUpnp
  4. contains(MEEGO_EDITION,harmattan):CONFIG(debug, debug|release): hupnp.files += $$PWD/hupnp/lib/harmattan/debug/libHUpnp.so.1
  5. contains(MEEGO_EDITION,harmattan):CONFIG(release, debug|release): hupnp.files += $$PWD/hupnp/lib/harmattan/release/libHUpnp.so.1
  6. contains(MEEGO_EDITION,harmattan):CONFIG(debug, debug|release):  hupnp.files += $$PWD/hupnp/lib/harmattan/debug/libQtSolutions_SOAP-2.7.so.1
  7. contains(MEEGO_EDITION,harmattan):CONFIG(release, debug|release):  hupnp.files += $$PWD/hupnp/lib/harmattan/release/libQtSolutions_SOAP-2.7.so.1
  8. contains(MEEGO_EDITION,harmattan):hupnp.path = /opt/LinnKontrol/hupnp/lib
  9. contains(MEEGO_EDITION,harmattan):INSTALLS += hupnp
  10.  
  11. win32:CONFIG(release, debug|release): LIBS += -L$$PWD/hupnp/lib/release -lHUpnp  -lQtSolutions_SOAP-2.7
  12. else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/hupnp/lib/debug -lHUpnp -lQtSolutions_SOAP-2.7
  13. else:unix:!contains(MEEGO_EDITION,harmattan):CONFIG(release, debug|release): LIBS += -L$$PWD/hupnp/lib/unix/release -lHUpnp -lQtSolutions_SOAP-2.7
  14. else:unix:!contains(MEEGO_EDITION,harmattan):CONFIG(debug, debug|release): LIBS += -L$$PWD/hupnp/lib/unix/debug -lHUpnp -lQtSolutions_SOAP-2.7
  15. else:contains(MEEGO_EDITION,harmattan):CONFIG(release, debug|release): LIBS += -L$$PWD/hupnp/lib/harmattan/release -lHUpnp -lQtSolutions_SOAP-2.7
  16. else:contains(MEEGO_EDITION,harmattan):CONFIG(debug, debug|release): LIBS += -L$$PWD/hupnp/lib/harmattan/debug -lHUpnp -lQtSolutions_SOAP-2.7
  17. #else:symbian: LIBS += -lHUpnp -lQtSolutions_SOAP-2.7
  18.  
  19. contains(MEEGO_EDITION,harmattan):CONFIG(debug, debug|release): DEPENDPATH += -L$$PWD/hupnp/harmattan/lib/debug
  20. contains(MEEGO_EDITION,harmattan):CONFIG(release, debug|release): DEPENDPATH += -L$$PWD/hupnp/harmattan/lib/release
  21.  
  22. contains(MEEGO_EDITION,harmattan):QMAKE_LFLAGS += -Wl,--rpath=/opt/LinnKontrol/hupnp/lib
  23. 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!

August 12, 2012

sdfanq sdfanq
Lab Rat
1 posts

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

  1. folder_01.source = ./lib/
  2. folder_01.target = /
  3. DEPLOYMENTFOLDERS = folder_01

to copy the lib folder

 
  ‹‹ QWebView and keyboard navigation in Qt4.6 and non-touch Symbian devices      qml plugin cannot be loaded in my qml project ››

You must log in to post a reply. Not a member yet? Register here!