Qmake creating a .pc file.



  • Does anyone know if qmake can create a .pc file? I found someone that said it could here: http://www.qtcentre.org/threads/24422-How-can-we-create-.pc-file-automatically. But I have tried it and got the same results as the person having the issue at the bottom of the thread. I was wondering if someone knew anything about this.

    the .pro file is:

    @TEMPLATE = lib
    TARGET = proc_Model
    QT += declarative dbus
    CONFIG += qt plugin dbus create_pc
    DESTDIR = /usr/lib/

    OBJECTS_DIR = .obj
    MOC_DIR = .moc

    TARGET = $$qtLibraryTarget($$TARGET)

    INCLUDEPATH += ../common

    Input

    SOURCES += ../common/proc_struct.cpp
    listitem.cpp
    listmodel.cpp
    process.cpp
    proc_if.cpp

    HEADERS += ../common/proc_struct.h
    listitem.h
    listmodel.h
    process.h
    proc_if.h

    headers.path= /usr/include/proc_Model
    headers.files = ../common/proc_struct.h
    listitem.h
    listmodel.h
    process.h
    proc_if.h

    target.path = /usr/lib

    QMAKE_PKGCONFIG_NAME = proc_Model
    QMAKE_PKGCONFIG_DESCRIPTION = Model that emits process info
    QMAKE_PKGCONFIG_LIBDIR = $$target.path
    QMAKE_PKGCONFIG_INCDIR = $$target.path
    QMAKE_PKGCONFIG_DESTDIR = pkgconfig

    INSTALLS+=headers target
    @

    When I "make install" I get:

    @install -m 755 -p "/usr/lib/libproc_Model.so" "/usr/lib/libproc_Model.so"
    install: /usr/lib/libproc_Model.so' and/usr/lib/libproc_Model.so' are the same file
    make: [install_target] Error 1 (ignored)
    strip --strip-unneeded "/usr/lib/libproc_Model.so"
    install -m 644 -p "/usr/lib/pkgconfig/proc_Model.pc" "/usr/lib/pkgconfig/proc_Model.pc"
    install: cannot stat `/usr/lib/pkgconfig/proc_Model.pc': No such file or directory
    make: [install_target] Error 1 (ignored)@



  • I think DESTDIR is for the relative destination directory within the build directory, not the final installation directory (that would be target.path). And that's why you are getting the "are the same file" error.
    So you should probably remove that DESTDIR line.



  • Thanks. That fixed the qmake issue, but it is still not generating the pkgconfig file. Any other ideas?



  • You have to add:
    @CONFIG += create_prl no_install_prl@

    It also creates a .prl file in the build dir, and would install it in $$target.path without the no_install_prl option.
    And searching through qmake source code I found that if you need to create libtool files (.la files that seem to have the same purpose as .pc files), you can add create_libtool to CONFIG, and it needs create_prl too.



  • Just awakening this old thread to add a note: To get the actual pc file, add create_pc as well to the CONFIG (needs the create_prl statement as well).
    It will install the .pc file in the SYSROOT/usr/lib/pkgconfig folder upon make install.

    For those with an SDK built using The Yocto Project or alike, I use the following command to install into the correct SDK target sysroot after having sourced the SDK environment script:

    sudo INSTALL_ROOT=$SDKTARGETSYSROOT make install
    

Log in to reply
 

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