summaryrefslogtreecommitdiff
path: root/aruco-markers.spec
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2026-10-12 11:12:46 +0000
committerCoprDistGit <infra@openeuler.org>2026-10-12 11:12:46 +0000
commitf9c38eeb98f4b3ae4c1ee6fbeb95c3634b3d4503 (patch)
tree9b92e066d7884ea0f4d7c8054b6d2d24ba194e1b /aruco-markers.spec
parent6269525eb31254e54723b43516f0abb95a6a6205 (diff)
automatic import of ros-humble-aruco-markers
Diffstat (limited to 'aruco-markers.spec')
-rw-r--r--aruco-markers.spec23
1 files changed, 22 insertions, 1 deletions
diff --git a/aruco-markers.spec b/aruco-markers.spec
index 5112c7a..beccb4b 100644
--- a/aruco-markers.spec
+++ b/aruco-markers.spec
@@ -4,7 +4,7 @@
Name: ros-%{ros_distro}-%{RosPkgName}
Version: 0.0.3
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: A ros2 node for detecting aruco markers in camera images
License: MIT
URL: https://github.com/namo-robotics/aruco_markers/tree/humble
@@ -49,6 +49,11 @@ A ros2 node for detecting aruco markers in camera images
%autosetup -n %{RosPkgName}-%{src_version}
# openEuler opencv 4.5.2 lacks the aruco contrib module; bundle from opencv_contrib 4.5.2
sed -i 's/find_package(OpenCV REQUIRED COMPONENTS core imgproc aruco)/find_package(OpenCV REQUIRED COMPONENTS core imgproc)/' aruco_markers/CMakeLists.txt
+# Replace catch-all <opencv2/opencv.hpp> with specific includes to prevent
+# system OpenCV 4.8+ objdetect aruco headers (new API) from being pulled in
+# and conflicting with bundled 4.5.x aruco (old API). Code only uses core,
+# imgproc (line/putText/FONT_HERSHEY_SIMPLEX) and calib3d (Rodrigues/projectPoints).
+sed -i 's|#include <opencv2/opencv.hpp>|#include <opencv2/core.hpp>\n#include <opencv2/imgproc.hpp>\n#include <opencv2/calib3d.hpp>|' aruco_markers/include/aruco_markers/aruco_markers.hpp
%build
[ -f /opt/ros/%{ros_distro}/setup.sh ] && source /opt/ros/%{ros_distro}/setup.sh || true
@@ -78,6 +83,18 @@ rm -f *.o
cp "$ARUCO_DIR/include/opencv2/aruco.hpp" "$ARUCO_INC/opencv2/"
cp "$ARUCO_DIR/include/opencv2/aruco/"*.hpp "$ARUCO_INC/opencv2/aruco/"
+# Mask system OpenCV 4.8+ objdetect aruco headers (new API) to prevent
+# conflict with bundled 4.5.x aruco (old API). opencv2/opencv.hpp (included
+# transitively by cv_bridge etc.) pulls in objdetect/aruco_detector.hpp etc.
+# which define cv::aruco::* types with new API that clash with bundled old API.
+# Emptying them lets bundled aruco.hpp be the sole definition source.
+for f in /usr/include/opencv4/opencv2/objdetect/aruco_detector.hpp \
+ /usr/include/opencv4/opencv2/objdetect/aruco_dictionary.hpp \
+ /usr/include/opencv4/opencv2/objdetect/aruco_board.hpp \
+ /usr/include/opencv4/opencv2/objdetect/charuco_detector.hpp; do
+ [ -f "$f" ] && cp "$f" "$f.bak" && echo "// masked: using bundled aruco 4.5.x" > "$f" || true
+done
+
# Patch CMakeLists.txt to use bundled aruco headers and static library
# BEFORE keyword ensures bundled include path takes precedence over system OpenCV
export ARUCO_INC ARUCO_DIR ARUCO_BUILD
@@ -126,6 +143,10 @@ make install DESTDIR=%{buildroot}
/opt/ros/%{ros_distro}
%changelog
+* Mon Oct 12 2026 ai-importer <ai-importer@openeuler.org> - 0.0.3-4
+- Replace catch-all <opencv2/opencv.hpp> with specific includes (core/imgproc/calib3d)
+- Mask system objdetect/aruco_*.hpp headers to prevent new/old API conflict
+
* Mon Oct 12 2026 ai-importer <ai-importer@openeuler.org> - 0.0.3-3
- Fix include path ordering: bundled aruco headers before system OpenCV
- Skip charuco.cpp compilation (project does not use CharucoBoard)