Results 1 to 5 of 5

Thread: qt does not try to find a 3rd party lib even though its location is specified

  1. #1
    Join Date
    Feb 2016
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default qt does not try to find a 3rd party lib even though its location is specified

    I put four 3rd party .so files in total in same folder. And qt can find 3 of them, except only one: libMPCtrl.so

    Below is part of my pro file: (notice that I just put three .so files to LIBS but interestingly, qt find another one automatically.) How can I make qt find the libMPCtrl.so ?

    unix{
    LIBS += -L$$PWD/lib -lhcnetsdk \
    -lPlayCtrl \
    -lMPCtrl
    }

    INCLUDEPATH += $$PWD/include/ \
    $$PWD/Configuration/Public/ \
    $$PWD/lib/

    (It doesn't matter whether I use . or $$PWD, same result.)

    I mean, actually instead of "cannot find it", qt even didn't TRY to find it. According to strace tool, qt never tried to open() this .so file.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: qt does not try to find a 3rd party lib even though its location is specified

    I am not sure what you mean by "qt doesn't try to find it".

    Qt itself only ever tries to look for plugins for one of its subsystems that are plugin extensible, e.g. image I/O plugins.

    Did you mean your application doesn't start because the system linker can't find the library or did you mean your build process doesn't attempt to link the library?

    Cheers,
    _

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: qt does not try to find a 3rd party lib even though its location is specified

    The issue is almost certainly that the OP thinks "." and "$$PWD" refer to somewhere other than where qmake does, and consequently the compiler (in the case of INCLUDEPATH) and linker (LIBS) are being told to look. Inspection of the compiler/linker commands issued by make (or nmake) should make plain where it is actually looking.

  4. #4
    Join Date
    Feb 2016
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: qt does not try to find a 3rd party lib even though its location is specified

    I've checked makefile, nothing seems wrong. any ideas?

    CC = gcc
    CXX = g++
    DEFINES = -DQT_WEBKIT -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
    CFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
    CXXFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
    INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I../RemoteClient -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I../RemoteClient/include -I../RemoteClient/Configuration/Public -I../RemoteClient/lib -I../RemoteClient -I/usr/X11R6/include -I. -I. -I../RemoteClient -I.
    LINK = g++
    LFLAGS =
    LIBS = $(SUBLIBS) -L/usr/lib/i386-linux-gnu -L/usr/X11R6/lib -L./lib/ -Wl,-rpath=./lib/,-rpath=./ -lhcnetsdk -lPlayCtrl -lMPCtrl -lQtOpenGL -lQtGui -lQtCore -lGL -lpthread
    AR = ar cqs
    RANLIB =
    QMAKE = /usr/bin/qmake-qt4
    TAR = tar -cf
    COMPRESS = gzip -9f
    COPY = cp -f
    SED = sed
    COPY_FILE = $(COPY)
    COPY_DIR = $(COPY) -r
    STRIP = strip
    INSTALL_FILE = install -m 644 -p
    INSTALL_DIR = $(COPY_DIR)
    INSTALL_PROGRAM = install -m 755 -p
    DEL_FILE = rm -f
    SYMLINK = ln -f -s
    DEL_DIR = rmdir
    MOVE = mv -f
    CHK_DIR_EXISTS= test -d
    MKDIR = mkdir -p

    ####### Output directory

    OBJECTS_DIR = ./


    Added after 11 minutes:


    The latter one, the build process doesn't attempt to link the library. because the strace found that it didn't make open() call to the .so file. and ldd shows that it only depends on libhcnetsdk.so => ./libhcnetsdk.so (0xb6eaa000) and libhpr.so => ./libhpr.so (0xb5c0c000) besides standard libs.

    Moreover, after I changed that to unix{
    LIBS += -L./lib/ -Wl,-rpath=./lib/,-rpath=./ -lhcnetsdk -lPlayCtrl -lMPCtrl
    }

    still problem.
    Last edited by ohuohuo; 28th February 2016 at 05:51.

  5. #5
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: qt does not try to find a 3rd party lib even though its location is specified

    Ok, so your build fails with an "undefined reference" error and MPCtrl contains that symbol?

    Cheers,
    _

Similar Threads

  1. Find and Send User Current Location like Viber with QT
    By hasti in forum Qt for Embedded and Mobile
    Replies: 5
    Last Post: 28th September 2014, 08:28
  2. using a third party Makefile
    By prkhr4u in forum Qt Programming
    Replies: 3
    Last Post: 16th October 2013, 07:38
  3. Replies: 1
    Last Post: 28th May 2012, 16:06
  4. How to find the location of the user?
    By nikhilqt in forum Qt Programming
    Replies: 7
    Last Post: 14th December 2010, 19:22
  5. using third party libs
    By jay in forum Qt Programming
    Replies: 13
    Last Post: 14th April 2009, 16:52

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.