RUST编译提示缺少stddef.h文件解决记录

cpp 复制代码
Caused by:
  process didn't exit successfully: `/home/byd/src/iceoryx2/target/debug/build/iceoryx2-pal-posix-987a04ecc9c27d79/build-script-build` (exit status: 101)
  --- stdout
  cargo:rustc-link-lib=pthread
  cargo:rerun-if-changed=src/c/posix.h
  cargo:rerun-if-env-changed=TARGET
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_x86_64-unknown-linux-gnu
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS_x86_64_unknown_linux_gnu
  cargo:rerun-if-env-changed=BINDGEN_EXTRA_CLANG_ARGS
  cargo:rerun-if-changed=src/c/posix.h

  --- stderr
  /usr/include/x86_64-linux-gnu/sys/types.h:144:10: fatal error: 'stddef.h' file not found
  thread 'main' panicked at iceoryx2-pal/posix/build.rs:43:18:
  Unable to generate bindings: ClangDiagnostic("/usr/include/x86_64-linux-gnu/sys/types.h:144:10: fatal error: 'stddef.h' file not found\n")
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/std/src/panicking.rs:662:5
     1: core::panicking::panic_fmt
               at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/panicking.rs:74:14
     2: core::result::unwrap_failed
               at /rustc/f6e511eec7342f59a25f7c0534f1dbea00d01b14/library/core/src/result.rs:1677:5
     3: core::result::Result<T,E>::expect
     4: build_script_build::main
     5: core::ops::function::FnOnce::call_once
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
warning: build failed, waiting for other jobs to finish...

写了个C语言demo,发现并不缺少这个头文件:

需要安装两个插件:

bash 复制代码
sudo apt-get install build-essential
sudo apt-get install clang libc6-dev

简单记录

相关推荐
Value_Think_Power10 分钟前
问题->语言(符号)
后端
90后的晨仔13 分钟前
一键获取设备IP地址:内网与外网IP的完整指南
后端
90后的晨仔13 分钟前
电脑安装 Redis 的方法
后端
MOON404☾16 分钟前
Rust程序语言设计(5-8)
开发语言·后端·rust
道可到36 分钟前
35 岁程序员的绝地求生计划:你准备好了吗?
前端·后端·面试
90后的晨仔37 分钟前
redis 警告 WARNING: The TCP backlog xxxx
后端
道可到1 小时前
国内最难入职的 IT 公司排行:你敢挑战哪一家?
前端·后端·面试
缓存征服者1 小时前
使用周期性线程池实现流量平滑,我将Redis并发从300+降到1
后端
深圳蔓延科技1 小时前
单点登录到底是什么?
java·后端
道可到1 小时前
程序员养生十大违章:你中了几条?
前端·后端·面试