We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
我在按照文档https://github.com/trpc-group/trpc-cpp/blob/main/docs/zh/bazel_or_cmake.md 使用CMake与Ninja,将tRPC以外部库形式源码引入项目时报错:
CMake Error: Running '/usr/local/bin/ninja' '-C' '/data/workspace/bld' '-t' 'recompact' failed with: ninja: error: build.ninja:11818: multiple rules generate ../cmake-third-party/trpc-cpp/trpc/proto/trpc_options.pb.cc
之后我检查了build.ninja,发现其中有两处生成trpc_options.pb.cc与trpc_cpp_options.pb.cc的命令(以trpc_cpp_options.pb.cc为例):
build.ninja
# 4902行处 # Custom command for ../cmake-third-party/trpc-cpp/trpc/tools/comm/trpc_cpp_options.pb.cc build ../cmake-third-party/trpc-cpp/trpc/tools/comm/trpc_cpp_options.pb.cc ../cmake-third-party/trpc-cpp/trpc/tools/comm/trpc_cpp_options.pb.h | ${cmake_ninja_workdir}../cmake-third-party/trpc-cpp/trpc/tools/comm/trpc_cpp_options.pb.cc ${cmake_ninja_workdir}../cmake-third-party/trpc-cpp/trpc/tools/comm/trpc_cpp_options.pb.h: CUSTOM_COMMAND ../cmake-third-party/trpc-cpp/trpc/tools/comm/trpc_cpp_options.proto || _deps/trpc-cpp-build/cmake_third_party/gflags/libgflags_nothreads.a _deps/trpc-cpp-build/trpc/tools/trpc_cpp_plugin/bin/trpc_cpp_plugin bin/protoc lib/libflatbuffers.a lib/libgmock.a lib/libgtest.a lib/libjsoncpp.a lib/liblz4.a lib/libnghttp2_static.a lib/libprotobuf.a lib/libprotoc.a lib/libsnappy.a lib/libyaml-cpp.a COMMAND = cd /data/workspace/cmake-third-party/trpc-cpp && /data/workspace/bld/bin/protoc -I /data/workspace/cmake-third-party/trpc-cpp -I /data/workspace/cmake-third-party/trpc-cpp/cmake_third_party/protobuf/src --cpp_out=. trpc/tools/comm/trpc_cpp_options.proto DESC = Generating ../../../cmake-third-party/trpc-cpp/trpc/tools/comm/trpc_cpp_options.pb.cc, ../../../cmake-third-party/trpc-cpp/trpc/tools/comm/trpc_cpp_options.pb.h restat = 1 # 11821行处 # Custom command for ../cmake-third-party/trpc-cpp/trpc/tools/comm/trpc_cpp_options.pb.cc build ../cmake-third-party/trpc-cpp/trpc/tools/comm/trpc_cpp_options.pb.cc ../cmake-third-party/trpc-cpp/trpc/tools/comm/trpc_cpp_options.pb.h | ${cmake_ninja_workdir}../cmake-third-party/trpc-cpp/trpc/tools/comm/trpc_cpp_options.pb.cc ${cmake_ninja_workdir}../cmake-third-party/trpc-cpp/trpc/tools/comm/trpc_cpp_options.pb.h: CUSTOM_COMMAND ../cmake-third-party/trpc-cpp/trpc/tools/comm/trpc_cpp_options.proto || bin/protoc lib/libprotobuf.a lib/libprotoc.a COMMAND = cd /data/workspace/cmake-third-party/trpc-cpp && /data/workspace/bld/bin/protoc -I /data/workspace/cmake-third-party/trpc-cpp -I /data/workspace/cmake-third-party/trpc-cpp/cmake_third_party/protobuf/src --cpp_out=. trpc/tools/comm/trpc_cpp_options.proto DESC = Generating ../../../../../../cmake-third-party/trpc-cpp/trpc/tools/comm/trpc_cpp_options.pb.cc, ../../../../../../cmake-third-party/trpc-cpp/trpc/tools/comm/trpc_cpp_options.pb.h restat = 1
经检查貌似是这两个文件同时被cmake_object_order_depends_target_trpc与cmake_object_order_depends_target_trpc_cpp_plugin依赖导致的。ninja.build中的依赖关系如下:
cmake_object_order_depends_target_trpc
cmake_object_order_depends_target_trpc_cpp_plugin
ninja.build
# Order-only phony target for trpc build cmake_object_order_depends_target_trpc: phony || ../cmake-third-party/trpc-cpp/trpc/codec/trpc/trpc.pb.cc ../cmake-third-party/trpc-cpp/trpc/codec/trpc/trpc.pb.h ../cmake-third-party/trpc-cpp/trpc/proto/trpc.pb.cc ../cmake-third-party/trpc-cpp/trpc/proto/trpc.pb.h ../cmake-third-party/trpc-cpp/trpc/proto/trpc_options.pb.cc ../cmake-third-party/trpc-cpp/trpc/proto/trpc_options.pb.h ../cmake-third-party/trpc-cpp/trpc/tools/comm/trpc_cpp_options.pb.cc ../cmake-third-party/trpc-cpp/trpc/tools/comm/trpc_cpp_options.pb.h ../cmake-third-party/trpc-cpp/trpc/trpc.pb.cc ../cmake-third-party/trpc-cpp/trpc/trpc.pb.h _deps/trpc-cpp-build/trpc/tools/trpc_cpp_plugin/bin/trpc_cpp_plugin bin/protoc cmake_object_order_depends_target_flatbuffers cmake_object_order_depends_target_gflags_nothreads_static cmake_object_order_depends_target_gmock cmake_object_order_depends_target_gtest cmake_object_order_depends_target_jsoncpp_lib cmake_object_order_depends_target_libprotobuf cmake_object_order_depends_target_libprotoc cmake_object_order_depends_target_lz4_static cmake_object_order_depends_target_nghttp2_static cmake_object_order_depends_target_snappy cmake_object_order_depends_target_yaml-cpp # Order-only phony target for trpc_cpp_plugin build cmake_object_order_depends_target_trpc_cpp_plugin: phony || ../cmake-third-party/trpc-cpp/trpc/proto/trpc_options.pb.cc ../cmake-third-party/trpc-cpp/trpc/proto/trpc_options.pb.h ../cmake-third-party/trpc-cpp/trpc/tools/comm/trpc_cpp_options.pb.cc ../cmake-third-party/trpc-cpp/trpc/tools/comm/trpc_cpp_options.pb.h bin/protoc cmake_object_order_depends_target_libprotobuf cmake_object_order_depends_target_libprotoc
使用CMake+Make就不会有上述问题。
CMake版本3.22.1 Ninja版本1.12.1 Make版本4.3
The text was updated successfully, but these errors were encountered:
No branches or pull requests
我在按照文档https://github.com/trpc-group/trpc-cpp/blob/main/docs/zh/bazel_or_cmake.md
使用CMake与Ninja,将tRPC以外部库形式源码引入项目时报错:
之后我检查了
build.ninja
,发现其中有两处生成trpc_options.pb.cc与trpc_cpp_options.pb.cc的命令(以trpc_cpp_options.pb.cc为例):经检查貌似是这两个文件同时被
cmake_object_order_depends_target_trpc
与cmake_object_order_depends_target_trpc_cpp_plugin
依赖导致的。ninja.build
中的依赖关系如下:使用CMake+Make就不会有上述问题。
CMake版本3.22.1
Ninja版本1.12.1
Make版本4.3
The text was updated successfully, but these errors were encountered: