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

简单记录

相关推荐
爱吃土豆的马铃薯ㅤㅤㅤㅤㅤㅤㅤㅤㅤ几秒前
GIT GUI和 GIT bash区别
开发语言·git·bash
joker_man18 分钟前
使用Python和OpenCV实现火焰检测
开发语言·python·opencv
果粒陈爱写代码1 小时前
SpringBoot day 1105
java·spring boot·后端
colman wang1 小时前
Java入门二刷
java·开发语言
GraduationDesign1 小时前
基于SpringBoot的免税商品优选购物商城的设计与实现
java·vue.js·spring boot·后端·html5
海绵宝宝de派小星2 小时前
Go:接口和反射
开发语言·后端·golang
techdashen2 小时前
Go Modules和 雅典项目
开发语言·后端·golang
杜杜的man2 小时前
【go从零单排】go三种结构体:for循环、if-else、switch
开发语言·后端·golang
->yjy2 小时前
springboot - 定时任务
java·spring boot·后端
非往2 小时前
五、Java并发 Java Google Guava 实现
java·开发语言·guava