ros2 / rviz

ROS 3D Robot Visualizer
BSD 3-Clause Clear License
302 stars 213 forks source link

rviz_rendering build fails on MacOS jazzy (Qt issue) #1277

Open scott-robotics opened 1 month ago

scott-robotics commented 1 month ago

Bug report

Required Info:

Steps to reproduce issue

Follow the instructions for iron or jazzy

colcon build --merge-install --symlink-install --packages-up-to rviz_rendering

Expected behavior

Build succeeded

Actual behavior

Build failed

In file included from /Users/scottrobotics/Code/workspaces/ros2_jazzy/build/rviz_rendering/include/rviz_rendering/moc_render_window.cpp:10:
In file included from /Users/scottrobotics/Code/workspaces/ros2_jazzy/build/rviz_rendering/include/rviz_rendering/../../../../src/ros2/rviz/rviz_rendering/include/rviz_rendering/render_window.hpp:36:
In file included from /opt/homebrew/opt/qt@5/lib/QtCore.framework/Headers/QObject:1:
/opt/homebrew/opt/qt@5/lib/QtCore.framework/Headers/qobject.h:266:43: error: no template named 'QSlotObject' in namespace 'QtPrivate'
                           new QtPrivate::QSlotObject<Func2, typename QtPrivate::List_Left<typename SignalType::Arguments, SlotType::ArgumentCount>::Value,
                               ~~~~~~~~~~~^

Additional information

I can paste the full error log if useful. I'm also willing to help resolve this, just need to know where to poke

Yadunund commented 1 month ago

I cannot reproduce the issue on MacOS 14.6.1 (M1). But I also build with some additional flags so maybe you can try the same

colcon build  --packages-skip-by-dep python_qt_binding --cmake-args -DBUILD_TESTING=OFF -DINSTALL_EXAMPLES=ON -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_PREFIX_PATH=$(brew --prefix):$(brew --prefix qt@5):$(brew --prefix boost@1.76)  -DBUILD_TYPE=RelWithDebInfo -DFORCE_BUILD_VENDOR_PKG=ON

I also have these in my ~/.profile

export PATH="/opt/homebrew/opt/qt@5/bin:$(brew --prefix python)/libexec/bin:$(brew --prefix)/lib/python3.11/site-packages:$PATH"
export Qt5_DIR=$(brew --prefix qt@5)/lib/cmake
shenlebantongying commented 2 weeks ago

I encountered the same error, and the reason appears to be some Qt headers from Qt installed from homebrew and Qt installed from the installer are conflicting.

I simply force uninstall the homebrew version and the problem is gone.

PS: I am an insanely random person from the internet. No idea what's this project, but Google bring me here.