Open cangfengzhs opened 4 months ago
:~/.xmake/packages/g/grpc/v1.62.1/398396d49c844de9b48150a93e269b5a/lib$ ls -hl
total 65M
drwxrwxr-x 3 hs.zhang hs.zhang 18 Jul 3 18:50 cmake
-rw-r--r-- 1 hs.zhang hs.zhang 12K Jul 3 18:48 libaddress_sorting.a
-rw-r--r-- 1 hs.zhang hs.zhang 228K Jul 3 18:48 libgpr.a
-rw-r--r-- 1 hs.zhang hs.zhang 2.5M Jul 3 18:50 libgrpc++.a
-rw-r--r-- 1 hs.zhang hs.zhang 30M Jul 3 18:50 libgrpc.a
-rw-r--r-- 1 hs.zhang hs.zhang 39K Jul 3 18:50 libgrpc++_alts.a
-rw-r--r-- 1 hs.zhang hs.zhang 9.1M Jul 3 18:49 libgrpc_authorization_provider.a
-rw-r--r-- 1 hs.zhang hs.zhang 1.2K Jul 3 18:50 libgrpc++_error_details.a
-rw-r--r-- 1 hs.zhang hs.zhang 1.2M Jul 3 18:48 libgrpc_plugin_support.a
-rw-r--r-- 1 hs.zhang hs.zhang 923K Jul 3 18:50 libgrpcpp_channelz.a
-rw-r--r-- 1 hs.zhang hs.zhang 1.3M Jul 3 18:50 libgrpc++_reflection.a
-rw-r--r-- 1 hs.zhang hs.zhang 1.4M Jul 3 18:49 libgrpc++_unsecure.a
-rw-r--r-- 1 hs.zhang hs.zhang 19M Jul 3 18:49 libgrpc_unsecure.a
-rw-r--r-- 1 hs.zhang hs.zhang 3.0K Jul 3 18:48 libupb_base_lib.a
-rw-r--r-- 1 hs.zhang hs.zhang 315K Jul 3 18:48 libupb_json_lib.a
-rw-r--r-- 1 hs.zhang hs.zhang 5.8K Jul 3 18:48 libupb_mem_lib.a
-rw-r--r-- 1 hs.zhang hs.zhang 41K Jul 3 18:48 libupb_message_lib.a
-rw-r--r-- 1 hs.zhang hs.zhang 255K Jul 3 18:48 libupb_textformat_lib.a
-rw-r--r-- 1 hs.zhang hs.zhang 3.8K Jul 3 18:48 libutf8_range_lib.a
drwxrwxr-x 2 hs.zhang hs.zhang 102 Jul 3 18:50 pkgconfig
没有libupb.a,只有一堆零散的upb的lib
Bot detected the issue body's language is not English, translate it automatically.
Xmake version
2.9.3
ubuntu2004
Added the dependency of grpc, and the compilation is normal, but the link reports a large number of upb* undefined
Compile normally
set_languages("c11", "c++20") add_requires("cmake",{system=false}) add_requires("folly",{system=false},{configs={language="c++20"}}) add_requires("glog",{system=false}) add_requires("rocksdb",{system=false}) add_requires("protobuf-cpp",{system=false}) add_requires("grpc",{system=false,configs={language="c++20"}}) add_rules("mode.release", "mode.debug") add_includedirs("src") includes("src")
target("service") set_kind("binary") add_packages("protobuf-cpp",{public=true}) add_packages("grpc",{public=true}) add_rules("protobuf.cpp") add_files("service.cpp") add_files("main.cpp") add_files("../proto/service.proto", {proto_public = true, proto_rootdir="src", proto_grpc_cpp_plugin = true})
odeRequest(grpc::ByteBuffer const&, std::__cxx11::basic_string<char, std::char_traitsupb_alloc_global' /usr/local/bin/ld: default_health_check_service.cc:(.text+0x342): undefined reference to
upb_Arena_Init'
/usr/local/bin/ld: default_health_check_service.cc:(.text+0x3fe): undefined reference to upb_Arena_Free' /usr/local/bin/ld: default_health_check_service.cc:(.text+0x450): undefined reference to
_upb_Arena_SlowMalloc'
/usr/local/bin/ld: /home/hs.zhang/.xmake/packages/g/grpc/v1.62.1/398396d49c844de9b48150a93e269b5a/lib/libgrpc++.a(default_health_check_service.cc.o): in function `grpc:: DefaultHealthCheckService::HealthCheckServiceImpl::EncodeResponse(grpc::DefaultHealthCheckService::ServingStatus, grpc::ByteBuffer)':
default_health_check_service.cc:(.text+0x4d1): undefined reference to upb_alloc_global' /usr/local/bin/ld: default_health_check_service.cc:(.text+0x4e6): undefined reference to
upb_Arena_Init'
/usr/local/bin/ld: default_health_check_service.cc:(.text+0x5da): undefined reference to upb_Arena_Free' /usr/local/bin/ld: default_health_check_service.cc:(.text+0x634): undefined reference to
_upb_Arena_SlowMalloc'
/usr/local/bin/ld: /home/hs.zhang/.xmake/packages/g/grpc/v1.62.1/398396d49c844de9b48150a93e269b5a/lib/libgrpc++.a(default_health
Xmake 版本
2.9.3
操作系统版本和架构
ubuntu2004
描述问题
添加了grpc的依赖,编译正常,但是链接时报了大量的 upb*未定义
期待的结果
正常编译
工程配置
set_languages("c11", "c++20") add_requires("cmake",{system=false}) add_requires("folly",{system=false},{configs={language="c++20"}}) add_requires("glog",{system=false}) add_requires("rocksdb",{system=false}) add_requires("protobuf-cpp",{system=false}) add_requires("grpc",{system=false,configs={language="c++20"}}) add_rules("mode.release", "mode.debug") add_includedirs("src") includes("src")
target("service") set_kind("binary") add_packages("protobuf-cpp",{public=true}) add_packages("grpc",{public=true}) add_rules("protobuf.cpp") add_files("service.cpp") add_files("main.cpp") add_files("../proto/service.proto", {proto_public = true, proto_rootdir="src", proto_grpc_cpp_plugin = true})
附加信息和错误日志
odeRequest(grpc::ByteBuffer const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator >)':
default_health_check_service.cc:(.text+0x339): undefined reference to
upb_alloc_global' /usr/local/bin/ld: default_health_check_service.cc:(.text+0x342): undefined reference to
upb_Arena_Init' /usr/local/bin/ld: default_health_check_service.cc:(.text+0x3fe): undefined reference toupb_Arena_Free' /usr/local/bin/ld: default_health_check_service.cc:(.text+0x450): undefined reference to
_upb_Arena_SlowMalloc' /usr/local/bin/ld: /home/hs.zhang/.xmake/packages/g/grpc/v1.62.1/398396d49c844de9b48150a93e269b5a/lib/libgrpc++.a(default_health_check_service.cc.o): in function `grpc::DefaultHealthCheckService::HealthCheckServiceImpl::EncodeResponse(grpc::DefaultHealthCheckService::ServingStatus, grpc::ByteBuffer)': default_health_check_service.cc:(.text+0x4d1): undefined reference toupb_alloc_global' /usr/local/bin/ld: default_health_check_service.cc:(.text+0x4e6): undefined reference to
upb_Arena_Init' /usr/local/bin/ld: default_health_check_service.cc:(.text+0x5da): undefined reference toupb_Arena_Free' /usr/local/bin/ld: default_health_check_service.cc:(.text+0x634): undefined reference to
_upb_Arena_SlowMalloc' /usr/local/bin/ld: /home/hs.zhang/.xmake/packages/g/grpc/v1.62.1/398396d49c844de9b48150a93e269b5a/lib/libgrpc++.a(default_health