Now that i can link with the flag -ljsoncpp on ubuntu with g++ , how can i add this compiler flag with colcon to build a ros2 package ? each time i compile a project contains a jsoncpp functions with colcon build for ROS2, there is an undeclared reference error (linking error). Any help or suggestion please ?
Best regards,
Related
I downloaded a Qt source from the official site.
I extracted it in home directory and try to build it using commands:
./configure -developer-build
cmake --build .
But I get this error:
[ 48%] Running moc --collect-json for target tst_qmlsplitlib
Error opening /home/yas/Qt-6.3.1/qtdeclarative/tests/auto/qml/qmlsplitlib/tst_qmlsplitlib_autogen/include/moc_tst_qmlsplitlib_library_tst_qmlsplitlib.cpp.json for reading
gmake[2]: *** [qtdeclarative/tests/auto/qml/qmlsplitlib/CMakeFiles/tst_qmlsplitlib.dir/build.make:75: qtdeclarative/tests/auto/qml/qmlsplitlib/meta_types/qt6tst_qmlsplitlib_debug_metatypes.json.gen] Error 1
gmake[2]: *** Deleting file 'qtdeclarative/tests/auto/qml/qmlsplitlib/meta_types/qt6tst_qmlsplitlib_debug_metatypes.json.gen'
gmake1: *** [CMakeFiles/Makefile2:141639: qtdeclarative/tests/auto/qml/qmlsplitlib/CMakeFiles/tst_qmlsplitlib.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
'''
I have MacBook Pro 2012 and with Debian 11.
Any help would be appreciated.
Building Qt6 with make is not really supported. There should be a CMake warning about that in the configure output.
Please install ninja and try to configure again. The configure script will detect ninja's presence and use CMake's ninja generator.
You didn't share the CMake version you're using. Please use a recent CMake, best something > 3.22.
If you don't plan to run the autotests, configure with -nomake tests.
Lastly, please report such build problems at https://bugreports.qt.io/ - that's a better place to reach us.
I'm attempting to build Mumble on my Windows 10 PC in Qt, and I'm running into some issues (I think I'm just a bit lost on some of the Qt, CMake, and build lingo). I've installed all of the required Qt packages through VCPKG, and I've built the program with almost no issues through the "x64 Native Tools Command Prompt for VS 2019"...
Here is the build documentation that Mumble provides.
I believe what's got me particularly confused is the CMake process. After getting the necessary packages installed, the Mumble instructions have you run the following cmake -G command.
cmake -G "NMake Makefiles" "-DVCPKG_TARGET_TRIPLET=x64-windows-static-md" "-Dstatic=ON" "-DCMAKE_TOOLCHAIN_FILE=D:\Users\Skewb\Documents\repos\vcpkg\scripts\buildsystems\vcpkg.cmake" "-DIce_HOME=D:\Users\Skewb\Documents\repos\vcpkg\installed\x64-windows-static-md" "-DCMAKE_BUILD_TYPE=Release" ..
Followed by the actual "build" command:
cmake --build .
From what I can tell, there's no place for me to input the cmake -G command in the "Build Settings" page. Here's where I've attempted to input it. I've been through the errors below, but I think my lack of understanding of cmake --build and cmake -G has made looking at these files unnecessary.
If I've somehow gotten that correct (I haven't), here's the error I'm getting. It's unable to find the "Ice" directory, but I've specified it in that command.
-- Qt5 component found: Widgets | Version: 5.15.2
CMake Error at cmake/pkg-utils.cmake:87 (message):
Ice component not found: Ice
Call Stack (most recent call first):
src/murmur/CMakeLists.txt:267 (find_pkg)
-- Configuring incomplete, errors occurred!
See also "C:/Users/skewb/AppData/Local/Temp/QtCreator-CfECuA/qtc-cmake-Kjqhpyja/CMakeFiles/CMakeOutput.log".
See also "C:/Users/skewb/AppData/Local/Temp/QtCreator-CfECuA/qtc-cmake-Kjqhpyja/CMakeFiles/CMakeError.log".
CMake process exited with exit code 1.
Elapsed time: 00:55.
I've also gone through these instructions and found the "CMake generator" option in the "Kits" settings, but I don't see anywhere to change the options you feed it:
I think I'm conflating a bunch of terms and their uses in the Mumble documentation vs. Qt including, but not limited to:
Build
Make
Run
Clean
Any help understanding this issue would be greatly appreciated.
Just installed QT and trying to build a QT project from inside the QTcreator using Cmake instead of Qmake.
I get the following error:
Starting to parse CMake project, using: "DCMAKE_BUILD_TYPE:STRING=Debug",
"-DCMAKE_CXX_COMPILER:STRING=",
"-DCMAKE_C_COMPILER:STRING=",
"DCMAKE_PREFIX_PATH:STRING=C:/Qt/5.13.1/msvc2015_64",
"DQT_QMAKE_EXECUTABLE:STRING=C:/Qt/5.13.1/msvc2015_64/bin/qmake.exe".
The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:3 (project):
The CMAKE_CXX_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the JOM generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
Configuring incomplete, errors occurred!
See also "C:/Users/tany/AppData/Local/Temp/QtCreator-pKrFgC/qtc-cmake-DqmsxZqd/CMakeFiles/CMakeOutput.log".
See also "C:/Users/tany/AppData/Local/Temp/QtCreator-pKrFgC/qtc-cmake-DqmsxZqd/CMakeFiles/CMakeError.log".
CMake Deprecation Warning:
The 'cmake-server(7)' is deprecated. Please port clients to use the
'cmake-file-api(7)' instead.
CMake Project parsing failed.
Now if I use the Cmake-GUI instead, I can configure and generate the project files successfully, after supplying the environment variable CMAKE_PREFIX_PATH.
But I can't get this to work from inside the QTcreator.
Anyone has any experience with using Cmake with QTcreator then please help.
Thank you!
The error message says that your C++ compiler Visual Studio 2015 (64 bits) could not be located. Maybe when you run cmake-gui it finds another C++ compiler like mingw?
In Qtcreator's settings dialog you have a tab showing the detected compilers, and another one with the available kits.
It seems that QtCreator is using a deprecated version of cmake. Update QtCreator to a new (unreleased, as writing this comment, version 4.10.0 is broken) or downgrade cmake to choco.exe install cmake --version 3.11 --force (a newer version might work).
Please also make sure to install jom (as this is the default for QtCreator/CMake on windows).
choco.exe install jom (how can I tell it to use make?)
The deprecation warning is harmless. CMake deprecated the cmake-server and provides a new API for the same purpose now. Qt Creator will support that from 4.11.
The error tells you, that CMake is unable find the cl compiler. cl.exe comes with Visual Studio. Make sure you mark C++ there during the installation process. It is not installed by default anymore.
Alternatively install the MinGW tool chain from the Qt installer. In Qt context it is easier to use than the Visual Studio tool chain.
I'm trying to build our application using Qt 5.13.0 installed via Conan/Artifactory. We run our own Artifactory server and the Qt version there is self-build (and statically linked) in our CI solution. We use the Conan recipe for Qt written by the bincrafters, slightly modified to apply some patches for known Qt bugs and set some flags for building properly on Android and WebAssembly.
When trying to build the application, the linker fails to find the necessary dependencies for Qt itself because it tries to look them up in the home folder of the user who build the Qt package, not the user who's running the build.
Here's an excerpt from the build log, showing the attempt at linking all previously compiled object files together:
application folder-------v subproject of the application----v-------v dependency of the application, correct user home dir---------v Qt library installed via Conan, correct user home dir-------v dependency of Qt, WRONG user home dir------------v
g++ -Wl,--gc-sections -o ../../fah [--> all the .o files <--] -L../lib -lmodel -lcore [--> more linked libraries and application parts <--] -L/home/kaupes/.conan/data/libsodium/1.0.18/bje/stable/package/d1efe3774eed76670888f919621e7c4e1b52efa9/lib /home/kaupes/.conan/data/qt/5.13.0/bje/stable/package/d6b3f512e1a5607061462f94e3271dc8af3dd516/lib/libQt5Gui.a /home/dev/.conan/data/harfbuzz/2.4.0/bje/stable/package/c68551ae35bf5d62e66263379d58a38416eb84a9/lib/libharfbuzz.a [--> many, many more libraries <--]
g++: error: /home/dev/.conan/data/harfbuzz/2.4.0/bje/stable/package/c68551ae35bf5d62e66263379d58a38416eb84a9/lib/libharfbuzz.a: No such file or directory
many, many more errors...
As you can see, the user running the build is kaupes, but the g++ invocation attempts to look for the dependencies in /home/dev/, the home folder of the CI user who build the Qt Conan package.
Only dependencies of Qt itself have the problem. Dependencies of the application (also installed via Conan) are found at the correct place.
The Qt package has been build in the CI using the following Conan invocation:
conan create --profile .conan/profiles/linux -s compiler=gcc -s compiler.version=9 . fah/stable
Compiler and version are explicitly set because I'm also build for another GCC version. The linux profile file also doesn't do anything interesting (as far as I can see):
include(default)
[settings]
build_type=Release
compiler.libcxx=libstdc++11
[options]
OpenSSL:shared=False
OpenSSL:no_asm=True
OpenSSL:no_asm=True
OpenSSL:no_weak_ssl_ciphers=True
OpenSSL:no_ssl2=True
OpenSSL:no_ssl3=True
OpenSSL:no_engine=True
libcurl:shared=False
libxml2:shared=False
libxml2:fPIC=True
libsodium:shared=False
pcre2:shared=False
libpng:shared=False
freetype:shared=False
bzip2:shared=False
libjpeg:shared=False
harfbuzz:shared=False
xkbcommon:shared=False
qt:shared=False
qt:with_glib=False
qt:with_sqlite3=False
qt:with_mysql=False
qt:with_pq=False
qt:with_odbc=False
qt:with_sdl2=False
qt:with_openal=False
qt:with_libalsa=False
qt:openssl=True
qt:commercial=False
qt:qtsvg=True
qt:qtdeclarative=True
qt:qtactiveqt=False
qt:qtscript=False
qt:qtmultimedia=False
qt:qttools=True
qt:qtxmlpatterns=False
qt:qttranslations=True
qt:qtdoc=False
qt:qtrepotools=False
qt:qtqa=False
qt:qtlocation=True
qt:qtsensors=True
qt:qtwayland=True
qt:qt3d=False
qt:qtimageformats=False
qt:qtgraphicaleffects=True
qt:qtquickcontrols=True
qt:qtserialbus=False
qt:qtserialport=False
qt:qtx11extras=True
qt:qtmacextras=False
qt:qtwinextras=False
qt:qtandroidextras=False
qt:qtwebsockets=True
qt:qtwebchannel=False
qt:qtwebengine=False
qt:qtwebview=False
qt:qtquickcontrols2=True
qt:qtpurchasing=False
qt:qtcharts=True
qt:qtdatavis3d=False
qt:qtvirtualkeyboard=True
qt:qtgamepad=False
qt:qtscxml=False
qt:qtspeech=False
qt:qtnetworkauth=False
qt:qtremoteobjects=False
qt:qtwebglplugin=False
qt:qtlottie=False
qt:qtconnectivity=True
Is there something I'm doing wrong during the Conan package creation or installation or is this caused by something different?
Indeed, when building qt, all paths to dependencies are hardcoded in configurations files (mkspecs\modules\qt_lib_*.pri).
I assume you are building your application with qmake, because you use static qt, and static qt is incompatible with cmake. One thing you could try is to pass the full path to harfbuzz lib to qmake by adding argument QMAKE_LIBS_HARFBUZZ=/home/kaupes/.conan/data/harfbuzz/2.4.0/bje/stable/package/c68551ae35bf5d62e66263379d58a38416eb84a9/lib/libharfbuzz.a to your qmake invocation.
Edit: it seems to be a knwonw behaviour of qt >= 5.12.1 : https://bugreports.qt.io/browse/QTBUG-72903. This feature has been reverted in 5.14.x and 5.15.x with https://github.com/qt/qtbase/commit/9864d2c6f3b628ca9f07a56b197e77bd43931cca
I am new to Qt, and I am facing the follwoing error. I have set all the environment variables. I don't know what the problem is. Kindly Help me.
11:44:39: Running build steps for project rabiaapp...
11:44:39: Configuration unchanged, skipping qmake step.
11:44:39: Starting: "C:\QtSDK\QtCreator\bin\jom.exe"
c:\QtSDK\Desktop\Qt\4.8.0\msvc2008\bin\uic.exe ..\rabiaapp\mainwindow.ui -o ui_mainwindow.h
C:\QtSDK\QtCreator\bin\jom.exe -f Makefile.Debug
Error: cannot open C:\Windows\main.obj.5540.16.jom for write
jom 1.0.8 - empower your cores
jom: C:\Users\rs01\rabiaapp-build-desktop-Qt_4_8_0_for_Desktop_-_MSVC2008__Qt_SDK__Debug\Makefile [debug] Error 1
11:44:39: The process "C:\QtSDK\QtCreator\bin\jom.exe" exited with code 2.
Error while building project rabiaapp (target: Desktop)
When executing build step 'Make'
I can reproduce this problem if I check "Clear system environment" on the Projects' Build Settings page. Try unchecking that box.
I encountered a similar problem. My TMP variable has Chinese characters, which makes qt creator produce error: cannot open ** for write.
Try to change your TMP variable with only English characters, no spaces. Ensure that the folder exists and you have permissions to access it.
My Qt version: Qt 5.4.0 for Windows 32-bit (VS 2013, OpenGL). You can set this in Qt Creator
Try using nmake instead of jom there should be a checkbox in Settings-> Build and Run -> uncheck use jom instead of nmake.