1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
|
%define ros_distro humble
%define RosPkgName mrpt-libmaps
%define src_version 2.15.20
%define mrpt_version 2.15.21
# mrpt 的 git submodule 内容(GitHub archive tarball 不含),按需手工补:
%define nanoflann_version 1.5.5
%define simpleini_version 4.22
Name: ros-%{ros_distro}-%{RosPkgName}
Version: 2.15.20
Release: 3%{?dist}
Summary: Mobile Robot Programming Toolkit (MRPT) libraries (maps C++ libraries)
License: BSD
URL: https://github.com/MRPT/mrpt_ros.git
Source0: %{RosPkgName}-%{src_version}.tar.gz
# mrpt upstream source, pre-fetched to avoid ExternalProject git clone at build time
Source1: https://github.com/MRPT/mrpt/archive/refs/tags/%{mrpt_version}.tar.gz#/mrpt-%{mrpt_version}.tar.gz
# mrpt 的两个 submodule(COPR chroot 无外网,构建期无法下载/克隆,须随 SRPM 携带):
# nanoflann —— mrpt 强制依赖(script_nanoflann.cmake: FATAL_ERROR if not found),
# openEuler 官方源无系统包,只能喂 3rdparty/nanoflann 让内层自建
# simpleini —— mrpt-config 编译 CConfigFile.cpp 需要 SimpleIni.h
Source2: https://github.com/jlblancoc/nanoflann/archive/refs/tags/v%{nanoflann_version}.tar.gz#/nanoflann-%{nanoflann_version}.tar.gz
Source3: https://github.com/brofield/simpleini/archive/refs/tags/v%{simpleini_version}.tar.gz#/simpleini-%{simpleini_version}.tar.gz
%global debug_package %{nil}
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
%global __provides_exclude_from ^/opt/ros/%{ros_distro}/.*$
%global __requires_exclude_from ^/opt/ros/%{ros_distro}/.*$
# 本包内层只构建 mrpt-maps 与 mrpt-graphs。按上游 libs/maps/CMakeLists.txt 与
# libs/graphs/CMakeLists.txt 的 define_mrpt_lib 声明:
# mrpt-maps 依赖 mrpt-obs + mrpt-graphs
# mrpt-graphs 依赖 mrpt-opengl
# 而 mrpt-obs 又依赖 mrpt-opengl + mrpt-tfest。这些兄弟库在本包内层均为
# BUILD_mrpt-*=OFF,靠 DeclareMRPTLib.cmake 的 find_package(mrpt-XXX) 分支复用
# 已安装的兄弟库,故 BuildRequires 须列全提供方:
# mrpt-obs ← ros-humble-mrpt-libobs
# mrpt-opengl / mrpt-img ← ros-humble-mrpt-libopengl
# mrpt-tfest / mrpt-poses / mrpt-bayes ← ros-humble-mrpt-libposes
# mrpt-math ← ros-humble-mrpt-libmath
# mrpt-core/-io/-config/-random/-rtti/-serialization/-system
# /-expr/-containers/-typemeta 等 ← ros-humble-mrpt-libbase
BuildRequires: ros-%{ros_distro}-mrpt-libbase
BuildRequires: ros-%{ros_distro}-mrpt-libmath
BuildRequires: ros-%{ros_distro}-mrpt-libobs
BuildRequires: ros-%{ros_distro}-mrpt-libopengl
BuildRequires: ros-%{ros_distro}-mrpt-libposes
BuildRequires: assimp-devel
BuildRequires: eigen3-devel
BuildRequires: ffmpeg-devel
# openEuler 的 freeglut 只有运行库,头文件/so 链接在 -devel;找不到系统 GLUT 时
# mrpt 会去编内置 freeglut(3rdparty/freeglut 为空目录),因
# -Werror=implicit-function-declaration 失败
BuildRequires: freeglut-devel
BuildRequires: git
BuildRequires: gtest-devel
BuildRequires: libXrandr-devel
# 上游 package.xml 写的是 Debian 名 libxxf86vm(apt 的 libxxf86vm-dev),
# RPM 名是 libXxf86vm-devel(dnf repoquery --whatprovides 已实证)
BuildRequires: libXxf86vm-devel
BuildRequires: libglvnd-devel
# 上游 package.xml 写的是 Debian 名 libjpeg,RPM 名 libjpeg-devel
# (由 openEuler 的 libjpeg-turbo-devel 提供)
BuildRequires: libjpeg-devel
BuildRequires: libpcap-devel
BuildRequires: libudev-devel
BuildRequires: libusbx-devel
BuildRequires: libzstd-devel
BuildRequires: mesa-libGL-devel
BuildRequires: mesa-libGLU-devel
BuildRequires: opencv
# octomap 是 mrpt-maps 的**硬依赖**,不是可选特性(build 112594 实测证伪了
# "关掉 MRPT_BUILD_OCTOMAP 就安全"的旧判断):libs/maps/CMakeLists.txt 用
# glob("libs/maps/src/maps/*.cpp") 无条件收集 CColouredOctoMap.cpp / COctoMap.cpp,
# 这些源文件顶部无条件 #include <octomap/ColorOcTree.h>;mrpt 的
# CMAKE_MRPT_HAS_OCTOMAP 只决定 include 目录与 target_link_libraries,不参与
# 源文件筛选(DeclareMRPTLib.cmake 只按 *_WIN.cpp/_LIN.cpp/_unittest.cpp 过滤)。
# 于是 -DMRPT_BUILD_OCTOMAP=OFF 只会让 HAS_OCTOMAP=0、不加 octomap 的 -I,
# 源文件照样被编译 → fatal error: octomap/ColorOcTree.h。
# openEuler 官方源有 octomap-devel 1.9.8(aarch64 同样可用),提供
# /usr/include/octomap/ColorOcTree.h 与 /usr/lib64/octomap/octomap-config.cmake
# (dnf repoquery --whatprovides '*/octomap/ColorOcTree.h' 实证,rc=0)。
BuildRequires: octomap-devel
BuildRequires: pkgconfig
BuildRequires: pybind11-devel
BuildRequires: suitesparse-devel
BuildRequires: tbb-devel
BuildRequires: tinyxml2-devel
BuildRequires: zlib-devel
BuildRequires: cmake
BuildRequires: python3-pip
Requires: ros-%{ros_distro}-ros-workspace
Requires: ros-%{ros_distro}-mrpt-libbase
Requires: ros-%{ros_distro}-mrpt-libmath
Requires: ros-%{ros_distro}-mrpt-libobs
Requires: ros-%{ros_distro}-mrpt-libopengl
Requires: ros-%{ros_distro}-mrpt-libposes
Requires: eigen3-devel
# libmrpt-maps.so 链接 liboctomap.so/liboctomath.so;/opt/ros 下 .so 的自动
# Requires 被上面的 __requires_exclude_from 排除,须手工声明运行库
Requires: octomap
Provides: %{name}-devel = %{version}-%{release}
Provides: %{name}-doc = %{version}-%{release}
Provides: %{name}-runtime = %{version}-%{release}
%description
Mobile Robot Programming Toolkit (MRPT) libraries (maps C++ libraries).
This package contains: mrpt-maps, mrpt-graphs
%prep
%autosetup -n %{RosPkgName}-%{src_version}
# --- 复用预置 mrpt 源码,避免 ExternalProject 在构建期 git clone -------------
# mrpt_libmaps/CMakeLists.txt 用 ExternalProject_Add(mrpt ...) 拉取上游 mrpt,
# 本地复用路径写成 ${CMAKE_BINARY_DIR}/../mrpt_libbase/mrpt-build/...,那是 ROS
# 官方 buildfarm 的目录布局(build 目录 = <ws>/build/mrpt_libmaps,故其 .. 即
# <ws>/build)。本 spec 的 CMAKE_BINARY_DIR = <top>/mrpt_libmaps/.obj,同一表达式
# 会多出一层 mrpt_libmaps(<top>/mrpt_libmaps/mrpt_libbase/mrpt-build),EXISTS
# 检查必然失败而退回 git clone;COPR chroot 无外网,clone 100% 失败。
# 统一改写成相对 CMakeLists.txt 自身目录的 ../mrpt-build,与下面预置的
# <top>/mrpt-build 对齐(EXISTS 检查 / SOURCE_DIR 两处)。
sed -i 's|\${CMAKE_BINARY_DIR}/\.\./mrpt_libbase/mrpt-build|${CMAKE_CURRENT_LIST_DIR}/../mrpt-build|g' \
mrpt_libmaps/CMakeLists.txt
# 去掉 HOME==/home/buildfarm 守卫:该条件只对 buildfarm 屏蔽本地复用,去掉后
# 复用分支在任何构建环境都成立。本仓库 mrpt_libmaps 的条件与 mrpt_libbase /
# mrpt_libobs / mrpt_libopengl / mrpt_libposes / mrpt_libmath 一致,是裸
# "AND NOT ..."(不加括号),模式须与之逐字对应。
sed -i 's/ AND NOT "\$ENV{HOME}" STREQUAL "\/home\/buildfarm"//' \
mrpt_libmaps/CMakeLists.txt
# 给内层 mrpt 追加开关(外层 cmake 命令行传的 MRPT_WITH_xxx 落在 ROS 包装工程上,
# 而包装工程只把它们原样忽略——真正生效的是写死在 ExternalProject_Add 里的
# CMAKE_ARGS,必须在此注入):
# MRPT_HAS_LIBFYAML=OFF openEuler 无 libfyaml,内置分支要 3rdparty/libfyaml
# (submodule 空目录)且会 file(READ .tarball-version) 报错
# MRPT_WITH_KINECT=OFF 本包 BuildRequires 了 libusbx-devel,libusb 存在时
# script_kinect.cmake 默认开启 Kinect,会去编译空的
# 3rdparty/libfreenect(openEuler 无 libfreenect-devel)
# MRPT_HAS_OPENNI2=OFF 无 libopenni2;script_openni2.cmake 在开启却找不到
# 时是 FATAL_ERROR(不是静默关闭),必须显式关
# OCTOMAP_DIR 指向系统 octomap 的 CMake config 目录,让
# script_octomap.cmake 的 find_package(OCTOMAP QUIET)
# 命中 openEuler 的 octomap-devel(走"系统库"分支:
# HAS_OCTOMAP=1 + OCTOMAP_INCLUDE_DIRS=/usr/include +
# OCTOMAP_LIBRARIES=/usr/lib64/liboctomap.so);
# 命中后 `if (NOT OCTOMAP_FOUND)` 整段不执行,也就不会
# 退回 ExternalProject 去 GitHub 下 octomap(chroot 无外网)。
# 注意不能改成 -DMRPT_BUILD_OCTOMAP=OFF:该变量只在
# "没找到系统 octomap"时才有意义,关掉它并不能让
# CColouredOctoMap.cpp 不被编译(见 BuildRequires 处说明)。
# CMAKE_PREFIX_PATH 内层 mrpt 对 BUILD_mrpt-*=OFF 的兄弟库走
# DeclareMRPTLib.cmake 的 find_package(mrpt-XXX) 分支,
# 必须能搜到 mrpt-libbase / -libmath / -libobs /
# -libopengl / -libposes 装到 /opt/ros/<distro> 的
# mrpt-*-config.cmake;缺了它会打出 "*Warning* ==> Disabling
# compilation of lib mrpt-maps for missing dependencies"
# 而静默产出空包
# GLFW / wx / openni2 / freenect 等特性在上游 package.xml 里本就自注为 "not
# actually required by this ROS package, but we need them for the mrpt/config.h
# to reflect we have such feature"(openEuler 无 provider),故不写 BuildRequires,
# 改由此处内层开关关闭(glfw 仅 3rdparty/nanogui 使用,包装工程自带
# -DMRPT_BUILD_nanogui=OFF;wx 仅 mrpt-gui 使用,包装工程自带
# -DBUILD_mrpt-gui=OFF 与 -DMRPT_BUILD_wxThings=OFF);libxxf86vm / libjpeg 是
# Debian 名,已在上面改成 libXxf86vm-devel / libjpeg-devel。
sed -i 's|^\(\s*-DDISABLE_JSONCPP=ON\)$|\1\n -DMRPT_HAS_LIBFYAML=OFF\n -DMRPT_WITH_KINECT=OFF\n -DMRPT_HAS_OPENNI2=OFF\n -DOCTOMAP_DIR=%{_libdir}/octomap\n -DCMAKE_PREFIX_PATH=/opt/ros/%{ros_distro}|' \
mrpt_libmaps/CMakeLists.txt
# 闸门:确认上面三处 sed 真的改到了 CMakeLists.txt(模式不匹配时 sed 是静默空
# 操作,要到构建期才以 git clone 超时 / 空包暴露)
if ! grep -q 'CMAKE_CURRENT_LIST_DIR}/../mrpt-build' mrpt_libmaps/CMakeLists.txt; then
echo "ERROR: CMakeLists.txt 本地复用路径改写失败(sed 模式不匹配)" >&2
exit 1
fi
if ! grep -q 'MRPT_HAS_OPENNI2=OFF' mrpt_libmaps/CMakeLists.txt; then
echo "ERROR: 内层 CMAKE_ARGS 开关注入失败(sed 锚点 -DDISABLE_JSONCPP=ON 不匹配)" >&2
exit 1
fi
if ! grep -q 'OCTOMAP_DIR=%{_libdir}/octomap' mrpt_libmaps/CMakeLists.txt; then
echo "ERROR: 内层 CMAKE_ARGS 的 OCTOMAP_DIR 注入失败(sed 锚点不匹配)" >&2
exit 1
fi
if grep -q 'buildfarm' mrpt_libmaps/CMakeLists.txt; then
echo "ERROR: buildfarm HOME 守卫未移除(sed 模式不匹配)" >&2
exit 1
fi
# 预置 ExternalProject 的 SOURCE_DIR:<top>/mrpt-build/src/mrpt
mkdir -p mrpt-build/src
tar -xzf %{SOURCE1} -C mrpt-build/src
mv mrpt-build/src/mrpt-%{mrpt_version} mrpt-build/src/mrpt
# GitHub archive tarball 不含 git submodule 内容,而上游 mrpt 顶层 CMakeLists.txt
# 有无条件存在性检查(3rdparty/nanogui/include、3rdparty/rplidar_sdk/sdk/src),
# 缺失即 FATAL_ERROR "git submodules missing!"。补空目录绕过;这两个子项目在内层
# CMAKE_ARGS 里已分别用 -DMRPT_BUILD_nanogui=OFF / -DMRPT_BUILD_rplidar_sdk=OFF
# 关闭,不会被真正编译。
mkdir -p mrpt-build/src/mrpt/3rdparty/nanogui/include \
mrpt-build/src/mrpt/3rdparty/rplidar_sdk/sdk/src
# 填充 mrpt 的两个必需 submodule(见 Source2/Source3 说明)。
rm -rf mrpt-build/src/mrpt/3rdparty/nanoflann mrpt-build/src/mrpt/3rdparty/simpleini
mkdir -p mrpt-build/src/mrpt/3rdparty/nanoflann mrpt-build/src/mrpt/3rdparty/simpleini
tar -xzf %{SOURCE2} -C mrpt-build/src/mrpt/3rdparty/nanoflann --strip-components=1
tar -xzf %{SOURCE3} -C mrpt-build/src/mrpt/3rdparty/simpleini --strip-components=1
# 覆盖包装工程从 package.xml 读到的版本号,与预取的上游源码一致
echo 'set(MRPT_VERSION_TO_DOWNLOAD "%{mrpt_version}")' > override_mrpt_version.cmake
%build
[ -f /opt/ros/%{ros_distro}/setup.sh ] && source /opt/ros/%{ros_distro}/setup.sh || true
export PYTHONPATH=/opt/ros/%{ros_distro}/lib/python%{python3_version}/site-packages${PYTHONPATH:+:$PYTHONPATH}
export PKG_CONFIG_PATH=/opt/ros/%{ros_distro}/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}
# 闸门:octomap 头是 mrpt-maps 的硬需求(CColouredOctoMap.cpp / COctoMap.cpp 无条件
# include)。BuildRequires 未生效时,真正的报错发生在内层编译到 18% 处
# (build 112594: fatal error: octomap/ColorOcTree.h),白烧一轮 COPR 构建;
# 这里提前失败并点明原因。
if [ ! -f %{_includedir}/octomap/ColorOcTree.h ]; then
echo "ERROR: 系统 octomap 头缺失(%{_includedir}/octomap/ColorOcTree.h)——BuildRequires: octomap-devel 未生效" >&2
exit 1
fi
cd mrpt_libmaps
mkdir -p .obj && cd .obj
%cmake3 \
-DCMAKE_INSTALL_PREFIX="/opt/ros/%{ros_distro}" \
-DAMENT_PREFIX_PATH="/opt/ros/%{ros_distro}" \
-DCMAKE_PREFIX_PATH="/opt/ros/%{ros_distro}" \
-UINCLUDE_INSTALL_DIR -ULIB_INSTALL_DIR -USYSCONF_INSTALL_DIR -USHARE_INSTALL_PREFIX -ULIB_SUFFIX \
-DSETUPTOOLS_DEB_LAYOUT=OFF \
-DBUILD_TESTING=OFF -DTESTING=OFF -DCMAKE_SUPPRESS_REGENERATION=ON \
..
# 闸门:cmake 生成 mrpt-gitclone.cmake 即表示未复用准备段预置的 mrpt 源码,
# 构建期将 git clone(COPR chroot 无外网,必然失败)。这里提前失败并给出明确
# 原因,避免又白烧一轮 COPR 构建。
if [ -e mrpt-build/tmp/mrpt-gitclone.cmake ]; then
echo "ERROR: cmake 准备 git clone mrpt —— %prep 预置源码未被复用,请检查预置路径" >&2
exit 1
fi
# --- 并行度与内存 -----------------------------------------------------------
# mrpt-maps / mrpt-graphs 大量使用 mrpt-math 的定长矩阵模板(CPose3D、
# CSerializable、CObservation* 等公共头),单进程峰值内存可达 GB 级;COPR
# builder 仅 4 核 / 6.9GiB / 无 swap,多路 cc1plus 叠峰会被 OOM killer SIGKILL
# (同链 mrpt-libmath 在 build 112579 实测:c++ fatal error: Killed signal
# terminated program cc1plus)。
# (1) 降单进程内存:CMake 用环境变量 CXXFLAGS/CFLAGS 初始化 CMAKE_<LANG>_FLAGS,
# 故在 make 之前覆盖为 -O1 -g0:本包 debug_package 已置空,-g 只烧内存
# 不出产物;并保留下游 hardening 项。
# (2) 限并行:按"每个 cc1plus 预留 2.5GiB"从 MemTotal 反推 job 数,取
# min(nproc, 内存上限)、至少 1 路。
# ★ 本段注释里禁止出现百分号前缀的宏指令字样(global / define / undefine):
# rpm 的 scriptlet 解析器会把注释行里的这类文本当宏定义提取,定义之后同一行
# 的残留文本会被丢出来当命令执行(同链 mrpt-libmath 的 build 112584 实踩:
# line 105: command not found → Bad exit status,而编译本身已 100% 通过)。
export CFLAGS="-O1 -g0 -fstack-protector-strong -Wp,-D_FORTIFY_SOURCE=2 -fasynchronous-unwind-tables"
export CXXFLAGS="-O1 -g0 -fstack-protector-strong -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fasynchronous-unwind-tables"
JOBS="$(nproc 2>/dev/null || echo 1)"
MEM_KB="$(awk '/^MemTotal:/{print $2; exit}' /proc/meminfo 2>/dev/null)"
case "$MEM_KB" in
''|*[!0-9]*) MEM_KB=0 ;;
esac
if [ "$MEM_KB" -gt 0 ]; then
MEM_JOBS=$(( MEM_KB / 2621440 ))
if [ "$MEM_JOBS" -lt 1 ]; then MEM_JOBS=1; fi
if [ "$JOBS" -gt "$MEM_JOBS" ]; then JOBS="$MEM_JOBS"; fi
fi
echo "mrpt-maps 构建并行度: -j${JOBS}(nproc=$(nproc 2>/dev/null || echo '?'), MemTotal=${MEM_KB}KiB)"
make -j"$JOBS"
# 闸门:确认真的产出了 libmrpt-maps.so 与 libmrpt-graphs.so。内层若没搜到
# mrpt-obs / mrpt-opengl(CMAKE_PREFIX_PATH 失效 / 兄弟库缺失),
# DeclareMRPTLib.cmake 只会打一行 Warning 就静默禁用该库,构建"成功"但装出的
# 是空包——这里把它变成构建期硬失败。
for _lib in maps graphs; do
_so="$(find mrpt-build/src/mrpt-build -name "libmrpt-${_lib}.so*" -print -quit 2>/dev/null)"
if [ -z "$_so" ]; then
echo "ERROR: 未产出 libmrpt-${_lib}.so —— 内层 mrpt 很可能因 find_package(mrpt-obs/mrpt-opengl) 未命中而静默禁用了 mrpt-${_lib}(空包)" >&2
exit 1
fi
echo "已产出: $_so"
done
%install
[ -f /opt/ros/%{ros_distro}/setup.sh ] && source /opt/ros/%{ros_distro}/setup.sh || true
export PYTHONPATH=/opt/ros/%{ros_distro}/lib/python%{python3_version}/site-packages${PYTHONPATH:+:$PYTHONPATH}
export PKG_CONFIG_PATH=/opt/ros/%{ros_distro}/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}
cd mrpt_libmaps
cd .obj
make install DESTDIR=%{buildroot}
%files
/opt/ros/%{ros_distro}
%changelog
* Tue Sep 22 2026 ai-importer <ai-importer@openeuler.org> - 2.15.20-3
- 修复 build 112594 的 %build 失败(COPR 日志实锤):
`/builddir/.../libs/maps/src/maps/CColouredOctoMap.cpp:21:10: fatal error:
octomap/ColorOcTree.h: No such file or directory`。
根因是 Release 2 的判断错误——当时认为 `-DMRPT_BUILD_OCTOMAP=OFF` 能把
COctoMap* 代码路径整体关掉,实测不成立。读上游源码(mrpt-2.15.21)确认:
* `cmakemodules/DeclareMRPTLib.cmake` 对 `libs/maps/src/*.cpp` 与
`libs/maps/src/maps/*.cpp` 只做 glob + 仅过滤 `*_WIN.cpp` /
`*_LIN.cpp` / `*_unittest.cpp`,**没有**任何 "#if MRPT_HAS_xxx 源文件筛选"
机制;`libs/maps/CMakeLists.txt` 里 `if (CMAKE_MRPT_HAS_OCTOMAP)` 只包住
`link_directories` / `target_link_libraries` / `add_dependencies(EP_octomap)`。
* `CColouredOctoMap.cpp`、`COctoMap.cpp` 顶部无条件
`#include <octomap/ColorOcTree.h>`,没有宏守护。
* `script_octomap.cmake` 里 `MRPT_BUILD_OCTOMAP` 只出现在
`if (NOT OCTOMAP_FOUND)` 分支内,是"找不到系统 octomap 时退化为构建内置版"
的开关;置 OFF 只会让 `CMAKE_MRPT_HAS_OCTOMAP=0`、不加 octomap 的 -I,
源文件依旧被编译 → 头找不到。
即 octomap 对 mrpt-maps 是**硬依赖**,不能靠关开关绕开。修法改走"提供系统
octomap":
* `BuildRequires: octomap-devel` + `Requires: octomap`。经
`dnf repoquery --whatprovides '*/octomap/ColorOcTree.h'` 实证 openEuler
官方源有 octomap-devel-1.9.8-2.oe2403sp4(aarch64 同样可用,rc=0),提供
/usr/include/octomap/ColorOcTree.h 与
/usr/lib64/octomap/octomap{-config,-targets,-config-version}.cmake。
* 内层 CMAKE_ARGS 注入由 `-DMRPT_BUILD_OCTOMAP=OFF` 改为
`-DOCTOMAP_DIR=%{_libdir}/octomap`,让 `find_package(OCTOMAP QUIET)` 命中
系统 config(本地以解包 rpm 的 config 目录实测:OCTOMAP_FOUND=1、
OCTOMAP_INCLUDE_DIRS=<prefix>/include、OCTOMAP_VERSION=1.9.8;
注意 `project(... NONE)` 无架构信息时 CMake 不搜 lib64,故显式给
OCTOMAP_DIR 而非依赖默认搜索路径)。
* mrpt 用到的 octomap 符号(ColorOcTree、ColorOcTreeNode、OcTree、
OcTreeNode、OcTreeKey、KeySet、Pointcloud、point3d)已逐个在 1.9.8 头中
核对存在;Ubuntu 22.04 的系统 octomap 同为 1.9.8,是 mrpt 的既有支持面。
* 新增两处闸门:%prep 校验 OCTOMAP_DIR 注入成功;%build 开头校验
%{_includedir}/octomap/ColorOcTree.h 存在,把"BuildRequires 失效"变成
构建早期失败而非 18% 处才炸。
* waived_deps.txt 中 liboctomap-dev 条目改注为"Debian 名 ↔ RPM 名
octomap-devel,已真实引入"。
- Release 2(上一版 2.15.20-1 依赖预检失败;2.15.20-2 因上述 octomap 误判
%build 失败,无产物)。
* Tue Sep 22 2026 ai-importer <ai-importer@openeuler.org> - 2.15.20-2
- 依赖预检无 provider 修复(对齐同链已成功并经 COPR build 112588/112590 验证的
ros-humble-mrpt-libopengl-2.15.20-2 / ros-humble-mrpt-libposes-2.15.20-2 /
ros-humble-mrpt-libtclap 处置方式;这些名字在 openEuler 官方源 / EPOL / ROS SIG
外挂源均查无 provider,已逐个 dnf repoquery --whatprovides 实证):
* Debian 名修正:libxxf86vm → libXxf86vm-devel,libjpeg → libjpeg-devel,
freeglut → freeglut-devel。
* libfreenect-devel / libopenni2-dev / libglfw3-dev / liboctomap-dev /
wx-common / wxwidgets 从 BuildRequires 移除,改为关掉内层 mrpt 对应特性:
-DMRPT_WITH_KINECT=OFF / -DMRPT_HAS_OPENNI2=OFF / -DMRPT_BUILD_OCTOMAP=OFF
(glfw 仅 3rdparty/nanogui 使用,其构建已由包装工程自带的
-DMRPT_BUILD_nanogui=OFF 关闭;wx 仅 mrpt-gui 使用,包装工程自带
-DBUILD_mrpt-gui=OFF 与 -DMRPT_BUILD_wxThings=OFF)。这些条目在
mrpt_libmaps/package.xml 里本就自注为 "not actually required by this ROS
package, but we need them for the mrpt/config.h to reflect we have such
feature",只影响 config.h 的特性开关。已在 waived_deps.txt 逐条注明理由。
* 按既有基线补齐 openEuler 实际可用的 devel 包:新增 eigen3-devel / git /
gtest-devel / libglvnd-devel / libzstd-devel / mesa-libGLU-devel /
suitesparse-devel / tbb-devel(mrpt 找不到系统 GLUT 会去编内置 freeglut、
找不到 assimp/openjpeg 会 ExternalProject 下源码,chroot 无外网必挂)。
* BuildRequires/Requires 补齐 ros-humble-mrpt-libbase / -libmath / -libobs /
-libopengl / -libposes:本包内层只建 mrpt-maps + mrpt-graphs,而 mrpt-maps
声明依赖 mrpt-obs + mrpt-graphs、mrpt-graphs 依赖 mrpt-opengl、mrpt-obs 依赖
mrpt-opengl + mrpt-tfest,其余 core/io/config/img/math/poses 等兄弟库均走
DeclareMRPTLib.cmake 的 find_package 复用,提供方必须列为构建依赖。
- 修复构建期 ExternalProject 退回 git clone(COPR chroot 无外网必失败):
%prep 预置 mrpt 源码到 <top>/mrpt-build/src/mrpt,并把 CMakeLists.txt 的本地
复用路径改写为 ${CMAKE_CURRENT_LIST_DIR}/../mrpt-build、移除 buildfarm HOME
守卫;补 3rdparty/nanogui/include 与 3rdparty/rplidar_sdk/sdk/src 空目录绕过
上游 "git submodules missing!" 致命检查;Source2/Source3 填入 nanoflann 与
simpleini;%build 增加 gitclone 闸门与 libmrpt-maps/libmrpt-graphs 产物闸门。
- 内层 mrpt 的 CMAKE_ARGS 注入 -DCMAKE_PREFIX_PATH=/opt/ros/%{ros_distro}:
mrpt-maps / mrpt-graphs 对 BUILD_mrpt-*=OFF 的兄弟库走 DeclareMRPTLib.cmake 的
find_package(mrpt-XXX),命中不了时会被静默禁用、产出空包。
- 内层构建并行度按内存自适应(min(nproc, MemTotal/2.5GiB))并降优化级别为
-O1 -g0,防 cc1plus 被 OOM killer 杀死(同链 mrpt-libmath build 112579 教训)。
- Release 2(上一版 2.15.20-1 依赖预检失败,无产物)。
|