opened
hunterlxt
username_0
**Describe the bug**
Build error when generate bindings to gRPC in CentOS
```
HOST = Some("x86_64-unknown-linux-gnu")
CXX_x86_64-unknown-linux-gnu = None
CXX_x86_64_unknown_linux_gnu = None
HOST_CXX = None
CXX = None
CXXFLAGS_x86_64-unknown-linux-gnu = None
CXXFLAGS_x86_64_unknown_linux_gnu = None
HOST_CXXFLAGS = None
CXXFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
running: "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "grpc/include" "-Wall" "-Wextra" "-std=c++11" "-DGRPC_SYS_SECURE" "-Werror" "-o" "/home/lxt/Projects/grpc-rs/target/debug/build/grpcio-sys-3e86be41c3f6dd46/out/grpc_wrap.o" "-c" "grpc_wrap.cc"
exit code: 0
AR_x86_64-unknown-linux-gnu = None
AR_x86_64_unknown_linux_gnu = None
HOST_AR = None
AR = None
running: "ar" "crs" "/home/lxt/Projects/grpc-rs/target/debug/build/grpcio-sys-3e86be41c3f6dd46/out/libgrpc_wrap.a" "/home/lxt/Projects/grpc-rs/target/debug/build/grpcio-sys-3e86be41c3f6dd46/out/grpc_wrap.o"
exit code: 0
cargo:rustc-link-lib=static=grpc_wrap
cargo:rustc-link-search=native=/home/lxt/Projects/grpc-rs/target/debug/build/grpcio-sys-3e86be41c3f6dd46/out
CXXSTDLIB_x86_64-unknown-linux-gnu = None
CXXSTDLIB_x86_64_unknown_linux_gnu = None
HOST_CXXSTDLIB = None
CXXSTDLIB = None
cargo:rustc-link-lib=stdc++

--- stderr
./grpc/include/grpc/impl/codegen/slice.h:24:10: fatal error: 'stddef.h' file not found
./grpc/include/grpc/impl/codegen/slice.h:24:10: fatal error: 'stddef.h' file not found, err: true
thread 'main' panicked at 'Unable to generate grpc bindings: ()', src/libcore/result.rs:999:5
```

Method that has been tried
1. scl enable llvm-toolset-7
2. update cmake 
3. update gcc/g++
4. use a new OS to build in strict accordance with the documentation
Build error when generate bindings to gRPC in CentOS
issue
created
BusyJay
username_1
I encounter the same error on Fedora 30. I manage to get around this by setting environment variables CPLUS_INCLUDE_PATH to "/usr/lib/gcc/x86_64-redhat-linux/9/include".
comment
created
Ten0
username_2
Same error on my fully up to date ArchLinux and on our Debian stretch deployment system. Latest release broke quite some builds.
comment
created
light4
username_3
Same here, I find that cargo cache don't have `third_party/protobuf` directory.

```
username_3@matrix ~>  ls -lh .cargo/registry/src/github.com-1ecc6299db9ec823/grpcio-sys-0.5.0-alpha.2/grpc/third_party/
总用量 72K
drwxr-xr-x  3 username_3 username_3 4.0K  7月 18 17:33 address_sorting/
-rw-rw-r--  1 username_3 username_3  291  3月 19 16:59 benchmark.BUILD
drwxr-xr-x 11 username_3 username_3 4.0K  7月 18 17:33 boringssl/
-rw-rw-r--  1 username_3 username_3  266  3月 19 16:59 BUILD
drwxr-xr-x  9 username_3 username_3 4.0K  7月 18 17:33 cares/
-rw-rw-r--  1 username_3 username_3  134  3月 19 16:59 constantly.BUILD
-rw-rw-r--  1 username_3 username_3  667  3月 19 16:59 cython.BUILD
-rw-rw-r--  1 username_3 username_3  777  3月 19 16:59 gtest.BUILD
-rw-rw-r--  1 username_3 username_3  178  3月 19 16:59 incremental.BUILD
drwxr-xr-x  8 username_3 username_3 4.0K  7月 18 17:33 nanopb/
-rw-rw-r--  1 username_3 username_3  323  3月 19 16:59 nanopb.BUILD
drwxr-xr-x  2 username_3 username_3 4.0K  7月 18 17:33 py/
drwxr-xr-x  2 username_3 username_3 4.0K  7月 18 17:33 toolchains/
-rw-rw-r--  1 username_3 username_3  375  3月 19 16:59 twisted.BUILD
-rw-rw-r--  1 username_3 username_3  164  3月 19 16:59 yaml.BUILD
drwxr-xr-x 14 username_3 username_3 4.0K  7月 18 17:33 zlib/
-rw-rw-r--  1 username_3 username_3  632  3月 19 16:59 zlib.BUILD
-rw-rw-r--  1 username_3 username_3  241  3月 19 16:59 zope_interface.BUILD
```
comment
created
BusyJay
username_1
@username_2 from 0.5.0-alpha.2, grpcio-sys depends on clang and clang library. Have you installed those libraries?

@username_3 It has nothing to do with protobuf. The error is reported by bindgen, which requires clang toolchains.
comment
created
light4
username_3
# quick fix

```
# centos
yum install clang clang-devel llvm llvm-devel

# archlinx
# add this line to bindgen config at build.rs:259
.clang_arg("-I/usr/lib/clang/8.0.0/include")
```
comment
created
BusyJay
username_1
Hmm, can you help us to add the dependencies to Prerequisites? @username_3
comment
created
hunterlxt
username_0
it seems like there is only 3.4.2 in yum repo
comment
created
light4
username_3
yep, but it should be fine, can you test it?
comment
created
hunterlxt
username_0
doesn't work, I think building from source could fix @username_3
comment
created
light4
username_3
I try to build it on centos 7.1, it builds successfully. Can you paste the error logs here?
```
llvm 3.4.2
clang 3.4.2
CentOS Linux release 7.1.1503 (Core)
```
comment
created
BusyJay
username_1
Related issue: rust-lang/rust-bindgen#1226
comment
created
hunterlxt
username_0
Be sad  /(ㄒoㄒ)/~~ @username_1
comment
closed
BusyJay
username_1
issue