Ask Your Question
0

Porting Qt packages from Kinetic to Melodic

asked 2019-04-15 08:49:00 -0600

LeonhardEuler337 gravatar image

updated 2019-04-15 08:52:02 -0600

When trying to compile in ROS Melodic packages created using catkin_create_qt_pkg in ROS Kinetic, catkin_make fails with the message:

-- Could NOT find qt_build (missing: qt_build_DIR)
-- Could not find the required component 'qt_build'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "qt_build" with any
  of the following names:

    qt_buildConfig.cmake
    qt_build-config.cmake

  Add the installation prefix of "qt_build" to CMAKE_PREFIX_PATH or set
  "qt_build_DIR" to a directory containing one of the above files.  If
  "qt_build" provides a separate development package or SDK, be sure it has
  been installed.

Apparently, qt_build is currently unavailable for Melodic.

Below is my CmakeLists file:

cmake_minimum_required(VERSION 2.8.0)
set (CMAKE_CXX_STANDARD 14)
set (CMAKE_BUILD_TYPE Debug)
project(visualization)

find_package(catkin REQUIRED COMPONENTS
        qt_build
        roscpp
        converters)
include_directories(include  ${catkin_INCLUDE_DIRS})


catkin_package()

include_directories(
        ../../devel/include
        ../../install/include
        )
##############################################################################
# Qt Environment
##############################################################################
rosbuild_prepare_qt4(QtCore QtGui) # Add the appropriate components to the component list here

##############################################################################
# Sections
##############################################################################
file(GLOB QT_FORMS_BLOCK RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ui/main_window_block.ui)
file(GLOB QT_RESOURCES_BLOCK RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} resources/resources.qrc)
file(GLOB_RECURSE QT_MOC_BLOCK RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS include/visualization/main_window_block.hpp)

QT4_ADD_RESOURCES(QT_RESOURCES_CPP_BLOCK ${QT_RESOURCES_BLOCK})
QT4_WRAP_UI(QT_FORMS_HPP_BLOCK ${QT_FORMS_BLOCK})
QT4_WRAP_CPP(QT_MOC_HPP_BLOCK ${QT_MOC_BLOCK})

##############################################################################
# Binaries
##############################################################################
add_executable(block src/main_block.cpp src/main_window_block.cpp ${QT_RESOURCES_CPP_BLOCK} ${QT_FORMS_HPP_BLOCK} ${QT_MOC_HPP_BLOCK})
add_dependencies(block converters_generate_messages)

target_link_libraries(block ${QT_LIBRARIES} ${catkin_LIBRARIES})
install(TARGETS block RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})

Are there any workaround options or should I wait with porting to Melodic until qt_build is available? Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-04-17 07:55:24 -0600

LeonhardEuler337 gravatar image

I have managed to find a workaround which doesn't use any catkin specific macros using the article here . The final modified version of CMakeLists file looks like this:

cmake_minimum_required(VERSION 2.8.0)
set (CMAKE_CXX_STANDARD 14)
project(visualization)

find_package(catkin REQUIRED COMPONENTS roscpp converters)
find_package(Qt4 REQUIRED COMPONENTS QtCore QtGui)

include(${QT_USE_FILE})
include_directories(include  ${catkin_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR)

catkin_package()

include_directories(
        ../../devel/include
        ../../install/include
        )
##############################################################################
# Sections
##############################################################################
file(GLOB QT_FORMS_BLOCK RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ui/main_window_block.ui)
file(GLOB QT_RESOURCES_BLOCK RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} resources/resources.qrc)
file(GLOB_RECURSE QT_MOC_BLOCK RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} FOLLOW_SYMLINKS include/visualization/main_window_block.hpp)

QT4_ADD_RESOURCES(QT_RESOURCES_CPP_BLOCK ${QT_RESOURCES_BLOCK})
QT4_WRAP_UI(QT_FORMS_HPP_BLOCK ${QT_FORMS_BLOCK})
QT4_WRAP_CPP(QT_MOC_HPP_BLOCK ${QT_MOC_BLOCK})

##############################################################################
# Binaries
##############################################################################
add_executable(block src/main_block.cpp src/main_window_block.cpp ${QT_RESOURCES_CPP_BLOCK} ${QT_FORMS_HPP_BLOCK} ${QT_MOC_HPP_BLOCK})
add_dependencies(block converters_generate_messages)

target_link_libraries(block ${QT_LIBRARIES} ${catkin_LIBRARIES})
install(TARGETS block RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-04-15 08:49:00 -0600

Seen: 503 times

Last updated: Apr 17