Warm tip: This article is reproduced from stackoverflow.com, please click
macos

Cannot find stdio.h

发布于 2020-03-31 22:53:32

I am using macOS.

I am trying to build the code of mozilla-central.

While running the command ./mach build, the build fails at the compile step. Here are the relevant stack traces:

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

According to me, the root cause is:

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

The solution listed online was to install xcode command line tools using:

xcode-select --install

I have already done this.

Questioner
97amarnathk
Viewed
105
683 2018-11-10 19:14

The root reason is due to a missing /usr/include directory.

Installing command-line tools (xcode-select --install), sometimes, will not automatically add it.

The Link shows the correct way: After installing command-line tools Install the package at:

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

After that,

you should have a directory /usr/include with header files