You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

armv7a-none-eabi目标Rust无标准库项目用-Zprofile编译遇profiler_builtins缺失错误

armv7a-none-eabi裸机项目使用-Zprofile编译时找不到profiler_builtins crate的问题

问题概述

我在为armv7a-none-eabi目标获取Rust代码覆盖率数据时遇到问题:x86目标编译正常,但armv7a-none-eabi目标编译失败,提示找不到profiler_builtins crate。这是一个无标准库(no-std)的裸机项目,已禁用增量编译。了解到-Zprofile虽为不稳定特性,但相关开发记录显示它应该可以正常工作。

报错信息

error[E0463]: can't find crate for `profiler_builtins`

使用的编译命令

RUSTFLAGS="-Zprofile" cargo +nightly build --target="armv7a-none-eabi"

最小复现示例

  1. 创建新Cargo项目
  2. 将main.rs内容替换为:
#![no_std]
#![no_main]
use core::panic::PanicInfo;

#[panic_handler]
fn panic_handler(info: &PanicInfo) -> ! {
    loop {}
}

pub extern fn main() {}
  1. 执行编译命令:
RUSTFLAGS="-Zprofile" cargo +nightly build --target="armv7a-none-eabi"

预期与实际结果

  • 预期:代码带gcov profiling编译成功
  • 实际:编译失败,抛出error[E0463]: can't find crate for profiler_builtins``错误

rustc版本信息

  • rustc 1.78.0-nightly (2bf78d12d 2024-02-18)
  • binary: rustc
  • commit-hash: 2bf78d12d33ae02d10010309a0d85dd04e7cff72
  • commit-date: 2024-02-18
  • host: x86_64-unknown-linux-gnu
  • release: 1.78.0-nightly
  • LLVM version: 18.1.0

疑问

我是否遗漏了什么配置?是否可以手动编译profiler_builtins并通过环境变量或配置指定路径?


内容的提问来源于stack exchange,提问作者Joel Imbergamo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.28 21:57:27