Qmake creating a .pc file - c++

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.
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 the following output:
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)

According to qmake source code, you have to add:
CONFIG += create_prl no_install_prl
create_pc only adds the rule for the .pc file target to the makefile with the command "qmake -prl" and that command only creates the .pc file if the create_prl option is present.
no_install_prl prevents the unneeded .prl file, generated by create_prl, to be installed in ${target.path}.

I made a complete example here:
https://github.com/pvanhoof/dir-examples/blob/master/qmake-example/src/libs/qmake-example/qmake-example.pro
## We get the PREFIX, MAJOR_VERSION, MINOR_VERSION and PATCH_VERSION
## from this project-wide include
include(../../../qmake-example.pri)
## We will use the standard lib template of qmake
TEMPLATE = lib
## We need to set VERSION to a semver.org version for compile_libtool
VERSION = $${MAJOR_VERSION}"."$${MINOR_VERSION}"."$${PATCH_VERSION}
## According https://autotools.io/libtool/version.html, section 4.3
## we should have as target-name the API version in the library's name
TARGET = qmake-example-$${MAJOR_VERSION}"."$${MINOR_VERSION}
## We will write a define in config.h for access to the semver.org
## version as a double quoted string
QMAKE_SUBSTITUTES += config.h.in
## Our example happens to use QDebug, so we need QtCore here
QT = core
## This is of course optional
CONFIG += c++14
## We will be using libtool style libraries
CONFIG += compile_libtool
CONFIG += create_libtool
## These will create a pkg-config .pc file for us
CONFIG += create_pc create_prl no_install_prl
## Project sources
SOURCES = \
qmake-example.cpp
## Project headers
HEADERS = \
qmake-example.h
## We will install the headers in a API specific include path
headers.path = $${PREFIX}/include/qmake-example-$${MAJOR_VERSION}"."$${MINOR_VERSION}
## Here will go all the installed headers
headers.files = $${HEADERS}
## Here we will install the library to
target.path = $${PREFIX}/lib
## This is the configuration for generating the pkg-config file
QMAKE_PKGCONFIG_NAME = $${TARGET}
QMAKE_PKGCONFIG_DESCRIPTION = An example that illustrates how to do it right with qmake
# This is our libdir
QMAKE_PKGCONFIG_LIBDIR = $$target.path
# This is where our API specific headers are
QMAKE_PKGCONFIG_INCDIR = $$headers.path
QMAKE_PKGCONFIG_DESTDIR = pkgconfig
QMAKE_PKGCONFIG_PREFIX = $${PREFIX}
QMAKE_PKGCONFIG_VERSION = $$VERSION
## Installation targets (the pkg-config seems to install automatically)
INSTALLS += headers target

Related

No rule to make target 'bootstrap', needed by 'distdir-am'. Stop

I'm having the following problem when using automake to 'make dist'. Below is a snap shot of the error being reported by the compiler. I'm using Debian 10.5, with the default compiler version 8.0.3; autoconf 2.69; automake 1.16.1, libtool 2.4.6
######## Problem ########
aperri#debian:~/XerlangCPL2$ make dist
make dist-gzip am__post_remove_distdir='#:'
make[1]: Entering directory '/home/aperri/XerlangCPL2'
make distdir-am
make[2]: Entering directory '/home/aperri/XerlangCPL2'
make[2]: *** No rule to make target 'bootstrap', needed by 'distdir-am'. Stop.
make[2]: Leaving directory '/home/aperri/XerlangCPL2'
make[1]: *** [Makefile:633: distdir] Error 2
make[1]: Leaving directory '/home/aperri/XerlangCPL2'
make: *** [Makefile:710: dist] Error 2
I'm including my configure.ac and makefile.am in this message with the hope that there is a solution to this problem
######## configure.ac ########
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([XerlangCPL], [1.0], [aperri1001#gmail.com])
AC_CONFIG_SRCDIR([src/xmlPROC.cpp])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
# Enable "automake" to simplify creating Makefiles
AM_INIT_AUTOMAKE([1.16.1 subdir-objects -Wall -Werror])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
# Checks for programs.
AC_PROG_CC
AC_PROG_CXXCPP
AC_PROG_CXX
# Used in conjuction with {TARGET}_CPPFLAGS = -DDEBUG in Makefile.am
AM_PROG_CC_C_O
# Checks for libraries.
AX_BOOST_BASE([1.67], [], AC_MSG_ERROR([Could not find a useful version of boost]))
AX_BOOST_FILESYSTEM
AX_BOOST_SYSTEM
AX_BOOST_PROGRAM_OPTIONS
AX_BOOST_REGEX
# AX_BOOST_DATE_TIME
# AX_BOOST_THREAD
# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions
PKG_CHECK_MODULES(libxml, libxml++-2.6 >= 2.10.0 )
AC_CHECK_PROGS([DOXYGEN], [doxygen])
if test -z "$DOXYGEN";
then AC_MSG_WARN([Doxygen not found - continuing without Doxygen support])
fi
AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])
AC_CONFIG_FILES([Makefile doc/Doxyfile])
# AM_CONDITIONAL([DEBUG], [test x$debug = xtrue])
# AC_ARG_WITH(debug, [ --with-debug add the debugging module], [AC_DEFINE(WITH_DEBUG,1,0)
# AC_SUBST(WITH_DEBUG,1)
# CXXFLAGS="-O0 -ggdb"])
AC_OUTPUT
echo "
XErlang Compiler ($PACKAGE_NAME) version $PACKAGE_VERSION
Prefix.........: $prefix
Debug Build....: $debug
C++ Compiler...: $CXX $CXXFLAGS $CPPFLAGS
Linker.........: $LD $LDFLAGS $LIBS
"
######## makefile.am ########
ACLOCAL_AMFLAGS = -I m4 --install
bin_PROGRAMS = xerlangCPL
xerlangCPL_SOURCES = \
src/xmlPROC.cpp \
src/xml_structs.h \
src/debug.h \
src/conxsTracker.cpp \
src/conxs_tracker.h \
src/xmlConxsParser.cpp \
src/oven_control
xerlangCPL_LDFLAGS = -DDEBUG \
$(libxml_LIBS) \
$(BOOST_LDFLAGS) \
$(BOOST_SYSTEM_LDFLAGS) \
$(BOOST_FILESYSTEM_LDFLAGS) \
$(BOOST_PROGRAM_OPTIONS_LDFLAGS)
xerlangCPL_CPPFLAGS = $(libxml_CFLAGS) \
$(BOOST_CPPFLAGS)
xerlangCPL_LIBS = $(BOOST_SYSTEM_LIBS) \
$(BOOST_FILESYSTEM_LIBS) \
$(BOOST_PROGRAM_OPTIONS_LIBS)
xerlangCPL_CXXFLAGS = -lboost_filesystem -ldl -lboost_system
# start of Doxygen section
if HAVE_DOXYGEN
doxyfile.stamp:
$(DOXYGEN) $(top_srcdir)/doc/Doxyfile
echo Timestamp > $#
CLEANFILES = $(top_srcdir)/doxyfile.stamp
# all-local: doxyfile.stamp
all-local: doxyfile.stamp
# clean-local:
# rm -rf $(top_srcdir)/
endif
EXTRA_DIST = bootstrap m4/NOTES
The problem could be related to the inclusion of Boost Modules or the lack of them.
The problem is that EXTRA_DIST lists some mysterious file called bootstrap.
Makefile.am provides no instructions for building this file.
Therefore, this file is expected to already exist in the build directory, and it does not.
That's the reason for your make dist failure.
The reason for the missing file is something that you'll have to figure out on your own, the only thing that can be stated here is that its absence is the reason for your build failure.
You could, of course
touch bootstrap
and create an empty file in the build directory, which will be good enough. But you should investigate, in your project, what this file is, and where it should come from, and fix things accordingly.

