qt_gui_cpp compiler errors wrt QBasicAtomicInt

asked 2020-02-11 06:25:46 -0500

Nap gravatar image

[MacOS, Mojave 10.14.5, Xcode 10.2 & Clang 9 (homebrew), Qt5.14.1]

I'm following the kinetic Installation OSX Homebrew Source guide, which has some hick-ups. I'm fixing each problem as it comes along, and I'm up to the qt_gui_cpp package where I've encountered a problem which I'm not sure how to approach.

The compiler is telling me that there are significant errors in the Qt package, which I find hard to believe. I think there's something missing but I don't yet know what. The first error is telling me that that there is no member called loadRelaxed() in QBasicAtomicInt. Fair enough, but there is such a member in the QBasicAtomicInteger. This error appears to have something to do with C++ templating, which isn't a strong point for me yet.

Initially I thought this may have something to do with Shiboken's wrappers, but now that I have Shiboken2 working (never mind the odd looking path in the log below), my errors seem to occur for other reasons.

I've been able to build all the preceding packages, including OpenCV3 and python_qt_binding successfully.

Has anyone experienced this error before? Know how to fix it? (If any further info needed, let me know.) Thanks in advance.

loadRelaxed() error:

    [ 61%] Building CXX object src/qt_gui_cpp/CMakeFiles/qt_gui_cpp.dir/settings.cpp.o
    In file included from /Users/user/ros/ros_catkin_ws/src/qt_gui_core/qt_gui_cpp/src/qt_gui_cpp/recursive_plugin_provider.cpp:33:
    In file included from /Users/user/ros/ros_catkin_ws/src/qt_gui_core/qt_gui_cpp/include/qt_gui_cpp/recursive_plugin_provider.h:36:
    In file included from /Users/user/ros/ros_catkin_ws/src/qt_gui_core/qt_gui_cpp/include/qt_gui_cpp/composite_plugin_provider.h:36:
    In file included from /Users/user/ros/ros_catkin_ws/src/qt_gui_core/qt_gui_cpp/include/qt_gui_cpp/plugin_descriptor.h:36:
    In file included from /usr/local/Cellar/qt/5.14.1/lib/QtCore.framework/Headers/QMap:1:
    In file included from /usr/local/Cellar/qt/5.14.1/lib/QtCore.framework/Headers/qmap.h:45:
    /usr/local/Cellar/qt/5.14.1/lib/QtCore.framework/Headers/qrefcount.h:55:28: error: no member named 'loadRelaxed' in 'QBasicAtomicInt'
            int count = atomic.loadRelaxed();
                        ~~~~~~ ^

qt_gui_cpp package build log, including the lines shown above. There are a bunch of other fundamental errors in the log which lead me to believe I'm missing something.

    ==> Processing catkin package: 'qt_gui_cpp'
    ==> Creating build directory: 'build_isolated/qt_gui_cpp'
    ==> Building with env: '/Users/user/ros/ros_catkin_ws/install_isolated/env.sh'
    ==> cmake /Users/user/ros/ros_catkin_ws/src/qt_gui_core/qt_gui_cpp -DCATKIN_DEVEL_PREFIX=/Users/user/ros/ros_catkin_ws/devel_isolated/qt_gui_cpp -DCMAKE_INSTALL_PREFIX=/Users/user/ros/ros_catkin_ws/install_isolated -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE:FILEPATH=/usr/local/Cellar/python@2/2.7.17_1/Frameworks/Python.framework/Versions/2.7/bin/python -DPYTHON_PACKAGES_DIR:FILEPATH=/usr/local/lib/python2.7/site-packages -DCATKIN_ENABLE_TESTING=0 -G Unix Makefiles in '/Users/user/ros/ros_catkin_ws/build_isolated/qt_gui_cpp'
    -- The C compiler identification is AppleClang
    -- The CXX compiler identification is AppleClang
    -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain ...
edit retag flag offensive close merge delete


Unfortunately I cannot edit my OP, there is something in the CSS that prevents me from getting to the top of the post (which is off the screen), where, of course, I've explained the problem.

Nap gravatar image Nap  ( 2020-02-11 07:52:02 -0500 )edit

WRT 1st error, atomic is defined as a QBasicAtomicInt, which itself is defined as typedef QBasicAtomicInteger<Int>. QBasicAtomicInteger does have a loadRelaxed() method, so why can't the QBasicAtomicInteger functor be accessed? Should there be a static_cast<QBasicAtomicInteger<Int>> in front of the variable atomic?

Nap gravatar image Nap  ( 2020-02-11 07:56:33 -0500 )edit

It appears that I have two conflicting sets of Qt headers. I have Qt v4.8.7_6 installed (brew linked) into /usr/local/include, and Qt v5.14.1 (keg) installed into /usr/local/opt/qt (which points to (/usr/local/Cellar/qt/5.14.1/lib/QtCore.framework/Headers). I have been using the newer version obviously for this build.

I tried, by adjusting in the qt_gui_cpp package's CMakeLists.txt file, using: 1 set(CMAKE_IGNORE_PATH /usr/local/include) 2 set(LDFLAGS -L/usr/local/opt/qt/lib) and set(CPPFLAGS -I/usr/local/opt/qt/include) But neither have helped. (Even though the compiler error gives the correct path to the v5.14.1 header files, I think it's actually using the wrong version under the hood.)

Nap gravatar image Nap  ( 2020-02-11 09:40:02 -0500 )edit

The actual compiler command that is issued is below. Note that -I/usr/local/include precedes the Qt v5.14.1 include, thus the compiler only looks into the Qt v5.14.1 folder when it can't find it under /usr/local/include:

    cd /Users/user/ros/ros_catkin_ws/build_isolated/qt_gui_cpp/src/qt_gui_cpp && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
    -isystem /usr/local/Cellar/qt/5.14.1/lib/QtCore.framework/Headers
Nap gravatar image Nap  ( 2020-02-11 12:26:02 -0500 )edit

I tried using target_include_directories(${PROJECT_NAME} SYSTEM BEFORE PUBLIC ${qt_gui_cpp_INCLUDE_DIRECTORIES}) to prepend the includes, but as you can see above, they ended up after the -I/usr/local/include anyway.

Nap gravatar image Nap  ( 2020-02-11 12:27:30 -0500 )edit