温馨提示:本文翻译自stackoverflow.com,查看原文请点击:macos - Cannot find stdio.h

macos - 找不到stdio.h

发布于 2020-03-31 23:08:47

我正在使用macOS。

我正在尝试构建mozilla-central的代码。

运行命令时./mach build,编译将在编译步骤中失败。以下是相关的堆栈跟踪:

stack backtrace:
 0:20.24    0:        0x10436b5ff - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::hed04c7a1477ef1e3
 0:20.24    1:        0x10434499d - std::sys_common::backtrace::print::h336400f22676933f
 0:20.24    2:        0x104373bd3 - std::panicking::default_hook::{{closure}}::h0d6700a02d682978
 0:20.24    3:        0x10437395c - std::panicking::default_hook::h90363c6d6ac04260
 0:20.24    4:        0x1043742fb - std::panicking::rust_panic_with_hook::h81c4f3add25e6667
 0:20.24    5:        0x1043740ce - std::panicking::continue_panic_fmt::hfa057b7c1de88179
 0:20.24    6:        0x104374020 - std::panicking::begin_panic_fmt::hd1123702300ea9f2
 0:20.24    7:        0x1035f4e6d - build_script_build::build_gecko::bindings::write_binding_file::h2d9a397b93e6a614
 0:20.24    8:        0x1035f651c - build_script_build::build_gecko::bindings::generate_bindings::ha066bc11b076e01d
 0:20.24    9:        0x1043808fe - __rust_maybe_catch_panic
 0:20.24   10:        0x1035eea9f - std::panicking::try::hcbd901ede6e8004c
 0:20.32   11:        0x1035e335c - <F as alloc::boxed::FnBox<A>>::call_box::h638a7c5eb8c94414
 0:20.33   12:        0x104373037 - std::sys_common::thread::start_thread::h78b1dd404be976ad
 0:20.33   13:        0x1043436c8 - std::sys::unix::thread::Thread::new::thread_start::h27c6becca8cf44e0
 0:20.33   14:     0x7fff636208cc - _pthread_body
 0:20.33   15:     0x7fff6362083e - _pthread_start
 0:20.33 /usr/local/Cellar/llvm/6.0.1/include/c++/v1/stdio.h:108:15: fatal error: 'stdio.h' file not found
 0:20.33 /usr/local/Cellar/llvm/6.0.1/include/c++/v1/stdio.h:108:15: fatal error: 'stdio.h' file not found, err: true
 0:20.37 thread '<unnamed>' panicked at 'Failed to generate bindings

据我说,根本原因是:

/usr/local/Cellar/llvm/6.0.1/include/c++/v1/stdio.h:108:15: fatal error: 'stdio.h' file not found, err: true

在线列出的解决方案是使用以下方法安装xcode命令行工具:

xcode-select --install

我已经做到了。

查看更多

提问者
97amarnathk
被浏览
47
683 2018-11-10 19:14

根本原因是由于缺少/usr/include目录。

xcode-select --install有时,安装命令行工具()不会自动添加它。

链接显示了正确的方法:在安装命令行工具后安装软件包在:

# run this in Terminal
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

之后,

您应该有一个/usr/include包含头文件的目录

发布
问题

分享
好友

手机
浏览

扫码手机浏览