How to install Qt from the command line?
-
Hi,
I'm running Ubuntu 22.04, and I would like to install Qt6 but via the console and not the installer.I found this packages:
sudo apt-get install build-essential
sudo apt-get install qtcreator
sudo apt install qt6-base-devBut when i want to build my project I get following errors:
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt6/QtFeature.cmake:1212 (message): Feature rpath is already defined to be "ON" and should now be set to "OFF" when importing features from Qt6::Core. Call Stack (most recent call first): /usr/lib/x86_64-linux-gnu/cmake/Qt6Core/Qt6CoreConfig.cmake:128 (qt_make_features_available) /snap/clion/193/bin/cmake/linux/share/cmake-3.22/Modules/CMakeFindDependencyMacro.cmake:47 (find_package) /usr/lib/x86_64-linux-gnu/cmake/Qt6/QtPublicDependencyHelpers.cmake:14 (find_dependency) /usr/lib/x86_64-linux-gnu/cmake/Qt6Widgets/Qt6WidgetsDependencies.cmake:96 (_qt_internal_find_dependencies) /usr/lib/x86_64-linux-gnu/cmake/Qt6Widgets/Qt6WidgetsConfig.cmake:50 (include) /usr/lib/x86_64-linux-gnu/cmake/Qt6/Qt6Config.cmake:219 (find_package) src/CMakeLists.txt:5 (find_package) CMake Warning at /usr/lib/x86_64-linux-gnu/cmake/Qt6/Qt6Config.cmake:219 (find_package): Found package configuration file: /usr/lib/x86_64-linux-gnu/cmake/Qt6Widgets/Qt6WidgetsConfig.cmake but it set Qt6Widgets_FOUND to FALSE so package "Qt6Widgets" is considered to be NOT FOUND. Call Stack (most recent call first): src/CMakeLists.txt:5 (find_package) -- Configuring incomplete, errors occurred! See also "/home/edu/uni/psys22-projekt/cmake-build-debug/CMakeFiles/CMakeOutput.log". [Finished]
This is how my cmake file works:
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_PREFIX_PATH "/usr/lib/x86_64-linux-gnu/cmake") find_package(QT NAMES Qt6 REQUIRED COMPONENTS Widgets) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) find_package(Qt${QT_VERSION_MAJOR}Test REQUIRED) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) find_package(MPI REQUIRED) message(STATUS "Run: ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} EXECUTABLE ${MPIEXEC_POSTFLAGS} ARGS") add_executable(...my source files) target_link_libraries( target PUBLIC OpenMP::OpenMP_CXX Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Test MPI::MPI_CXX)
When I created the project I installed Qt via the GUI installer, and it worked fine, but that's not an option because I want to build my app via CI/CD on some alpine/ubuntu;