uatuko / grpcxx

🚀 Blazing fast gRPC server (C++)
MIT License
75 stars 8 forks source link

Build fails because include nghttp2/nghttp2.h is not found #31

Closed panta closed 6 months ago

panta commented 7 months ago

Compilation failed on the include of #include <nghttp2/nghttp2.h>.

I had slightly changed cmake deps to use use protobuf 4.25.1. Is there a misconfiguration on my part?

My build was:

$ git clone https://github.com/uatuko/grpcxx.git --recursive
$ cd grpcxx
$ vi cmake/dependencies.cmake
    ...
    # protobuf
    set(Protobuf_DEBUG ON)
    set(Protobuf_INCLUDE_DIR /home/panta/.local/include)
    #find_package(Protobuf 3.15.0 CONFIG REQUIRED)
    find_package(Protobuf 4.25.1 CONFIG REQUIRED)
    ...
$ rm -rf build ; mkdir -p build && cd build && cmake -DENABLE_LIB_ONLY=OFF -DGRPCXX_BUILD_EXAMPLES=on ..
$ make
...
[ 36%] Building CXX object _deps/nghttp2-build/src/CMakeFiles/nghttpx_static.dir/util.cc.o
/home/panta/grpcxx/build/_deps/nghttp2-src/src/util.cc:65:10: fatal error: nghttp2/nghttp2.h: No such file or directory
   65 | #include <nghttp2/nghttp2.h>
      |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [_deps/nghttp2-build/src/CMakeFiles/nghttpx_static.dir/build.make:76: _deps/nghttp2-build/src/CMakeFiles/nghttpx_static.dir/util.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1426: _deps/nghttp2-build/src/CMakeFiles/nghttpx_static.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Thank you in advance!

uatuko commented 7 months ago

Hey @panta, I don't see just changing to use Protobuf 4.25.1 causing the builds to fail on nghttp2.

But, it is possible the nghttp2 build fails while building other bundled executables. Can you try -DENABLE_LIB_ONLY=ON (or completely removing -DENABLE_LIB_ONLY=OFF)?

uatuko commented 7 months ago

You should also be able to use protobuf 4.25.1 by just using -DProtobuf_INCLUDE_DIR=/home/panta/.local/include cmake flag, without having to change cmake/dependencies.cmake.