Description
[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
.
However, 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>>
of atomic
in the header file Headers/qrefcount.h (Line55)
?
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.
The build is flagging other errors in the Qt 5.14.1 header files, such as QObject
being an incomplete type, undeclared udentifier d_ptr
, no template named List
did you mean QList
, and others?
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)
3 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 below, they ended up after the -I/usr/local/include
anyway.
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.)
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
.
So, the question now is, how can I remove `/usr/local/include/?
[ 22%] Building CXX object src/qt_gui_cpp/CMakeFiles/qt_gui_cpp.dir/composite_plugin_provider.cpp.o
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++
-DQT_CORE_LIB
-DQT_GUI_LIB
-DQT_NO_DEBUG
-DQT_WIDGETS_LIB
-DROS_BUILD_SHARED_LIBS=1
-DROS_PACKAGE_NAME=\"qt_gui_cpp\"
-Dqt_gui_cpp_EXPORTS
-I/Users/user/ros/ros_catkin_ws/src/qt_gui_core/qt_gui_cpp/include
-I/Users/user/ros/ros_catkin_ws/install_isolated/include
-I/usr/local/include
-I/Users/user/ros/ros_catkin_ws/src/qt_gui_core/qt_gui_cpp/src/qt_gui_cpp/qt_gui_cpp
-isystem /usr/local/Cellar/qt/5.14.1/lib/QtCore.framework/Headers
-isystem /usr/local/Cellar/python@2/2.7.17_1/Frameworks/Python.framework/Versions/2.7/include/python2.7
-isystem /Users/user/ros/ros_catkin_ws/src/qt_gui_core/qt_gui_cpp/include/qt_gui_cpp
-isystem /Users/user/ros/ros_catkin_ws/src/qt_gui_core/qt_gui_cpp/src/qt_gui_cpp
-iframework /usr/local/Cellar/qt/5.14.1/lib
-isystem /usr/local/Cellar/qt/5.14.1/lib/QtWidgets.framework/Headers
-isystem /usr/local/Cellar/qt/5.14.1/lib/QtGui.framework/Headers
-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/OpenGL.framework/Headers
-isystem /usr/local/Cellar/qt/5.14.1/./mkspecs/macx-clang
-I/usr/local/opt/qt/include
-L/usr/local/opt/qt/lib
-fPIC
-O3
-DNDEBUG
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
-fPIC
-fPIC
-std=gnu++11
-o CMakeFiles/qt_gui_cpp.dir/composite_plugin_provider.cpp.o
-c /Users/user/ros/ros_catkin_ws/src/qt_gui_core/qt_gui_cpp/src/qt_gui_cpp/composite_plugin_provider.cpp
(If any further info needed, let me know.)
Thanks in advance.
(I've been able to build all the preceding packages, including OpenCV3 and python_qt_binding successfully.)
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();
~~~~~~ ^