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

简单记录

相关推荐
Asthenia04129 小时前
Spring AOP 和 Aware:在Bean实例化后-调用BeanPostProcessor开始工作!在初始化方法执行之前!
后端
Asthenia041210 小时前
什么是消除直接左递归 - 编译原理解析
后端
Asthenia041210 小时前
什么是自上而下分析 - 编译原理剖析
后端
Asthenia041210 小时前
什么是语法分析 - 编译原理基础
后端
Asthenia041210 小时前
理解词法分析与LEX:编译器的守门人
后端
uhakadotcom10 小时前
视频直播与视频点播:基础知识与应用场景
后端·面试·架构
Asthenia041211 小时前
Spring扩展点与工具类获取容器Bean-基于ApplicationContextAware实现非IOC容器中调用IOC的Bean
后端
bobz96512 小时前
ovs patch port 对比 veth pair
后端
Asthenia041212 小时前
Java受检异常与非受检异常分析
后端