Thalhammer / mod_proxy_grpc

Apache2 plugin to proxy grpc-web requests to a grpc backend server
MIT License
2 stars 0 forks source link

Can't be compiled under Ubuntu 22.04 LTS g++-11 #1

Open lokapal opened 3 weeks ago

lokapal commented 3 weeks ago
 Hello!

The problem is that it can't be compiled under Ubuntu 22.04.3 x64 / g++-11 If I try to compile according to your instructions (GRPC 1.34.0) - it fails inside abseil_cpp. It I try to compile with GRPC 1.47.5 or 1.46.4 - it fails at the very end of compilation with the message:

/root/grc/mod_proxy_grpc-master/src/grpc_proxy.cpp: In function ‘std::shared_ptr<grpc_channel> get_working_channel(const string&)’:
/root/grc/mod_proxy_grpc-master/src/grpc_proxy.cpp:31:43: error: ‘grpc_insecure_channel_create’ was not declared in this scope; did you mean ‘grpc_lame_client_channel_create’?
   31 |     std::shared_ptr<grpc_channel> channel(grpc_insecure_channel_create(host.c_str(), &args, NULL),
      |                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                           grpc_lame_client_channel_create
/root/grc/mod_proxy_grpc-master/src/grpc_proxy.cpp: In member function ‘bool grpc_proxy::send_initial_metadata(const std::unordered_multimap<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >&)’:
/root/grc/mod_proxy_grpc-master/src/grpc_proxy.cpp:135:11: error: ‘grpc_metadata’ {aka ‘struct grpc_metadata’} has no member named ‘flags’
  135 |         m.flags = 0;
      |           ^~~~~
make[2]: *** [CMakeFiles/mod_proxy_grpc.dir/build.make:90: CMakeFiles/mod_proxy_grpc.dir/src/grpc_proxy.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:845: CMakeFiles/mod_proxy_grpc.dir/all] Error 2

If I try to compile with newer GRPC libraries, it simply fails to perform cmake. Can it be fixed?

Thalhammer commented 3 weeks ago

Can it be fixed?

Likely yes. What likely happens is that ubuntu 22.04 is too new to compile grpc 1.34.0 and I haven't updated the project to work with newer grpc versions yet because I switched most of my stuff over to traefik. I'll take a look and push a fix once I updated it.

Thalhammer commented 3 weeks ago

Hi, I pushed a commit that fixes the compilation for ubuntu 22.04 (I tested using the ubuntu:22.04 docker container) on the branch upgrade-deps. Let me know if it fixes your issue. I haven't had time to verify it still works correctly yet though (outside of not crashing apache2 on startup).

lokapal commented 3 weeks ago

At the very end of cmake:

``` [100%] Built target grpc-populate CMake Warning at build/_deps/grpc-src/third_party/abseil-cpp/CMakeLists.txt:82 (message): A future Abseil release will default ABSL_PROPAGATE_CXX_STD to ON for CMake 3.8 and up. We recommend enabling this option to ensure your project still builds correctly. -- -- 26.1.0 -- Checking for module 'libsystemd>=233' -- Found libsystemd, version 249 -- Found systemd via pkg-config. fatal: not a git repository (or any of the parent directories): .git -- Configuring done CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_absl_check" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_absl_log" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_algorithm" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_base" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_bind_front" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_bits" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_btree" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_cleanup" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_cord" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_core_headers" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_debugging" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_die_if_null" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_dynamic_annotations" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_flags" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_flat_hash_map" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_flat_hash_set" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_function_ref" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_hash" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_if_constexpr" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_layout" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_log_initialize" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_log_severity" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_memory" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_node_hash_map" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_node_hash_set" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_optional" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_span" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_status" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_statusor" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_strings" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_synchronization" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_time" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_type_traits" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_utility" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf-lite" which requires target "absl_variant" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_absl_check" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_absl_log" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_algorithm" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_base" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_bind_front" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_bits" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_btree" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_cleanup" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_cord" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_core_headers" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_debugging" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_die_if_null" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_dynamic_annotations" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_flags" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_flat_hash_map" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_flat_hash_set" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_function_ref" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_hash" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_if_constexpr" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_layout" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_log_initialize" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_log_severity" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_memory" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_node_hash_map" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_node_hash_set" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_optional" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_span" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_status" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_statusor" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_strings" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_synchronization" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_time" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_type_traits" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_utility" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotobuf" which requires target "absl_variant" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_absl_check" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_absl_log" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_algorithm" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_base" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_bind_front" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_bits" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_btree" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_cleanup" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_cord" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_core_headers" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_debugging" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_die_if_null" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_dynamic_annotations" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_flags" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_flat_hash_map" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_flat_hash_set" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_function_ref" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_hash" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_if_constexpr" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_layout" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_log_initialize" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_log_severity" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_memory" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_node_hash_map" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_node_hash_set" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_optional" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_span" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_status" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_statusor" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_strings" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_synchronization" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_time" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_type_traits" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_utility" that is not in any export set. CMake Error: install(EXPORT "protobuf-targets" ...) includes target "libprotoc" which requires target "absl_variant" that is not in any export set. CMake Error: install(EXPORT "utf8_range-targets" ...) includes target "utf8_validity" which requires target "absl_strings" that is not in any export set. -- Generating done CMake Generate step failed. Build files cannot be regenerated correctly. ```

Are you sure, that bleeding edge libraries (that are not releases) are Ok?

``` Submodule 'third_party/abseil-cpp' (https://github.com/abseil/abseil-cpp.git) registered for path 'third_party/abseil-cpp' Submodule 'third_party/benchmark' (https://github.com/google/benchmark) registered for path 'third_party/benchmark' Submodule 'third_party/bloaty' (https://github.com/google/bloaty.git) registered for path 'third_party/bloaty' Submodule 'third_party/boringssl-with-bazel' (https://github.com/google/boringssl.git) registered for path 'third_party/boringssl-with-bazel' Submodule 'third_party/cares/cares' (https://github.com/c-ares/c-ares.git) registered for path 'third_party/cares/cares' Submodule 'third_party/envoy-api' (https://github.com/envoyproxy/data-plane-api.git) registered for path 'third_party/envoy-api' Submodule 'third_party/googleapis' (https://github.com/googleapis/googleapis.git) registered for path 'third_party/googleapis' Submodule 'third_party/googletest' (https://github.com/google/googletest.git) registered for path 'third_party/googletest' Submodule 'third_party/opencensus-proto' (https://github.com/census-instrumentation/opencensus-proto.git) registered for path 'third_party/opencensus-proto' Submodule 'third_party/opentelemetry' (https://github.com/open-telemetry/opentelemetry-proto.git) registered for path 'third_party/opentelemetry' Submodule 'third_party/opentelemetry-cpp' (https://github.com/open-telemetry/opentelemetry-cpp) registered for path 'third_party/opentelemetry-cpp' Submodule 'third_party/protobuf' (https://github.com/protocolbuffers/protobuf.git) registered for path 'third_party/protobuf' Submodule 'third_party/protoc-gen-validate' (https://github.com/envoyproxy/protoc-gen-validate.git) registered for path 'third_party/protoc-gen-validate' Submodule 'third_party/re2' (https://github.com/google/re2.git) registered for path 'third_party/re2' Submodule 'third_party/xds' (https://github.com/cncf/xds.git) registered for path 'third_party/xds' Submodule 'third_party/zlib' (https://github.com/madler/zlib) registered for path 'third_party/zlib' ```
Thalhammer commented 2 weeks ago

At the very end of cmake:

Did you make sure to remove and reconfigure the build folder ? The error you have there is the same I got when I still had disabled the grpc install targets, which are now enabled/default.

Are you sure, that bleeding edge libraries (that are not releases) are Ok?

It is using grpc version 1.64.2, which while being very recent is a stable release. You should be able to drop it to an older version like 1.5x or something like that, but I wouldn't recommend it in order to get the latest bugfixes/improvements done to upstream grpc. If you refer to the submodules, those are imported by grpc itself and are usually pinned to a specific release commit thats compatible with the grpc version being used.

You should alternatively be able to build the code against the grpc builds provided by ubuntu/apt if you remove the fetchcontent parts and replace them with a find_package. I am unsure why I opted to build grpc from source back then, probably just force of habit and to allow for (mostly) static builds, as the apt packages only include shared objects.