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

Build error when generate bindings to gRPC in CentOS #346

Closed
hunterlxt opened this issue Jul 17, 2019 · 12 comments · Fixed by #349
Closed

Build error when generate bindings to gRPC in CentOS #346

hunterlxt opened this issue Jul 17, 2019 · 12 comments · Fixed by #349
Labels
Bug It's not working Build Compilation, environment

Comments

@hunterlxt
Copy link
Member

hunterlxt commented Jul 17, 2019

Describe the bug
Build error when generate bindings to gRPC in CentOS 7

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. yum update cmake
  3. yum update gcc/g++
  4. use a new OS to build in strict accordance with the documentation
@hunterlxt hunterlxt added Bug It's not working Build Compilation, environment labels Jul 17, 2019
@BusyJay
Copy link
Member

BusyJay commented Jul 17, 2019

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".

@Ten0
Copy link
Contributor

Ten0 commented Jul 18, 2019

Same error on my fully up to date ArchLinux and on our Debian stretch deployment system. Latest release broke quite some builds.

@light4
Copy link
Contributor

light4 commented Jul 18, 2019

Same here, I find that cargo cache don't have third_party/protobuf directory.

light4@matrix ~>  ls -lh .cargo/registry/src/github.com-1ecc6299db9ec823/grpcio-sys-0.5.0-alpha.2/grpc/third_party/
总用量 72K
drwxr-xr-x  3 light4 light4 4.0K  7月 18 17:33 address_sorting/
-rw-rw-r--  1 light4 light4  291  3月 19 16:59 benchmark.BUILD
drwxr-xr-x 11 light4 light4 4.0K  7月 18 17:33 boringssl/
-rw-rw-r--  1 light4 light4  266  3月 19 16:59 BUILD
drwxr-xr-x  9 light4 light4 4.0K  7月 18 17:33 cares/
-rw-rw-r--  1 light4 light4  134  3月 19 16:59 constantly.BUILD
-rw-rw-r--  1 light4 light4  667  3月 19 16:59 cython.BUILD
-rw-rw-r--  1 light4 light4  777  3月 19 16:59 gtest.BUILD
-rw-rw-r--  1 light4 light4  178  3月 19 16:59 incremental.BUILD
drwxr-xr-x  8 light4 light4 4.0K  7月 18 17:33 nanopb/
-rw-rw-r--  1 light4 light4  323  3月 19 16:59 nanopb.BUILD
drwxr-xr-x  2 light4 light4 4.0K  7月 18 17:33 py/
drwxr-xr-x  2 light4 light4 4.0K  7月 18 17:33 toolchains/
-rw-rw-r--  1 light4 light4  375  3月 19 16:59 twisted.BUILD
-rw-rw-r--  1 light4 light4  164  3月 19 16:59 yaml.BUILD
drwxr-xr-x 14 light4 light4 4.0K  7月 18 17:33 zlib/
-rw-rw-r--  1 light4 light4  632  3月 19 16:59 zlib.BUILD
-rw-rw-r--  1 light4 light4  241  3月 19 16:59 zope_interface.BUILD

@BusyJay
Copy link
Member

BusyJay commented Jul 18, 2019

@Ten0 from 0.5.0-alpha.2, grpcio-sys depends on clang and clang library. Have you installed those libraries?

@light4 It has nothing to do with protobuf. The error is reported by bindgen, which requires clang toolchains.

@light4
Copy link
Contributor

light4 commented Jul 19, 2019

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")

@BusyJay
Copy link
Member

BusyJay commented Jul 19, 2019

Hmm, can you help us to add the dependencies to Prerequisites? @light4

@hunterlxt
Copy link
Member Author

it seems like there is only 3.4.2 in yum repo

@light4
Copy link
Contributor

light4 commented Jul 19, 2019

it seems like there is only 3.4.2 in yum repo

yep, but it should be fine, can you test it?

@hunterlxt
Copy link
Member Author

doesn't work, I think building from source could fix @light4

@light4
Copy link
Contributor

light4 commented Jul 19, 2019

doesn't work, I think building from source could fix @light4

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)

@BusyJay
Copy link
Member

BusyJay commented Jul 19, 2019

Related issue: rust-lang/rust-bindgen#1226

@hunterlxt
Copy link
Member Author

Be sad /(ㄒoㄒ)/~~ @BusyJay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug It's not working Build Compilation, environment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants