Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find stdio.h

Tags:

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.

like image 794
97amarnathk Avatar asked Aug 09 '18 07:08

97amarnathk


People also ask

Why is Stdio H not working?

<stdio. h> is one of the standard C headers. Your compiler complains that it can not find this header. This means that your standard library is broken.

What happens if Stdio H is not included?

it means that the programmer is giving a direction to the C-compiler that it should include or attach the "stdio" header file before processing the code written afterwards. Without this directive the code will not work at all.

Where is the Stdio h file located in Windows?

The library is in whichever one of the C Runtime Libraries against which you are linking. Those libraries are in the VC\lib folder in the Visual Studio installation directory. Thanks for your answer.

Where is Stdio h'on Linux?

It's an . h file it is a header, thus, /usr/include/stdio.

Where is the stdio h file in Ubuntu?

However, I can't find the files "stdio.h". In Ubuntu, the stdio.h file is provided by the package libc6-dev, which should be required by build-essential. So that file really ought to be there.

Where can I find stdio H?

Anyone have a clue as to what's wrong or where to start looking? If you are using the compiler version that comes with CCS, stdio.h is located in C:\CCStudio_v3.3 ms470\cgtools\include.

Why can't I Find my Visual Studio code file?

If you are reopening an old solution, make sure that environment (Windows SDK version, Compiler Version etc) is set correctly This file is located inside Visual Studio libraries. It should be used as If you still cannot find it, locate where this file is stored on your computer.

Why can't Visual Studio 2017 open source file stdio?

Visual Studio 2017 says cannot open source file stdio.h? You should also check that you've installed necessary C++ development tools with Visual Studio. Check this page, towards the end you'll see what has been checked during setup.


2 Answers

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

like image 105
Rick Li Avatar answered Oct 24 '22 15:10

Rick Li


Try setting SDKROOT explicitly to the system SDK:

export SDKROOT=$(xcrun --sdk macosx --show-sdk-path) 

Doing it avoids the need for creating symlinks in /usr.

This error seem recurrent, for example, if you installed another compiler (e.g. gcc from brew). Setting SDKROOT became so common that it might be a good idea to add it to ~/.bash_profile.

like image 29
F Pereira Avatar answered Oct 24 '22 16:10

F Pereira