Results 1 to 10 of 10

Thread: Split project into shared libs - linking issue.

  1. #1
    Join Date
    Jun 2009
    Location
    Krakow, Poland
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Split project into shared libs - linking issue.

    Hello
    I have problem to set correct build settings to create and link shared libs.
    My solution (session) structure:
    1. Faktur (main app)
      • MainWindow (lib)
        • MenuGlowne (lib)
        • PrintThread (lib)
        • QueryThread (lib)

    For each project I defined dependencies. All projects has the same build directory. Finally all libs are being build but when main app is being created then error appear:
    /usr/bin/ld: warning: libmenuglownelib.so.1, needed by ./libmainwindowlib.so, not found (try using -rpath or -rpath-link)
    /usr/bin/ld: warning: libprintthreadlib.so.1, needed by ./libmainwindowlib.so, not found (try using -rpath or -rpath-link)
    /usr/bin/ld: warning: libquerythreadlib.so.1, needed by ./libmainwindowlib.so, not found (try using -rpath or -rpath-link)
    I had defined lib's folders and names for each project:
    - MainApp
    QT += core gui sql
    TARGET = Faktura
    TEMPLATE = app

    SOURCES += \
    main.cpp

    LIBS += -L"."
    LIBS += -lmainwindowlib
    INCLUDEPATH += ../MainWindow
    -MainWindow
    QT += core gui sql

    TARGET = mainwindowlib
    TEMPLATE = lib

    DEFINES += MAINWINDOWLIB_LIBRARY

    HEADERS += \
    mainwindow.h \
    mainwindowlib_global.h \
    timer.h

    SOURCES += \
    mainwindow.cpp \
    timer.cpp

    FORMS += \
    mainwindow.ui

    INCLUDEPATH += ../MenuGlowne \
    ../FakturaVAT \
    ../PrintThread
    ../QueryThread

    debug:LIBS += -L"."
    release:LIBS += -L"."

    LIBS += -lmenuglownelib \
    -lprintthreadlib \
    -lquerythreadlib
    -PrintThread
    QT += core gui sql

    TARGET = printthreadlib
    TEMPLATE = lib

    DEFINES += PRINTTHREADLIB_LIBRARY

    HEADERS += \
    printthread.h \
    printthreadlib_global.h

    SOURCES += \
    printthread.cpp
    Basicly on windows I had compiled project. Problem has appeared on linux. Somehow linker is not linking shared libs into other shared lib.
    What I'm doing wrong?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Split project into shared libs - linking issue.

    Where do those three files mentioned by the warnings exist? Are you using shadow builds?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jun 2009
    Location
    Krakow, Poland
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Split project into shared libs - linking issue.

    All files exist in the same folder. All projects has the same build folder.
    What does mean "shadow builds"? What is it?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Split project into shared libs - linking issue.

    "Same folder" meaning which one? A shadow build is also called "out of source" build -- when the main compilation directory is different from the source directory.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jun 2009
    Location
    Krakow, Poland
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Split project into shared libs - linking issue.

    Faktur project is in folder: /home/user/workspace/qt4/FakturSession/Faktur/
    MainWindow: /home/user/workspace/qt4/FakturSession/MainWindow/
    PrintThread: /home/user/workspace/qt4/FakturSession/PrintThread/

    All projects has the same build destination: /home/user/workspace/qt4/FakturSession/Faktur-build-desktop/

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Split project into shared libs - linking issue.

    In that case you need to pass "-L../Faktur-build-desktop" instead of "-L."
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Jun 2009
    Location
    Krakow, Poland
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Split project into shared libs - linking issue.

    I have passed "-L../Faktur-build-desktop" into projects where lib folder is being defined and still the same issue. All libs are created but on last step, when application is being created, those errors appears.

  8. #8
    Join Date
    Apr 2010
    Posts
    769
    Thanks
    1
    Thanked 94 Times in 86 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Split project into shared libs - linking issue.

    The build system can't find the libraries. That means it hasn't been told where to look for them. Since you're able to locate them, add their location to the project file, do a 'make clean', qmake and rebuild everything. Or, if you want them all in one place, arrange for the build system to deliver them to that location with the 'install' object.

    If there are still problems, examine the build lines generated during make, and ensure that both the compiler and linker are looking in the proper locations and sending output to the proper locations. If not, revisit the project file, 'make clean', qmake and rebuild, again. Note whether your changes have taken place.

  9. #9
    Join Date
    Jun 2009
    Location
    Krakow, Poland
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Split project into shared libs - linking issue.

    It's working now. Thank you for your help.

  10. #10
    Join Date
    Jun 2009
    Location
    Krakow, Poland
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Split project into shared libs - linking issue.

    I have one more question regarding this subject.
    Some of projects (compiled as libs) contains folders with .png files. Can I have one global folder with icons (.png) for all of those projects? What is best solution in this situation? How to correct store and define those files as resources?

Similar Threads

  1. qmake multiple shared libs
    By rrlangly in forum Qt Programming
    Replies: 1
    Last Post: 23rd June 2010, 23:32
  2. Linking 3rd party libs on Mac OS X
    By jonks in forum Qt Programming
    Replies: 2
    Last Post: 21st June 2010, 06:03
  3. Statically linking QT libs on symbian
    By bullwinkle in forum Newbie
    Replies: 1
    Last Post: 6th February 2010, 10:25
  4. Linking against different Libs
    By AlphaWolf in forum Qt Programming
    Replies: 3
    Last Post: 10th February 2009, 15:25
  5. problem with order of libs during linking
    By minimax in forum Qt Programming
    Replies: 2
    Last Post: 8th January 2008, 10:32

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.