[PATCH] D85715: [clangd] Attempt to allow gRPC & Proobuf static linking
Kirill Bobyrev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 11 04:16:45 PDT 2020
kbobyrev added a comment.
When I manually link `/usr/lib/x86_64-linux-gnu/libgrpc++_reflection.a` to clangdRemoteServer on Linux the following error persists:
[3/6] Linking CXX executable bin/clangd
FAILED: bin/clangd
: && /usr/bin/clang++ -gmlt -O1 -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -Wno-nested-anon-types -O3 -fuse-ld=lld -Wl,--color-diagnostics -Wl,-allow-shlib-undefined -Wl,-O3 -Wl,--gc-sections tools/clang/tools/extra/clangd/refactor/tweaks/CMakeFiles/obj.clangDaemonTweaks.dir/AddUsing.cpp.o tools/clang/tools/extra/clangd/refactor/tweaks/CMakeFiles/obj.clangDaemonTweaks.dir/AnnotateHighlightings.cpp.o tools/clang/tools/extra/clangd/refactor/tweaks/CMakeFiles/obj.clangDaemonTweaks.dir/DumpAST.cpp.o tools/clang/tools/extra/clangd/refactor/tweaks/CMakeFiles/obj.clangDaemonTweaks.dir/DefineInline.cpp.o tools/clang/tools/extra/clangd/refactor/tweaks/CMakeFiles/obj.clangDaemonTweaks.dir/DefineOutline.cpp.o tools/clang/tools/extra/clangd/refactor/tweaks/CMakeFiles/obj.clangDaemonTweaks.dir/ExpandAutoType.cpp.o tools/clang/tools/extra/clangd/refactor/tweaks/CMakeFiles/obj.clangDaemonTweaks.dir/ExpandMacro.cpp.o tools/clang/tools/extra/clangd/refactor/tweaks/CMakeFiles/obj.clangDaemonTweaks.dir/ExtractFunction.cpp.o tools/clang/tools/extra/clangd/refactor/tweaks/CMakeFiles/obj.clangDaemonTweaks.dir/ExtractVariable.cpp.o tools/clang/tools/extra/clangd/refactor/tweaks/CMakeFiles/obj.clangDaemonTweaks.dir/ObjCLocalizeStringLiteral.cpp.o tools/clang/tools/extra/clangd/refactor/tweaks/CMakeFiles/obj.clangDaemonTweaks.dir/RawStringLiteral.cpp.o tools/clang/tools/extra/clangd/refactor/tweaks/CMakeFiles/obj.clangDaemonTweaks.dir/RemoveUsingNamespace.cpp.o tools/clang/tools/extra/clangd/refactor/tweaks/CMakeFiles/obj.clangDaemonTweaks.dir/SwapIfBranches.cpp.o tools/clang/tools/extra/clangd/tool/CMakeFiles/clangd.dir/ClangdMain.cpp.o -o bin/clangd -Wl,-rpath,"\$ORIGIN/../lib" lib/libLLVMSupport.a lib/libLLVMAArch64Info.a lib/libLLVMAMDGPUInfo.a lib/libLLVMARMInfo.a lib/libLLVMAVRInfo.a lib/libLLVMBPFInfo.a lib/libLLVMHexagonInfo.a lib/libLLVMLanaiInfo.a lib/libLLVMMipsInfo.a lib/libLLVMMSP430Info.a lib/libLLVMNVPTXInfo.a lib/libLLVMPowerPCInfo.a lib/libLLVMRISCVInfo.a lib/libLLVMSparcInfo.a lib/libLLVMSystemZInfo.a lib/libLLVMWebAssemblyInfo.a lib/libLLVMX86Info.a lib/libLLVMXCoreInfo.a lib/libLLVMFrontendOpenMP.a lib/libLLVMOption.a -lpthread lib/libclangAST.a lib/libclangBasic.a lib/libclangFormat.a lib/libclangFrontend.a lib/libclangLex.a lib/libclangSema.a lib/libclangTooling.a lib/libclangToolingCore.a lib/libclangToolingRefactoring.a lib/libclangToolingSyntax.a lib/libclangdRemoteIndex.a lib/libclangTidy.a lib/libclangDaemon.a lib/libclangdSupport.a lib/libclangdRemoteMarshalling.a lib/libclangDaemon.a lib/libclangToolingSyntax.a lib/libclangTidyAndroidModule.a lib/libclangTidyAbseilModule.a lib/libclangTidyBoostModule.a lib/libclangTidyCERTModule.a lib/libclangTidyDarwinModule.a lib/libclangTidyFuchsiaModule.a lib/libclangTidyHICPPModule.a lib/libclangTidyBugproneModule.a lib/libclangTidyCppCoreGuidelinesModule.a lib/libclangTidyGoogleModule.a lib/libclangTidyLinuxKernelModule.a lib/libclangTidyLLVMModule.a lib/libclangTidyLLVMLibcModule.a lib/libclangTidyMiscModule.a lib/libclangTidyModernizeModule.a lib/libclangTidyObjCModule.a lib/libclangTidyOpenMPModule.a lib/libclangTidyPerformanceModule.a lib/libclangTidyPortabilityModule.a lib/libclangTidyReadabilityModule.a lib/libclangTidyZirconModule.a lib/libclangTidyMPIModule.a lib/libclangTidyUtils.a lib/libclangTidy.a lib/libclangTooling.a lib/libclangStaticAnalyzerFrontend.a lib/libclangStaticAnalyzerCheckers.a lib/libclangStaticAnalyzerCore.a lib/libclangCrossTU.a lib/libclangTransformer.a lib/libclangToolingRefactoring.a lib/libclangIndex.a lib/libclangFormat.a lib/libclangToolingInclusions.a lib/libclangFrontend.a lib/libclangDriver.a lib/libclangParse.a lib/libclangToolingCore.a lib/libclangSerialization.a lib/libclangSema.a lib/libclangEdit.a lib/libclangAnalysis.a lib/libclangRewrite.a lib/libclangASTMatchers.a lib/libclangAST.a lib/libclangLex.a lib/libclangBasic.a lib/libclangdSupport.a lib/libRemoteIndexProtos.a lib/libLLVMAArch64Info.a lib/libLLVMAMDGPUInfo.a lib/libLLVMARMInfo.a lib/libLLVMAVRInfo.a lib/libLLVMBPFInfo.a lib/libLLVMHexagonInfo.a lib/libLLVMLanaiInfo.a lib/libLLVMMipsInfo.a lib/libLLVMMSP430Info.a lib/libLLVMNVPTXInfo.a lib/libLLVMPowerPCInfo.a lib/libLLVMRISCVInfo.a lib/libLLVMSparcInfo.a lib/libLLVMSystemZInfo.a lib/libLLVMWebAssemblyInfo.a lib/libLLVMX86Info.a lib/libLLVMXCoreInfo.a lib/libLLVMFrontendOpenMP.a lib/libLLVMTransformUtils.a lib/libLLVMAnalysis.a lib/libLLVMProfileData.a lib/libLLVMObject.a lib/libLLVMBitReader.a lib/libLLVMCore.a lib/libLLVMRemarks.a lib/libLLVMBitstreamReader.a lib/libLLVMMCParser.a lib/libLLVMMC.a lib/libLLVMDebugInfoCodeView.a lib/libLLVMDebugInfoMSF.a lib/libLLVMTextAPI.a lib/libLLVMBinaryFormat.a lib/libLLVMOption.a lib/libLLVMSupport.a -lz -lrt -ldl -ltinfo -lpthread -lm lib/libLLVMDemangle.a /usr/lib/x86_64-linux-gnu/libprotobuf.a /usr/lib/x86_64-linux-gnu/libgrpc++.a && :
ld.lld: error: undefined symbol: grpc_insecure_channel_create
>>> referenced by insecure_credentials.o:(.text+0x1BC) in archive /usr/lib/x86_64-linux-gnu/libgrpc++.a
>>> referenced by insecure_credentials.o:(.text+0x30F) in archive /usr/lib/x86_64-linux-gnu/libgrpc++.a
ld.lld: error: undefined symbol: grpc_census_call_set_context
>>> referenced by channel_cc.o:(grpc_impl::Channel::CreateCallInternal(grpc::internal::RpcMethod const&, grpc_impl::ClientContext*, grpc_impl::CompletionQueue*, unsigned long)) in archive /usr/lib/x86_64-linux-gnu/libgrpc++.a
ld.lld: error: undefined symbol: grpc_init
>>> referenced by channel_cc.o:(grpc::internal::GrpcLibrary::init()) in archive /usr/lib/x86_64-linux-gnu/libgrpc++.a
>>> referenced by channel_cc.o:(grpc::GrpcLibraryCodegen::GrpcLibraryCodegen(bool)) in archive /usr/lib/x86_64-linux-gnu/libgrpc++.a
>>> referenced by core_codegen.o:(grpc::CoreCodegen::grpc_init()) in archive /usr/lib/x86_64-linux-gnu/libgrpc++.a
>>> referenced by channel.o:(grpc_channel_create(char const*, grpc_channel_args const*, grpc_channel_stack_type, grpc_transport*, grpc_resource_user*)) in archive /usr/lib/x86_64-linux-gnu/libgrpc++.a
ld.lld: error: undefined symbol: grpc_shutdown
>>> referenced by channel_cc.o:(grpc::internal::GrpcLibrary::shutdown()) in archive /usr/lib/x86_64-linux-gnu/libgrpc++.a
>>> referenced by channel_cc.o:(grpc::GrpcLibraryCodegen::~GrpcLibraryCodegen()) in archive /usr/lib/x86_64-linux-gnu/libgrpc++.a
>>> referenced by core_codegen.o:(grpc::CoreCodegen::grpc_shutdown()) in archive /usr/lib/x86_64-linux-gnu/libgrpc++.a
>>> referenced by channel.o:(.text+0x2E1) in archive /usr/lib/x86_64-linux-gnu/libgrpc++.a
>>> referenced by channel.o:(grpc_channel_create(char const*, grpc_channel_args const*, grpc_channel_stack_type, grpc_transport*, grpc_resource_user*)) in archive /usr/lib/x86_64-linux-gnu/libgrpc++.a
>>> referenced by channel.o:(grpc_channel_create(char const*, grpc_channel_args const*, grpc_channel_stack_type, grpc_transport*, grpc_resource_user*)) in archive /usr/lib/x86_64-linux-gnu/libgrpc++.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[5/6] Linking CXX executable tools/clang/tools/extra/clangd/unittests/ClangdTests
ninja: build stopped: subcommand failed.
When I link `libgrpc.a` the following happens:
[2/4] Linking CXX executable bin/clangd-index-server
FAILED: bin/clangd-index-server
: && /usr/bin/clang++ -gmlt -O1 -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -W
implicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -Wno-nested-anon-type
s -O3 -fuse-ld=lld -Wl,--color-diagnostics -Wl,-allow-shlib-undefined -Wl,-O3 -Wl,--gc-sections tools/clang/tools/extra/clangd/index/remote/server/CMakeFiles/clangd-index-server.dir/Server.cpp.o -o bin/clangd-index-server -Wl,-rpath,"
\$ORIGIN/../lib" lib/libLLVMSupport.a -lpthread lib/libclangDaemon.a lib/libRemoteIndexProtos.a lib/libclangdRemoteMarshalling.a /usr/lib/x86_64-linux-gnu/libgrpc++.a /usr/lib/x86_64-linux-gnu/libgrpc.a lib/libclangDaemon.a lib/lib
clangTidyAndroidModule.a lib/libclangTidyAbseilModule.a lib/libclangTidyBoostModule.a lib/libclangTidyCERTModule.a lib/libclangTidyDarwinModule.a lib/libclangTidyFuchsiaModule.a lib/libclangTidyHICPPModule.a lib/libclangTidyBugproneM
odule.a lib/libclangTidyCppCoreGuidelinesModule.a lib/libclangTidyGoogleModule.a lib/libclangTidyLinuxKernelModule.a lib/libclangTidyLLVMModule.a lib/libclangTidyLLVMLibcModule.a lib/libclangTidyMiscModule.a lib/libclangTidyModernize
Module.a lib/libclangTidyObjCModule.a lib/libclangTidyOpenMPModule.a lib/libclangTidyPerformanceModule.a lib/libclangTidyPortabilityModule.a lib/libclangTidyReadabilityModule.a lib/libclangTidyZirconModule.a lib/libclangTidyMPIModule
.a lib/libclangTidyUtils.a lib/libclangTidy.a lib/libclangStaticAnalyzerFrontend.a lib/libclangTransformer.a lib/libclangStaticAnalyzerCheckers.a lib/libclangStaticAnalyzerCore.a lib/libclangCrossTU.a lib/libclangTooling.a lib/libc
langToolingRefactoring.a lib/libclangIndex.a lib/libclangFormat.a lib/libclangToolingInclusions.a lib/libclangToolingSyntax.a lib/libclangFrontend.a lib/libclangDriver.a lib/libclangSerialization.a lib/libclangParse.a lib/libclangS
ema.a lib/libclangAnalysis.a lib/libclangASTMatchers.a lib/libclangEdit.a lib/libclangToolingCore.a lib/libclangAST.a lib/libclangRewrite.a lib/libclangLex.a lib/libclangBasic.a lib/libRemoteIndexProtos.a /usr/lib/x86_64-linux-gnu
/libgrpc++.a lib/libclangdSupport.a lib/libLLVMAArch64Info.a lib/libLLVMAMDGPUInfo.a lib/libLLVMARMInfo.a lib/libLLVMAVRInfo.a lib/libLLVMBPFInfo.a lib/libLLVMHexagonInfo.a lib/libLLVMLanaiInfo.a lib/libLLVMMipsInfo.a lib/libLLVMM
SP430Info.a lib/libLLVMNVPTXInfo.a lib/libLLVMPowerPCInfo.a lib/libLLVMRISCVInfo.a lib/libLLVMSparcInfo.a lib/libLLVMSystemZInfo.a lib/libLLVMWebAssemblyInfo.a lib/libLLVMX86Info.a lib/libLLVMXCoreInfo.a lib/libLLVMFrontendOpenMP.a
lib/libLLVMTransformUtils.a lib/libLLVMAnalysis.a lib/libLLVMProfileData.a lib/libLLVMObject.a lib/libLLVMBitReader.a lib/libLLVMCore.a lib/libLLVMRemarks.a lib/libLLVMBitstreamReader.a lib/libLLVMMCParser.a lib/libLLVMMC.a lib/
libLLVMDebugInfoCodeView.a lib/libLLVMDebugInfoMSF.a lib/libLLVMTextAPI.a lib/libLLVMBinaryFormat.a lib/libLLVMOption.a lib/libLLVMSupport.a -lz -lrt -ldl -ltinfo -lpthread -lm lib/libLLVMDemangle.a /usr/lib/x86_64-linux-gnu/li
bprotobuf.a && :
ld.lld: error: undefined symbol: RSA_free
>>> referenced by json_token.o:(grpc_auth_json_key_destruct(grpc_auth_json_key*)) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
ld.lld: error: undefined symbol: BIO_s_mem
>>> referenced by json_token.o:(grpc_auth_json_key_create_from_json(grpc_json const*)) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
>>> referenced by aes_gcm.o:(.text+0x15F) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
>>> referenced by ssl_transport_security.o:(.text+0x12A1) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
ld.lld: error: undefined symbol: BIO_new
>>> referenced by json_token.o:(grpc_auth_json_key_create_from_json(grpc_json const*)) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
>>> referenced by aes_gcm.o:(.text+0x167) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
>>> referenced by ssl_transport_security.o:(.text+0x12AD) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
ld.lld: error: undefined symbol: BIO_puts
>>> referenced by json_token.o:(grpc_auth_json_key_create_from_json(grpc_json const*)) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
ld.lld: error: undefined symbol: BIO_free
>>> referenced by json_token.o:(grpc_auth_json_key_create_from_json(grpc_json const*)) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
>>> referenced by json_token.o:(grpc_auth_json_key_create_from_json(grpc_json const*)) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
>>> referenced by ssl_transport_security.o:(.text+0x1E7) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
>>> referenced by ssl_transport_security.o:(.text+0x342) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
>>> referenced by ssl_transport_security.o:(.text+0x38A) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
>>> referenced by ssl_transport_security.o:(.text+0xB46) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
>>> referenced by ssl_transport_security.o:(.text+0xE3D) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
>>> referenced by ssl_transport_security.o:(.text+0xEBE) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
>>> referenced by ssl_transport_security.o:(.text+0xF6C) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
>>> referenced by ssl_transport_security.o:(.text+0xFD4) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
>>> referenced 4 more times
ld.lld: error: undefined symbol: PEM_read_bio_RSAPrivateKey
>>> referenced by json_token.o:(grpc_auth_json_key_create_from_json(grpc_json const*)) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
ld.lld: error: undefined symbol: EVP_PKEY_new
>>> referenced by json_token.o:(compute_and_encode_signature(grpc_auth_json_key const*, char const*, char const*)) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
ld.lld: error: undefined symbol: EVP_MD_CTX_new
>>> referenced by json_token.o:(compute_and_encode_signature(grpc_auth_json_key const*, char const*, char const*)) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
ld.lld: error: undefined symbol: EVP_PKEY_set1_RSA
>>> referenced by json_token.o:(compute_and_encode_signature(grpc_auth_json_key const*, char const*, char const*)) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
ld.lld: error: undefined symbol: EVP_DigestSignInit
>>> referenced by json_token.o:(compute_and_encode_signature(grpc_auth_json_key const*, char const*, char const*)) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
ld.lld: error: undefined symbol: EVP_PKEY_free
>>> referenced by json_token.o:(compute_and_encode_signature(grpc_auth_json_key const*, char const*, char const*)) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
>>> referenced by json_token.o:(compute_and_encode_signature(grpc_auth_json_key const*, char const*, char const*)) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
>>> referenced by ssl_transport_security.o:(.text+0xEB0) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
>>> referenced by ssl_transport_security.o:(.text+0xFCC) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
ld.lld: error: undefined symbol: EVP_MD_CTX_free
>>> referenced by json_token.o:(compute_and_encode_signature(grpc_auth_json_key const*, char const*, char const*)) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
>>> referenced by json_token.o:(compute_and_encode_signature(grpc_auth_json_key const*, char const*, char const*)) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
ld.lld: error: undefined symbol: EVP_DigestUpdate
>>> referenced by json_token.o:(compute_and_encode_signature(grpc_auth_json_key const*, char const*, char const*)) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
ld.lld: error: undefined symbol: EVP_DigestSignFinal
>>> referenced by json_token.o:(compute_and_encode_signature(grpc_auth_json_key const*, char const*, char const*)) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
>>> referenced by json_token.o:(compute_and_encode_signature(grpc_auth_json_key const*, char const*, char const*)) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
ld.lld: error: undefined symbol: EVP_sha256
>>> referenced by json_token.o:(openssl_digest_from_algorithm(char const*)) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
>>> referenced by aes_gcm.o:(.text+0x5A) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
ld.lld: error: undefined symbol: HMAC_CTX_new
>>> referenced by aes_gcm.o:(.text+0x49) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
ld.lld: error: undefined symbol: HMAC_Init_ex
>>> referenced by aes_gcm.o:(.text+0x70) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
ld.lld: error: undefined symbol: HMAC_Update
>>> referenced by aes_gcm.o:(.text+0x84) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
>>> referenced by aes_gcm.o:(.text+0x9A) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
ld.lld: error: undefined symbol: HMAC_Final
>>> referenced by aes_gcm.o:(.text+0xAD) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
ld.lld: error: undefined symbol: HMAC_CTX_free
>>> referenced by aes_gcm.o:(.text+0xB9) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
>>> referenced by aes_gcm.o:(.text+0xD4) in archive /usr/lib/x86_64-linux-gnu/libgrpc.a
ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
So I suspect once we deal with the libgrpc++.a errors from above we'd have to statically link LibSSL too :(
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85715/new/
https://reviews.llvm.org/D85715
More information about the llvm-commits
mailing list