Prevent compiler from using system library by default

I have a Qt project using SQL calls. On windows it is using the system library here C:\Program Files (x86)\Windows Kits\8.1\Include\um and its working fine.
However, under Linux (Fedora 20 distribution), there are two availables libraries. sqlite in /usr/includes and libiodbc in /usr/include/libiodbc. And I would like to force QT/The compiler to use libiodbc.
Is there a way to prevent the inclusion of the sqlite header? Or to force the user to have the required headers to be included with a #include
At the moment, there is no #include about any of the header, I've tried to include the libiodbc, but it's still trying to use the sqlite
EDIT : I have found the -nostdinc++, but if I use it, the header that im actually including, for example #include <regex> is not found anymore
EDIT2 : the problematic header are sqltypes.h and sqlext.h
My .pro files
QT -= gui
TARGET = Internal
TEMPLATE = lib
DEFINES += INTERNAL_LIBRARY
CONFIG += c++11
include( ../LSoftware.pri )
SOURCES += \
InDbHandle.cpp \
InDbConnection.cpp \
InDbStatement.cpp \
InGenius.cpp
HEADERS += \
InDefs.h \
InDbHandle.h \
InDbConnection.h \
InDbStatement.h \
InGenius.h
LIBS += -L$$OUT_PWD/$$DESTDIR -lLTech
INCLUDEPATH += $$PWD/../LTech
INCLUDEPATH += $$PWD/../Common
unix {
target.path = /usr/lib
INSTALLS += target
}
and LSoftware.pri
DEFINES *= QT_USE_QSTRINGBUILDER
# Supposed to be there by default, but just to be safe.
CONFIG += precompile_header warn_on
CONFIG(release, debug|release) {
DESTDIR = ../Output/Release$$QMAKE_TARGET.arch
OBJECTS_DIR = Release$$QMAKE_TARGET.arch
}
CONFIG(debug, debug|release) {
DESTDIR = ../Output/Debug$$QMAKE_TARGET.arch
OBJECTS_DIR = Debug$$QMAKE_TARGET.arch
}
MOC_DIR = $$OBJECTS_DIR
RCC_DIR = $$OBJECTS_DIR
# Not documented but seems to work...
PRECOMPILED_DIR = $$OBJECTS_DIR
PRECOMPILED_HEADER = StdAfx.h
LTP_PRODUCTION {
DEFINES += LTP_PRODUCTION
}

Build ffmpeg using yocto

I am trying to build ffmpeg for an ARM SoC. Therefore I am using yocto with following recipe:
SUMMARY = "FFMPEG"
HOMEPAGE = "http://ffmpeg.org"
LICENSE = "GPLv2"
#LIC_FILES_CHKSUM = "file://COPYING.GPLv2"
#SECTION = "net"
#DEPENDS = "sqlite3-native glib-2.0 zlib libpcre spawn-fcgi fcgi"
S = "${WORKDIR}/git"
SRCREV = "${AUTOREV}"
SRC_URI = "git://source.ffmpeg.org/ffmpeg.git;branch=release/2.8 \
"
PACKAGECONFIG[--build] = ""
EXTRA_OECONF = " \
--extra-ldflags=-static \
--extra-cflags=-static \
--disable-mipsfpu \
--disable-mips32r2 \
--disable-mipsdspr1 \
--disable-mipsdspr2 \
--enable-bzlib \
--enable-zlib \
"
inherit autotools pkgconfig
Building this recipe throws following errer:
Unknown option "--build=x86_64-linux`
How can I remove this configuration flag from do_configure?
Or is there any other way to build ffmpeg?
If you're using yocto (as you said) it would be best to simply include the ffmpeg package in your image using:
IMAGE_INSTALL += "ffmpeg"
This should work because ffmpeg is available in the poky repository.
If you need a specific version of ffmpeg, IMHO it is the best way to adapt the available recipe to your needs.

Qt migrating from Qt 4 to 5, pri file not included during qmake

I am migrating a project from qt 4.8.6 to qt 5.3.2.
I have a pro file which is like this:
...
#
# External library configuration
#
include(QGCExternalLibs.pri)
#
# Post link configuration
#
include(QGCSetup.pri)
...
and the QGCExternalLibs.pri is simply something like:
#
# Add in a few missing headers to windows
#
WindowsBuild {
INCLUDEPATH += libs/lib/msinttypes \
libs/thirdParty/opencv/include
LIBS += -L$$BASEDIR/libs/thirdParty/opencv/x86/vc10/lib
LIBS += opencv_core231d.lib \
opencv_highgui231d.lib \
opencv_video231d.lib \
opencv_imgproc231d.lib \
opencv_ml231d.lib \
opencv_features2d231d.lib \
opencv_flann231d.lib \
opencv_calib3d231d.lib \
opencv_objdetect231d.lib \
opencv_ts231d.lib
}
However, when I run qmake -tp vc xxxxx.pro the .pro file is qmaked successfully, however, the .pri file is not included at all. What should I do in this case?

Compilation Error in Qt

I am trying to break my large project into sub directories and run it as a single executable. But when I am executing the code it is giving me the following error:
qtmain_win.cpp:-1: error: undefined reference to `qMain(int, char**)'
collect2: ld returned 1 exit status
Can anyone please explain what is the reason behind these errors...
Thanks in advance!!!!
I have made a .pro file in which all the path to the subdirectories are included. Then each directory has its own .pro and .pri file with a directory which is common in all the directories. This directory is made as a lib. Then there is a main with main.pro and main.cpp. I am pasting all the three files here: Project's pro file:
# build all components recursive
TEMPLATE = subdirs
######## normal build process ########
#
# Make sure your Main.pro is in the last line to ensure correct linking!
#
SUBDIRS =D:/MultiFuncTester/Modes/Start/Build/Start.pro \
D:/MultiFuncTester/Modes/MainMenu/Build/MainMenu.pro \
D:/MultiFuncTester/Modes/Solar/Build/Solar.pro \
D:/MultiFuncTester/Modes/Main/Build/Main.pro\
CONFIG += ordered
Main.pro:
# ################ include pri file #################
!include("Main.pri"):error("Main.pri not found")
# ################ override some pri settings #################
TEMPLATE = app
TARGET = MultiFuncTester
CONFIG =-static
QT +=core\
gui\
# ################ own sources #################
INCLUDEPATH +=D:/MultiFuncTester/
SOURCES +=../Sources/Main.cpp
Project's pri file which is common in all directories made as a lib
######################
# common stuff for all components
######################
TEMPLATE = lib
CONFIG += static \
warn_on \
qt \
QT += gui \
core \
INCLUDEPATH +=D:/MultiFuncTester/Modes \
DEPENDPATH +=D:/MultiFuncTester/Modes \
CONFIG += debug_and_release
CONFIG += build_all
CONFIG(debug, debug|release) {
CONFIG_SUFFIX = dbg
} else {
CONFIG_SUFFIX = rel
DEFINES += QT_NO_DEBUG \
QT_NO_DEBUG_OUTPUT \
NDEBUG
CONFIG(gcov) {
QMAKE_CXXFLAGS_RELEASE += -fprofile-arcs -ftest-coverage
QMAKE_LFLAGS_RELEASE += -fprofile-arcs
QMAKE_CXXFLAGS_RELEASE -= -O2
QMAKE_CXXFLAGS_RELEASE += -O0
}
}
CONFIG(crosstgt) {
#To be able to build Target run qmake as follows:
qmake CONFIG+=crosstgt
CONFIG_SUFFIX = $${CONFIG_SUFFIX}_tgt
DEFINES += TARGET_BUILD
}
OBJECTS_DIR = obj_$${CONFIG_SUFFIX}
MOC_DIR = moc_$${CONFIG_SUFFIX}
DESTDIR = lib_$${CONFIG_SUFFIX}