Lely CANopen configure 配置项与日志解读

发布时间:2026/6/26 5:53:53
Lely CANopen configure 配置项与日志解读 Lely CANopen configure 配置项与日志解读文章目录Lely CANopen configure 配置项与日志解读1. configure 在构建链路中的位置2. configure 可传入配置的主要类别2.1 通用控制2.2 安装路径2.3 程序名变换2.4 系统类型与交叉编译2.5 Autotools/Libtool 构建行为2.6 平台能力裁剪2.7 EDS/DCF 与对象字典裁剪2.8 CANopen 协议服务裁剪2.9 C application、工具、测试、Python、文档2.10 外部包与工具链搜索2.11 常用环境变量3. 常见配置组合如何理解4. configure 日志应按阶段阅读5. 输入日志逐段说明5.1 命令行与 site script5.2 build / host / target5.3 基础构建工具5.4 覆盖率与 Valgrind 开关5.5 C 编译器探测5.6 系统头文件探测5.7 C 编译器与 C115.8 Libtool、链接器与 binutils5.9 非前缀工具警告5.10 PIC、共享库与静态链接测试5.11 运行时库、线程和 pkg-config5.12 测试、Valgrind 头文件、SocketCAN 与 Linux 接口5.13 Bluetooth 与 BlueZ5.14 Doxygen 与生成阶段6. 日志中容易误读的点7. 判断 configure 是否进入生成阶段9. 参考资料1. configure 在构建链路中的位置configure属于 GNU Build System 的配置阶段。它不会直接把 Lely 源码编译成库而是读取命令行参数、探测工具链和目标系统能力然后生成Makefile、config.h、.pc文件和 libtool 相关脚本。后续make才进入编译阶段。一个典型的交叉编译配置命令可以写成../configure\--hostaarch64-poky-linux\--prefixINSTALL_PREFIX\--disable-python\--disable-cython\--disable-tests\--disable-unit-tests这条命令包含两类信息一类是“目标平台和安装位置”另一类是“功能裁剪策略”。前者影响工具链选择和安装目录后者影响 Python、测试、CANopen 模块、C 接口等是否进入构建目标。2. configure 可传入配置的主要类别下面按用途列出本地configure --help中出现的主要参数。表中的“禁用”通常意味着对应代码、构建目标或条件宏会被关闭但具体是否彻底移除还要看该模块与其他模块之间的依赖关系。2.1 通用控制参数作用-h, --help显示帮助并退出。--helpshort只显示当前包相关的短帮助。--helprecursive显示当前包及子包的短帮助。-V, --version显示 configure 版本信息。-q, --quiet, --silent减少checking ...输出适合脚本环境。--cache-fileFILE把探测结果缓存到指定文件重复配置时可减少探测开销。-C, --config-cache等价于--cache-fileconfig.cache。-n, --no-create只执行探测不生成 Makefile/config.h 等输出文件。--srcdirDIR指定源码目录用于 out-of-tree build。2.2 安装路径参数作用--prefixPREFIX安装根目录默认/usr/local。头文件、库、工具默认都会落到该前缀下。--exec-prefixEPREFIX架构相关文件的安装根目录默认继承PREFIX。--bindirDIR用户可执行程序安装目录默认EPREFIX/bin。--sbindirDIR系统管理程序安装目录默认EPREFIX/sbin。--libexecdirDIR内部辅助可执行程序安装目录。--sysconfdirDIR只读单机配置目录默认PREFIX/etc。--sharedstatedirDIR可修改、架构无关的共享状态目录。--localstatedirDIR可修改、单机本地状态目录。--runstatedirDIR运行期状态目录。--libdirDIR库文件安装目录交叉编译多架构安装时常显式指定。--includedirDIRC/C 头文件安装目录。--oldincludedirDIR非 GCC 场景的传统头文件目录。--datarootdirDIR架构无关只读数据根目录。--datadirDIR架构无关数据目录。--infodirDIRinfo 文档目录。--localedirDIR本地化数据目录。--mandirDIRman 文档目录。--docdirDIR项目文档安装根目录。--htmldirDIR / --dvidirDIR / --pdfdirDIR / --psdirDIR不同格式文档的安装目录是否生成文档还受--disable-doc、Doxygen 等影响。2.3 程序名变换参数作用--program-prefixPREFIX给安装的程序名添加前缀。--program-suffixSUFFIX给安装的程序名添加后缀。--program-transform-namePROGRAM用 sed 表达式转换安装程序名。2.4 系统类型与交叉编译参数作用--buildBUILD构建机三元组通常自动推断。--hostHOST目标运行平台三元组与 build 不同时进入交叉编译。--targetTARGET主要用于构建编译器等工具链普通库项目一般等于 host。2.5 Autotools/Libtool 构建行为参数作用--disable-option-checking忽略无法识别的--enable-*/--with-*选项。--enable-silent-rules / --disable-silent-rules控制 make 输出详细程度。--disable-maintainer-mode关闭维护者规则避免普通构建触发 Autotools 重新生成。--enable-code-coverage开启覆盖率构建通常用于测试和 CI。--enable-valgrind在单元测试中启用 Valgrind。--disable-valgrind-memcheck跳过 Valgrind memcheck 测试。--disable-valgrind-helgrind跳过 Valgrind helgrind 线程检测。--disable-valgrind-drd跳过 Valgrind drd 线程检测。--disable-valgrind-sgcheck跳过 Valgrind sgcheck。--enable-dependency-tracking启用依赖跟踪增量构建更准确但可能更慢。--disable-dependency-tracking关闭依赖跟踪加快一次性构建。--enable-shared[PKGS]构建共享库默认 yes。--enable-static[PKGS]构建静态库默认 yes。--enable-fast-install[PKGS]启用 libtool 快速安装优化。--disable-libtool-lock禁用 libtool 锁可能影响并行构建可靠性。2.6 平台能力裁剪参数作用--disable-rt禁用 Realtime Extensions。--disable-threads禁用多线程支持官方文档对应LELY_NO_THREADS。--enable-ecss-compliance启用 ECSS 合规构建路径主要面向特定合规/测试需求。--disable-errno禁用 errno官方文档说明这也会禁用 C 支持因为 C API 依赖 errno 处理异常。--disable-malloc禁用动态内存分配官方文档说明该支持仍是 preliminary且会禁用 C 支持。--disable-stdio禁用标准 I/Oerrno 或 malloc 被禁用时也会自动禁用 stdio。--disable-cxx禁用 C 接口并禁用整个 C CANopen application library。--disable-daemon禁用 daemon/service 支持stdio 被禁用时会自动禁用。--disable-diag禁用诊断函数输出诊断接口仍可调用但无效果。--disable-canfd禁用 CAN FD缩小通用 CAN 消息结构编译库和应用时宏设置需要一致。2.7 EDS/DCF 与对象字典裁剪参数作用--disable-dcf禁用 EDS/DCF 支持。--disable-dcf-restore不保存/恢复 application parameters 的 concise DCF。--disable-obj-default禁用对象字典默认值。--disable-obj-file禁用对象字典 UploadFile/DownloadFile 支持。--disable-obj-limits禁用对象字典最小值/最大值约束。--disable-obj-name禁用对象字典名称字符串。--disable-obj-upload禁用对象字典自定义 upload indication 函数。--disable-sdev禁用 static device description 支持。2.8 CANopen 协议服务裁剪参数作用--disable-ssdo-blk禁用 Server-SDO block transfer。--disable-csdo禁用 Client-SDO。--disable-rpdo禁用 Receive-PDO。--disable-tpdo禁用 Transmit-PDO。--disable-mpdo禁用 Multiplex PDO。--disable-sync禁用 SYNC 对象。--disable-time禁用 TIME 时间戳对象。--disable-emcy禁用 EMCY emergency 对象。--disable-lss禁用 LSS Layer Setting Services。--disable-wtm禁用 WTM Wireless Transmission Media 支持。--disable-master禁用 CANopen master 支持。--disable-ng禁用 node guarding。--disable-nmt-boot禁用 NMT boot slave。--disable-nmt-cfg禁用 NMT configuration request。--disable-gw禁用 gateway 支持。--disable-gw-txt禁用 ASCII gateway 支持。2.9 C application、工具、测试、Python、文档参数作用--disable-coapp-master禁用 C CANopen application master 支持。--disable-coapp-slave禁用 C CANopen application slave 支持。--disable-tools禁用命令行工具构建。--disable-tests禁用测试。--disable-unit-tests禁用单元测试。--disable-unit-tests-memleak禁用单元测试内存泄漏检测。--disable-python禁用 Python tools and bindings官方交叉编译文档说明该选项会隐含--disable-cython并禁用 DCF tools。--disable-python2禁用 Python 2 tools and bindings。--disable-python3禁用 Python 3 tools and bindings。--disable-cython不使用 Cython 生成 Python bindings官方文档说明该绑定已属于 deprecated Python bindings。--disable-doc禁用 Doxygen 文档生成。2.10 外部包与工具链搜索参数作用--with-gcovGCOV指定覆盖率工具 gcov。--with-pic[PKGS]控制 PIC/non-PIC 对象使用策略。–with-aix-sonameaixsvr4--with-gnu-ld假设 C 编译器使用 GNU ld。--with-sysroot[DIR]在指定 sysroot 或编译器 sysroot 中搜索依赖库。--with-ixxat[DIR]搜索 IXXAT VCI SDK官方文档说明会在 DIR/inc 下查找 VCI 头文件。--with-vci[DIR]同 IXXAT VCI SDK 搜索相关。2.11 常用环境变量参数作用CC / CXX指定 C/C 编译器命令。CFLAGS / CXXFLAGS指定 C/C 编译参数例如优化、告警、目标架构。CPPFLAGS指定预处理参数例如额外 include 路径。LDFLAGS指定链接器参数例如额外库目录。LIBS显式追加链接库。CPP / CXXCPP指定 C/C 预处理器。PKG_CONFIG / PKG_CONFIG_PATH / PKG_CONFIG_LIBDIR控制 pkg-config 工具及搜索路径交叉编译时尤其重要。CPPUTEST_CFLAGS / CPPUTEST_LIBS覆盖 CppUTest 的编译与链接参数。LT_SYS_LIBRARY_PATH用户定义的运行期库搜索路径。3. 常见配置组合如何理解场景配置示例说明| 交叉编译到 ARM64 Linux |--hostaarch64-poky-linux --prefixINSTALL_PREFIX|--host触发交叉编译路径--prefix控制安装根目录。 || 不构建 Python 工具/绑定 |--disable-python --disable-cython|--disable-python会关闭 Python tools and bindings并隐含关闭 Cython 绑定显式写出--disable-cython可增强命令可读性。 || 不跑测试 |--disable-tests --disable-unit-tests| 关闭测试和单元测试目标这不等于 configure 完全不探测 CppUTest因为脚本仍可能检查可选依赖。 || 只保留 C 库接口 |--disable-cxx| 关闭 C 接口和 C CANopen application library。 || 减少目标运行时依赖 |--disable-threads --disable-stdio --disable-daemon| 面向资源受限或无完整 POSIX 能力的运行时需要确认应用是否依赖这些能力。 || 不需要 CAN FD |--disable-canfd| 缩小 CAN 消息结构库和应用编译宏需要保持一致。 || 不生成文档 |--disable-doc| 避免 Doxygen/Graphviz 成为文档生成路径的依赖。 |4. configure 日志应按阶段阅读configure 日志的格式通常是checking ... yes/no/value。其中yes表示检查通过no表示未找到或不支持(cached)表示复用缓存。判断一条日志是否异常不能只看yes/no还要看它检查的是必需依赖、可选依赖还是被配置项关闭的功能。5. 输入日志逐段说明5.1 命令行与 site script../configure --hostaarch64-poky-linux --prefixINSTALL_PREFIX \ --disable-python --disable-cython --disable-tests --disable-unit-tests configure: loading site script YOCTO_SDK/site-config-armv8a-poky-linux第一行是传入 configure 的显式策略目标平台由--host指定安装根目录由--prefix指定Python、Cython、测试和单元测试被关闭。第二行说明 Yocto SDK 提供了 site 配置configure 会从中读取交叉编译相关默认值例如 sysroot、工具链路径或缓存结果。5.2 build / host / targetchecking build system type... x86_64-pc-linux-gnu checking host system type... aarch64-poky-linux-gnu checking target system type... aarch64-poky-linux-gnu checking whether we are cross compiling... yesbuild是执行构建命令的机器host是生成程序未来运行的目标系统target对普通库项目通常跟 host 一致。这里 build 与 host 不同因此进入交叉编译路径。5.3 基础构建工具checking for a BSD-compatible install... /usr/bin/install -c checking for a thread-safe mkdir -p... /usr/bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking for a sed that does not truncate output... (cached) sed这些是 Autotools/Automake 构建脚本所需的基础命令。(cached)表示该结果已被缓存或前面已经探测过不是异常。5.4 覆盖率与 Valgrind 开关checking whether to build with code coverage support... no checking for valgrind... no覆盖率未启用Valgrind 可执行程序未找到。若没有开启相关测试目标这类no不构成构建中断。后面又检测到valgrind/valgrind.h说明头文件与可执行程序是两类独立检查。5.5 C 编译器探测checking for aarch64-poky-linux-gcc... aarch64-poky-linux-gcc ... --sysrootTARGET_SYSROOT checking whether the C compiler works... yes checking whether we are using the GNU C compiler... yes checking ... option to accept ISO C89... none needed checking ... option to accept ISO C99... none needed checking how to run the C preprocessor... aarch64-poky-linux-gcc -E ...configure 找到了交叉 C 编译器并验证它可以编译最小测试程序。none needed表示编译器默认模式已能满足对应 C 标准测试无需额外-std参数。5.6 系统头文件探测checking for ANSI C header files... yes checking for sys/types.h... yes checking for stdint.h... yes checking minix/config.h usability... no checking whether it is safe to define __EXTENSIONS__... yes这些检查用于判断目标 sysroot 中的 C 库头文件能力。minix/config.h... no只是说明目标系统不是 Minix 风格不是错误。__EXTENSIONS__与系统兼容宏有关。5.7 C 编译器与 C11checking whether we are using the GNU C compiler... yes checking whether aarch64-poky-linux-g supports C11 features with -stdgnu11... yesLely core 是 C 库为主但提供部分 C 接口和 C CANopen application library。该段确认目标 C 编译器可用并能通过-stdgnu11支持 C11。5.8 Libtool、链接器与 binutilschecking for ld used by aarch64-poky-linux-gcc... aarch64-poky-linux-ld --sysrootTARGET_SYSROOT checking if the linker ... is GNU ld... yes checking for BSD- or MS-compatible name lister (nm)... aarch64-poky-linux-nm checking for aarch64-poky-linux-ar... aarch64-poky-linux-ar checking for aarch64-poky-linux-ranlib... aarch64-poky-linux-ranlib这一段属于 libtool 初始化。它确定链接器、符号表工具、归档工具和 ranlib 是否与目标三元组匹配这决定后续.so、.a和 libtool wrapper 的生成方式。5.9 非前缀工具警告checking for aarch64-poky-linux-mt... no checking for mt... mt configure: WARNING: using cross tools not prefixed with host triplet checking if mt is a manifest tool... nomt是 Windows manifest 相关工具。当前目标是 Linux/ARM64日志中虽然出现 warning但紧接着判断mt不是 manifest tool对 Linux CANopen 库构建一般不是关键路径。文章中应解释为“非关键工具探测警告”而不是当作主失败点。5.10 PIC、共享库与静态链接测试checking ... option to produce PIC... -fPIC -DPIC checking ... PIC flag -fPIC -DPIC works... yes checking ... static flag -static works... no checking whether ... linker supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes-fPIC通过说明可生成位置无关代码满足共享库构建。-static works... no表示用-static生成完全静态可执行文件的测试没有通过它不等同于不能生成静态库因为后面build static libraries... yes仍然成立。5.11 运行时库、线程和 pkg-configchecking for qemu-aarch64... qemu-aarch64 checking for timer_create in -lrt... yes checking whether pthreads work with -pthread and -lpthread... yes checking for PTHREAD_PRIO_INHERIT... yes checking for aarch64-poky-linux-pkg-config... no checking for pkg-config... SDK_HOST_SYSROOT/usr/bin/pkg-config checking pkg-config is at least version 0.9.0... yes这部分确认 QEMU、POSIX timer、pthread 和 pkg-config。未找到带目标前缀的 pkg-config但找到了 SDK host sysroot 中的 pkg-config交叉编译场景需要进一步关注它是否配套设置了PKG_CONFIG_SYSROOT_DIR、PKG_CONFIG_LIBDIR等。5.12 测试、Valgrind 头文件、SocketCAN 与 Linux 接口checking for CPPUTEST... no checking valgrind/valgrind.h usability... yes checking linux/can.h usability... yes checking linux/can/raw.h presence... yes checking sys/epoll.h presence... yes checking sys/ioctl.h presence... yesCppUTest 未找到但单元测试已通过配置参数关闭SocketCAN、CAN error、CAN raw、netlink、rtnetlink、epoll、ioctl 等 Linux 头文件可用说明目标 sysroot 支持 Lely Linux CAN/I/O 相关构建路径。5.13 Bluetooth 与 BlueZchecking for bluetooth/bluetooth.h... yes checking for bluetooth/rfcomm.h... yes checking for library containing str2ba... -lbluetoothLely 的 I/O 层在 Linux 下可探测 BlueZ/Bluetooth RFCOMM。官方安装文档说明 Bluetooth 支持不是 CANopen stack 的必需条件因此这类能力更多影响可选 I/O 支持。5.14 Doxygen 与生成阶段checking for doxygen... no checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: creating config.h config.status: executing depfiles commands config.status: executing libtool commandsDoxygen 未找到只影响 API 文档生成。末尾进入config.status并生成顶层 Makefile、各子目录 Makefile、pkg-config 文件和config.h表示 configure 已完成“生成构建系统文件”这一阶段。6. 日志中容易误读的点日志现象正确理解|checking for CPPUTEST... no| CppUTest 未找到如果单元测试目标已关闭它不是主构建路径的中断点。 ||checking for doxygen... no| Doxygen 未找到通常只影响 API 文档生成。 ||checking ... static flag -static works... no| 表示完全静态链接测试未通过不等于不能生成.a静态库。 ||configure: WARNING: using cross tools not prefixed with host triplet| 某个工具没有目标三元组前缀需要结合具体工具判断。这里出现在mt相关探测中通常不是 Linux/ARM CANopen 库的关键工具。 ||python/.../Makefile仍被创建 | Autotools 可生成子目录 Makefile但实际是否参与构建由 Automake 条件和 configure 变量决定。 ||pkg-config没有目标前缀 | 交叉编译中常见关键是是否使用 SDK 提供的 pkg-config并且路径变量是否指向目标 sysroot。 |7. 判断 configure 是否进入生成阶段configure 日志末尾出现以下模式时说明它已经完成探测并开始生成构建系统文件configure: creating ./config.status config.status: creating Makefile config.status: creating config.h config.status: executing depfiles commands config.status: executing libtool commands如果出现configure: error: ...则通常表示配置阶段被中断需要根据错误项补依赖、修工具链路径或调整--enable/--disable/--with参数。9. 参考资料Lely CANopenInstallation。说明 GNU Build System 构建流程、依赖项、autoreconf -i、../configure --disable-cython、make、make check、make install。Lely CANopenCross-compilation。说明--hostHOST交叉编译以及--disable-python会隐含--disable-cython并禁用 DCF tools。Lely CANopenBuild configuration。说明--disable-cxx、--disable-threads、--disable-errno、--disable-malloc、--disable-stdio、--disable-daemon、--disable-diag、--disable-canfd等配置项和对应预处理宏。Lely core libraries Doxygen 首页。说明可通过./configure --help查看完整配置项。