When running conan install . -s arch=x86 on an x86_64 System, I expect a compiler option like CONAN_CXXFLAGS_MYLIB=-m32 in the generated conanbuildinfo.mak file, but there is no such an option.
First, the contents of the conanfile.txt:
[requires]
mylib/1.0#demo/dev
[generators]
make
Here is the output of the install command (cmake has special treatment, because it is only a tool):
$ conan install . -s cmake:arch=x86_64 -s arch=x86
Configuration:
[settings]
arch=x86
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++11
compiler.version=9
os=Linux
os_build=Linux
cmake:arch=x86_64
[options]
[build_requires]
[env]
conanfile.txt: Installing package
Requirements
mylib/1.0#demo/dev from local cache - Cache
Packages
mylib/1.0#demo/dev:eb79ce42f6e6b4359bd7d0a65a238a4dae953257 - Cache
'''
Cross-build from 'Linux:x86_64' to 'Linux:x86'
Installing (downloading, building) binaries...
mylib/1.0#demo/dev: Already installed!
conanfile.txt: Generator make created conanbuildinfo.mak
conanfile.txt: Generator txt created conanbuildinfo.txt
conanfile.txt: Generated conaninfo.txt
conanfile.txt: Generated graphinfo
The generated makfe file looks like this:
#-------------------------------------------------------------------#
# Makefile variables from Conan Dependencies #
#-------------------------------------------------------------------#
CONAN_ROOT_MYLIB ?= \
/home/username/.conan/data/mylib/1.0/demo/dev/package/eb79ce42f6e6b4359bd7d0a65a238a4dae953257
CONAN_SYSROOT_MYLIB ?= \
CONAN_INCLUDE_DIRS_MYLIB += \
/home/username/.conan/data/mylib/1.0/demo/dev/package/eb79ce42f6e6b4359bd7d0a65a238a4dae953257/include
CONAN_LIB_DIRS_MYLIB += \
/home/username/.conan/data/mylib/1.0/demo/dev/package/eb79ce42f6e6b4359bd7d0a65a238a4dae953257/lib
CONAN_BIN_DIRS_MYLIB += \
CONAN_BUILD_DIRS_MYLIB += \
/home/username/.conan/data/mylib/1.0/demo/dev/package/eb79ce42f6e6b4359bd7d0a65a238a4dae953257/
CONAN_RES_DIRS_MYLIB += \
CONAN_LIBS_MYLIB += \
mylib
CONAN_SYSTEM_LIBS_MYLIB += \
CONAN_DEFINES_MYLIB += \
CONAN_CFLAGS_MYLIB += \
CONAN_CXXFLAGS_MYLIB += \
CONAN_SHAREDLINKFLAGS_MYLIB += \
CONAN_EXELINKFLAGS_MYLIB += \
CONAN_FRAMEWORKS_MYLIB += \
CONAN_FRAMEWORK_PATHS_MYLIB += \
CONAN_ROOTPATH += \
$(CONAN_ROOTPATH_MYLIB)
CONAN_SYSROOT += \
$(CONAN_SYSROOT_MYLIB)
CONAN_INCLUDE_DIRS += \
$(CONAN_INCLUDE_DIRS_MYLIB)
CONAN_LIB_DIRS += \
$(CONAN_LIB_DIRS_MYLIB)
CONAN_BIN_DIRS += \
$(CONAN_BIN_DIRS_MYLIB)
CONAN_BUILD_DIRS += \
$(CONAN_BUILD_DIRS_MYLIB)
CONAN_RES_DIRS += \
$(CONAN_RES_DIRS_MYLIB)
CONAN_LIBS += \
$(CONAN_LIBS_MYLIB)
CONAN_DEFINES += \
$(CONAN_DEFINES_MYLIB)
CONAN_CFLAGS += \
$(CONAN_CFLAGS_MYLIB)
CONAN_CXXFLAGS += \
$(CONAN_CXXFLAGS_MYLIB)
CONAN_SHAREDLINKFLAGS += \
$(CONAN_SHAREDLINKFLAGS_MYLIB)
CONAN_EXELINKFLAGS += \
$(CONAN_EXELINKFLAGS_MYLIB)
CONAN_FRAMEWORKS += \
$(CONAN_FRAMEWORKS_MYLIB)
CONAN_FRAMEWORK_PATHS += \
$(CONAN_FRAMEWORK_PATHS_MYLIB)
CONAN_SYSTEM_LIBS += \
$(CONAN_SYSTEM_LIBS_MYLIB)
#-------------------------------------------------------------------#
Conan knows, that this is a cross-build, it knows the compiler, it builds mylib with 32 bitness (or takes the 32 bit binaries, if found in the repo). So it should be obvious, that my app needs to be compiled with -m32.
Why is my expectation wrong?
UPDATE:
I have found the solution myself. If a conanfile.py is used with the autotools/make helper instead of the simple conanfile.txt, then it is possible to build the app with conan build ., and conan sets all compiler options and defines correctly. Here is an example of such a consumer receipt:
from conans import ConanFile, AutoToolsBuildEnvironment
from conans import tools
class AppConan(ConanFile):
name = "mayapp"
version = "1.0"
settings = "os", "compiler", "build_type", "arch"
requires = "mylib/1.0#demo/dev"
generators = "make", "virtualrunenv"
def build(self):
atools = AutoToolsBuildEnvironment(self)
atools.make()
Related
I am using Qt Creator, Qt6, C++ for my program.
I would like to use the PoDoFo library but I have no knowledge of how to add the library/headers so that I can use it in my project and build it.
I have downloaded the PoDoFo code, just can't find any guidance/tutorials on how to add PoDoFo specifically in Qt Creator.
Edit: I tried "Add Library" to my project and used external library option. Once I finish, I try to compile my code and I get an error "podofo-0.9.7\COPYING.LIB:-1: error: LNK1107: invalid or corrupt file: cannot read at 0x62DC"
I can include the podofo.h file but that will also throw this error:"podofo-0.9.7\src\podofo\base\PdfCompilerCompat.h:44: error: C1083: Cannot open include file: 'podofo_config.h': No such file or directory"
.pro file:
QT += core gui sql printsupport
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++17
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
#QMAKE_CXXFLAGS += -std=c++17
SOURCES += \
addbookdialog.cpp \
addbooksdialog.cpp \
bookdetailswindow.cpp \
bulkdetailsdialog.cpp \
cleanebooksdialog.cpp \
insertlinkdialog.cpp \
inserttabledialog.cpp \
linkcollectiondialog.cpp \
linkmanagerwindow.cpp \
main.cpp \
mainwindow.cpp \
searchnamedialog.cpp \
summarywindow.cpp
HEADERS += \
addbookdialog.h \
addbooksdialog.h \
bookdetailswindow.h \
bulkdetailsdialog.h \
cleanebooksdialog.h \
common.h \
insertlinkdialog.h \
inserttabledialog.h \
linkcollectiondialog.h \
linkmanagerwindow.h \
mainwindow.h \
queries.h \
searchnamedialog.h \
summarywindow.h
FORMS += \
addbookdialog.ui \
addbooksdialog.ui \
bookdetailswindow.ui \
bulkdetailsdialog.ui \
cleanebooksdialog.ui \
insertlinkdialog.ui \
inserttabledialog.ui \
linkcollectiondialog.ui \
linkmanagerwindow.ui \
mainwindow.ui \
searchnamedialog.ui \
summarywindow.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
DISTFILES += \
style.qss
RESOURCES += \
images.qrc \
style.qrc
unix|win32: LIBS += -L$$PWD/3rdparty/podofo-0.9.7/ -lCOPYING
INCLUDEPATH += $$PWD/3rdparty/podofo-0.9.7/src/podofo
DEPENDPATH += $$PWD/3rdparty/podofo-0.9.7/src/podofo
qt creator add library dialog:
Did you take a look on this link: https://doc.qt.io/qt-5/third-party-libraries.html?
I just followed it and my 3rdParty library (https://github.com/cutelyst/simple-mail) was linked and accessible from my application C++.
Basically, your .pro file will look like this after setting everything properly:
TARGET = MyQtApp
TEMPLATE = app
INCLUDEPATH += 3rdparty/CatWhisperer/include
SOURCES += src/main.cpp
LIBS += -L"3rdparty/CatWhisperer/lib" -lCatWhisperer
I am trying to install headers of my library using QMake. These headers gave a hierarchical order that must be applied on installation target as well. My current solution for this is to add many targets (each for one subdirectory):
...
headers.path = /usr/include/foo/widgets
headers_base.path = /usr/include/foo/widgets
headers_data.path = /usr/include/foo/widgets/data
headers_editors.path = /usr/include/foo/widgets/editors
...
HEADERS_BASE += \
foo.hpp \
bar.hpp
HEADERS_DATA += \
data/foo.hpp \
data/bar.hpp
HEADERS_EDITORS += \
editors/foo.hpp \
editors/bar.hpp
...
HEADERS += $$HEADERS_BASE \
$$HEADERS_DATA \
$$HEADERS_EDITORS
This is tedius and error-prune. I would like to use something simple and straightforward like nobase in autotools. Something like this:
magic_HEADERS += \
foo.hpp \
bar.hpp
data/foo.hpp \
data/bar.hpp
editors/foo.hpp \
editors/bar.hpp
Note
Having
HEADERS += \
foo.hpp \
bar.hpp
data/foo.hpp \
data/bar.hpp
editors/foo.hpp \
editors/bar.hpp
Installs all headers in a single directory.
Headers will be installed if you change .pro file with example:
HEADERS += \
include/widgets/foo.hpp \
include/widgets/bar.hpp \
include/widgets/data/foo.hpp \
include/widgets/data/bar.hpp \
include/widgets/editors/foo.hpp \
include/widgets/editors/bar.hpp
unix {
headers.path = /usr/local/include
headers.files = $$PWD/include/*
target.path = /usr/local/lib
INSTALLS += target headers
}
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.
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?
I'm developing Qt application on Win 7 (using Windows Qt distro with MinGW included) and I need to use Google's protocol buffers. So I followed this How to build Google's protobuf in Windows using MinGW? and I have managed to build it.
But it was necessary for me to install separately MinGW and MSYS to achieve that.
Is there cleaner way how to built in protobufs in my app just using Qt and it's toolchain ?
We created new project and added files from protobuf. I can give you my .pro file.
Then we included this project to our common project (subdirs)
QT -= gui
TARGET = protobuf
TEMPLATE = lib
CONFIG += staticlib
# DESTDIR
win32 {
CONFIG(debug, debug|release): DESTDIR = ../bin/debug
CONFIG(release, debug|release): DESTDIR = ../bin/release
}
unix {
CONFIG(debug, debug|release): DESTDIR = ../bin_unix/debug
CONFIG(release, debug|release): DESTDIR = ../bin_unix/release
}
INCLUDEPATH += ../protobuf
SOURCES += \
google/protobuf/wire_format_lite.cc \
google/protobuf/wire_format.cc \
google/protobuf/unknown_field_set.cc \
google/protobuf/text_format.cc \
google/protobuf/service.cc \
google/protobuf/repeated_field.cc \
google/protobuf/reflection_ops.cc \
google/protobuf/message_lite.cc \
google/protobuf/message.cc \
google/protobuf/generated_message_util.cc \
google/protobuf/generated_message_reflection.cc \
google/protobuf/extension_set_heavy.cc \
google/protobuf/extension_set.cc \
google/protobuf/dynamic_message.cc \
google/protobuf/descriptor_database.cc \
google/protobuf/descriptor.pb.cc \
google/protobuf/descriptor.cc \
google/protobuf/compiler/parser.cc \
google/protobuf/compiler/importer.cc \
google/protobuf/io/zero_copy_stream_impl_lite.cc \
google/protobuf/io/zero_copy_stream_impl.cc \
google/protobuf/io/zero_copy_stream.cc \
google/protobuf/io/tokenizer.cc \
google/protobuf/io/printer.cc \
google/protobuf/io/gzip_stream.cc \
google/protobuf/io/coded_stream.cc \
google/protobuf/stubs/substitute.cc \
google/protobuf/stubs/strutil.cc \
google/protobuf/stubs/structurally_valid.cc \
google/protobuf/stubs/once.cc \
google/protobuf/stubs/common.cc
HEADERS += \
google/protobuf/wire_format_lite_inl.h \
google/protobuf/wire_format_lite.h \
google/protobuf/wire_format.h \
google/protobuf/unknown_field_set.h \
google/protobuf/text_format.h \
google/protobuf/service.h \
google/protobuf/repeated_field.h \
google/protobuf/reflection_ops.h \
google/protobuf/message_lite.h \
google/protobuf/message.h \
google/protobuf/generated_message_util.h \
google/protobuf/generated_message_reflection.h \
google/protobuf/extension_set.h \
google/protobuf/dynamic_message.h \
google/protobuf/descriptor_database.h \
google/protobuf/descriptor.pb.h \
google/protobuf/descriptor.h \
google/protobuf/compiler/parser.h \
google/protobuf/compiler/importer.h \
google/protobuf/io/zero_copy_stream_impl_lite.h \
google/protobuf/io/zero_copy_stream_impl.h \
google/protobuf/io/zero_copy_stream.h \
google/protobuf/io/tokenizer.h \
google/protobuf/io/printer.h \
google/protobuf/io/gzip_stream.h \
google/protobuf/io/coded_stream_inl.h \
google/protobuf/io/coded_stream.h \
google/protobuf/stubs/substitute.h \
google/protobuf/stubs/strutil.h \
google/protobuf/stubs/stl_util-inl.h \
google/protobuf/stubs/once.h \
google/protobuf/stubs/map-util.h \
google/protobuf/stubs/hash.h \
google/protobuf/stubs/common.h \
config.h
# Turn off ALL warning for the project
win32:CONFIG += warn_off
An alternative way to build is to use this project: https://github.com/cjh1/protobuf which does not require running ./configure but does require the CMake build system for Windows which can integrate with the MinGW toolchain that comes with Qt. It currently only builds a protobufs as static libraries (not dynamic/shared) and doesn't install header files but I hope eventually those features will be built in.