-
Notifications
You must be signed in to change notification settings - Fork 82
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
Fails to compile on Arch with gcc-14.2 #166
Comments
When I tried to fix the issue, another problem with GoogleTest comes up. In file included from /home/zy/learning/my-trpc-cpp/cmake_third_party/gtest/googletest/src/gtest-all.cc:42:
/home/zy/learning/my-trpc-cpp/cmake_third_party/gtest/googletest/src/gtest-death-test.cc: In function ‘bool testing::internal::StackGrowsDown()’:
/home/zy/learning/my-trpc-cpp/cmake_third_party/gtest/googletest/src/gtest-death-test.cc:1301:24: error: ‘dummy’ may be used uninitialized [-Werror=maybe-uninitialized]
1301 | StackLowerThanAddress(&dummy, &result);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ It has been solved by google/googletest#3024, we only need to update GoogleTest to use version 1.11.0 or newer. |
When using cc_proto_library, bazel will use a specific version of protobuf to generate *.pb.h/.*pb.cc stub code. Starting from bazel-7, we can't change version of protobuf by simply declare a To resolve this problem, just downgrade bazel version to bazel-6. |
@weimch I'm not using Bazel, I'm using CMake. |
sor, thought you were the guy asking compile error in private. |
Already solved by @zhangyi1357 at #167. Thanks for contribution. |
What version of tRPC-Cpp are you using?
v1.2.0
What operating system and compiler are you using?
OS: Arch Linux on Windows 10 x86_64
Kernel: 5.15.133.1-microsoft-standard-WSL2
Compiler: g++ (GCC) 14.2.1 20240802
What did you do?
After cloning the project just run the following command under project root directory.
What did you expect to see?
No compilation errors.
What did you see instead?
Just show the core errors:
related issue: GenericStringRef::operator= does not compile Tencent/rapidjson#718. it was fixed 8 years ago, but not a new release has been published and trpc-cpp uses 8 years old [email protected] (the newest release, lmao) without the fixed.
/home/zy/learning/trpc-cpp/cmake_third_party/rapidjson/include/rapidjson/document.h: In member function ‘rapidjson::GenericStringRef<CharType>& rapidjson::GenericStringRef<CharType>::operator=(const rapidjson::GenericStringRef<CharType>&)’: /home/zy/learning/trpc-cpp/cmake_third_party/rapidjson/include/rapidjson/document.h:319:82: error: assignment of read-only member ‘rapidjson::GenericStringRef<CharType>::length’ 319 | GenericStringRef& operator=(const GenericStringRef& rhs) { s = rhs.s; length = rhs.length; } | ~~~~~~~^~~~~~~~~~~~
Full build log: build.log
How to fix
I'd like to fix above compilation problems.
For error 1, just do a patch on rapidjson like what has been done for spdlog.
For error 2, just do the following change:
diff --git a/trpc/config/trpc_conf_compatible.h b/trpc/config/trpc_conf_compatible.h index e1eb5b2..e9125c1 100644 --- a/trpc/config/trpc_conf_compatible.h +++ b/trpc/config/trpc_conf_compatible.h @@ -41,8 +41,8 @@ std::optional<T> LoadConfig(const std::string& plugin_name, const std::string& c const std::any& params = nullptr) { std::optional<T> ret; // Determine the type of support - if constexpr (std::negation_v<T, Json::Value> && std::negation_v<T, YAML::Node> && - std::negation_v<T, std::map<std::string, std::string> >) { + if constexpr (std::negation_v<std::is_same<T, Json::Value>> && std::negation_v<std::is_same<T, YAML::Node>> && + std::negation_v<std::is_same<T, std::map<std::string, std::string>>>) { TRPC_LOG_ERROR("Unknown type!"); return ret; }
The text was updated successfully, but these errors were encountered: