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
编译代码时链接Poco出现问题,平台 Arch linux, 使用vcpkg管理第三方库
Message
====================[ Build | TestCos | Debug ]================================= /home/cvrain/.local/share/JetBrains/Toolbox/apps/clion/bin/cmake/linux/x64/bin/cmake --build /mnt/Workspace/CLang/TestCos/cmake-build-debug --target TestCos -j 10 [1/1] Linking CXX executable TestCos FAILED: TestCos : && /usr/bin/clang++ -g CMakeFiles/TestCos.dir/src/main.cpp.o -o TestCos -L/mnt/Workspace/CLang/TestCos/libs/linux -Wl,-rpath,/mnt/Workspace/CLang/TestCos/libs/linux vcpkg_installed/x64-linux/debug/lib/libfmtd.a vcpkg_installed/x64-linux/debug/lib/libloguru.a vcpkg_installed/x64-linux/debug/lib/libgtest.a vcpkg_installed/x64-linux/debug/lib/manual-link/libgtest_main.a vcpkg_installed/x64-linux/debug/lib/libgmock.a vcpkg_installed/x64-linux/debug/lib/manual-link/libgmock_main.a vcpkg_installed/x64-linux/debug/lib/libssl.a vcpkg_installed/x64-linux/debug/lib/libcrypto.a vcpkg_installed/x64-linux/debug/lib/libPocoFoundationd.a vcpkg_installed/x64-linux/debug/lib/libPocoCryptod.a vcpkg_installed/x64-linux/debug/lib/libPocoXMLd.a vcpkg_installed/x64-linux/debug/lib/libPocoJSONd.a vcpkg_installed/x64-linux/debug/lib/libPocoUtild.a vcpkg_installed/x64-linux/debug/lib/libPocoNetd.a vcpkg_installed/x64-linux/debug/lib/libPocoNetSSLd.a -Wl,-Bstatic -lcossdk vcpkg_installed/x64-linux/debug/lib/libgmock.a vcpkg_installed/x64-linux/debug/lib/libgtest.a vcpkg_installed/x64-linux/debug/lib/libPocoCryptod.a -Wl,-Bdynamic vcpkg_installed/x64-linux/debug/lib/libssl.a vcpkg_installed/x64-linux/debug/lib/libcrypto.a vcpkg_installed/x64-linux/debug/lib/libPocoUtild.a vcpkg_installed/x64-linux/debug/lib/libPocoXMLd.a vcpkg_installed/x64-linux/debug/lib/libexpat.a -lm vcpkg_installed/x64-linux/debug/lib/libPocoJSONd.a vcpkg_installed/x64-linux/debug/lib/libPocoNetd.a vcpkg_installed/x64-linux/debug/lib/libPocoFoundationd.a vcpkg_installed/x64-linux/debug/lib/libpcre2-8.a vcpkg_installed/x64-linux/debug/lib/libz.a -lpthread -ldl -lrt && : /usr/bin/ld: /mnt/Workspace/CLang/TestCos/libs/linux/libcossdk.a(cos_api.cpp.o): in function `qcloud_cos::CosAPI::CosInit()': /mnt/Workspace/Program/cos-cpp-sdk-v5/src/cos_api.cpp:40:(.text+0x36d): undefined reference to `Poco::Net::HTTPSStreamFactory::registerFactory()' /usr/bin/ld: /mnt/Workspace/Program/cos-cpp-sdk-v5/src/cos_api.cpp:41:(.text+0x377): undefined reference to `Poco::Net::initializeSSL()' /usr/bin/ld: /mnt/Workspace/CLang/TestCos/libs/linux/libcossdk.a(cos_config.cpp.o): in function `qcloud_cos::CosConfig::InitConf(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': /mnt/Workspace/Program/cos-cpp-sdk-v5/src/cos_config.cpp:79:(.text+0x4c5): undefined reference to `Poco::JSON::Parser::Parser(Poco::SharedPtr<Poco::JSON::Handler, Poco::ReferenceCounter, Poco::ReleasePolicy<Poco::JSON::Handler> > const&, unsigned long)' /usr/bin/ld: /mnt/Workspace/CLang/TestCos/libs/linux/libcossdk.a(cos_config.cpp.o): in function `Poco::SharedPtr<Poco::JSON::Object, Poco::ReferenceCounter, Poco::ReleasePolicy<Poco::JSON::Object> > const& Poco::Dynamic::Var::extract<Poco::SharedPtr<Poco::JSON::Object, Poco::ReferenceCounter, Poco::ReleasePolicy<Poco::JSON::Object> > >() const': /mnt/Workspace/Program/cos-cpp-sdk-v5/third_party/include/Poco/Dynamic/Var.h:221:(.text._ZNK4Poco7Dynamic3Var7extractINS_9SharedPtrINS_4JSON6ObjectENS_16ReferenceCounterENS_13ReleasePolicyIS5_EEEEEERKT_v[_ZNK4Poco7Dynamic3Var7extractINS_9SharedPtrINS_4JSON6ObjectENS_16ReferenceCounterENS_13ReleasePolicyIS5_EEEEEERKT_v]+0x2ed): undefined reference to `Poco::format(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Any const&, Poco::Any const&)' /usr/bin/ld: /mnt/Workspace/CLang/TestCos/libs/linux/libcossdk.a(cos_config.cpp.o): in function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const& Poco::Dynamic::Var::extract<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >() const': /mnt/Workspace/Program/cos-cpp-sdk-v5/third_party/include/Poco/Dynamic/Var.h:221:(.text._ZNK4Poco7Dynamic3Var7extractINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEERKT_v[_ZNK4Poco7Dynamic3Var7extractINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEERKT_v]+0x2ed): undefined reference to `Poco::format(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Any const&, Poco::Any const&)' /usr/bin/ld: /mnt/Workspace/CLang/TestCos/libs/linux/libcossdk.a(cos_config.cpp.o): in function `unsigned long const& Poco::Dynamic::Var::extract<unsigned long>() const': /mnt/Workspace/Program/cos-cpp-sdk-v5/third_party/include/Poco/Dynamic/Var.h:221:(.text._ZNK4Poco7Dynamic3Var7extractImEERKT_v[_ZNK4Poco7Dynamic3Var7extractImEERKT_v]+0x2ed): undefined reference to `Poco::format(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Any const&, Poco::Any const&)' /usr/bin/ld: /mnt/Workspace/CLang/TestCos/libs/linux/libcossdk.a(cos_config.cpp.o): in function `bool const& Poco::Dynamic::Var::extract<bool>() const': /mnt/Workspace/Program/cos-cpp-sdk-v5/third_party/include/Poco/Dynamic/Var.h:221:(.text._ZNK4Poco7Dynamic3Var7extractIbEERKT_v[_ZNK4Poco7Dynamic3Var7extractIbEERKT_v]+0x2ed): undefined reference to `Poco::format(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Any const&, Poco::Any const&)' /usr/bin/ld: /mnt/Workspace/CLang/TestCos/libs/linux/libcossdk.a(object_op.cpp.o): in function `qcloud_cos::ObjectOp::CheckSinglePart(qcloud_cos::PutObjectByFileReq const&, unsigned long, unsigned long, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': /mnt/Workspace/Program/cos-cpp-sdk-v5/src/op/object_op.cpp:124:(.text+0xfac): undefined reference to `Poco::DigestEngine::digestToHex[abi:cxx11](std::vector<unsigned char, std::allocator<unsigned char> > const&)' /usr/bin/ld: /mnt/Workspace/CLang/TestCos/libs/linux/libcossdk.a(object_op.cpp.o): in function `qcloud_cos::ObjectOp::CheckResumableDownloadTask(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&, unsigned long*)': /mnt/Workspace/Program/cos-cpp-sdk-v5/src/op/object_op.cpp:262:(.text+0x2ba7): undefined reference to `Poco::JSON::Parser::Parser(Poco::SharedPtr<Poco::JSON::Handler, Poco::ReferenceCounter, Poco::ReleasePolicy<Poco::JSON::Handler> > const&, unsigned long)' /usr/bin/ld: /mnt/Workspace/CLang/TestCos/libs/linux/libcossdk.a(object_op.cpp.o): in function `qcloud_cos::ObjectOp::PutObject(qcloud_cos::PutObjectByStreamReq const&, qcloud_cos::PutObjectByStreamResp*, std::shared_ptr<qcloud_cos::TransferHandler> const&)': /mnt/Workspace/Program/cos-cpp-sdk-v5/src/op/object_op.cpp:402:(.text+0x82ca): undefined reference to `Poco::DigestEngine::digestToHex[abi:cxx11](std::vector<unsigned char, std::allocator<unsigned char> > const&)' /usr/bin/ld: /mnt/Workspace/CLang/TestCos/libs/linux/libcossdk.a(object_op.cpp.o): in function `qcloud_cos::ObjectOp::PutObject(qcloud_cos::PutObjectByFileReq const&, qcloud_cos::PutObjectByFileResp*, std::shared_ptr<qcloud_cos::TransferHandler> const&)': /mnt/Workspace/Program/cos-cpp-sdk-v5/src/op/object_op.cpp:476:(.text+0x96bd): undefined reference to `Poco::DigestEngine::digestToHex[abi:cxx11](std::vector<unsigned char, std::allocator<unsigned char> > const&)' /usr/bin/ld: /mnt/Workspace/CLang/TestCos/libs/linux/libcossdk.a(object_op.cpp.o): in function `qcloud_cos::ObjectOp::UploadPartData(qcloud_cos::UploadPartDataReq const&, qcloud_cos::UploadPartDataResp*)': /mnt/Workspace/Program/cos-cpp-sdk-v5/src/op/object_op.cpp:752:(.text+0xf5cd): undefined reference to `Poco::DigestEngine::digestToHex[abi:cxx11](std::vector<unsigned char, std::allocator<unsigned char> > const&)' /usr/bin/ld: /mnt/Workspace/CLang/TestCos/libs/linux/libcossdk.a(object_op.cpp.o): in function `Poco::RecursiveDirectoryIteratorImpl<Poco::ChildrenFirstTraverse>::RecursiveDirectoryIteratorImpl(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short)': /mnt/Workspace/Program/cos-cpp-sdk-v5/third_party/include/Poco/RecursiveDirectoryIteratorImpl.h:44:(.text._ZN4Poco30RecursiveDirectoryIteratorImplINS_21ChildrenFirstTraverseEEC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEt[_ZN4Poco30RecursiveDirectoryIteratorImplINS_21ChildrenFirstTraverseEEC2ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEt]+0x82): undefined reference to `Poco::ChildrenFirstTraverse::ChildrenFirstTraverse(std::pointer_to_unary_function<std::stack<Poco::DirectoryIterator, std::deque<Poco::DirectoryIterator, std::allocator<Poco::DirectoryIterator> > > const&, unsigned short>, unsigned short)' /usr/bin/ld: /mnt/Workspace/CLang/TestCos/libs/linux/libcossdk.a(file_util.cpp.o): in function `qcloud_cos::FileUtil::GetFileMd5(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': /mnt/Workspace/Program/cos-cpp-sdk-v5/src/util/file_util.cpp:123:(.text+0x75e): undefined reference to `Poco::DigestEngine::digestToHex[abi:cxx11](std::vector<unsigned char, std::allocator<unsigned char> > const&)' /usr/bin/ld: /mnt/Workspace/CLang/TestCos/libs/linux/libcossdk.a(file_upload_task.cpp.o): in function `qcloud_cos::FileUploadTask::UploadTask()': /mnt/Workspace/Program/cos-cpp-sdk-v5/src/op/file_upload_task.cpp:143:(.text+0x9ec): undefined reference to `Poco::DigestEngine::digestToHex[abi:cxx11](std::vector<unsigned char, std::allocator<unsigned char> > const&)' /usr/bin/ld: /mnt/Workspace/CLang/TestCos/libs/linux/libcossdk.a(http_sender.cpp.o): in function `qcloud_cos::HttpSender::SendRequest(std::shared_ptr<qcloud_cos::TransferHandler> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&, std::istream&, unsigned long, unsigned long, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >*, std::ostream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, bool, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': /mnt/Workspace/Program/cos-cpp-sdk-v5/src/util/http_sender.cpp:112:(.text+0x7a8): undefined reference to `Poco::Net::Context::Context(Poco::Net::Context::Usage, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Net::Context::VerificationMode, int, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /usr/bin/ld: /mnt/Workspace/Program/cos-cpp-sdk-v5/src/util/http_sender.cpp:115:(.text+0x8c7): undefined reference to `Poco::Net::HTTPSClientSession::HTTPSClientSession(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short, Poco::AutoPtr<Poco::Net::Context>)' /usr/bin/ld: /mnt/Workspace/Program/cos-cpp-sdk-v5/src/util/http_sender.cpp:236:(.text+0x24f2): undefined reference to `Poco::DigestEngine::digestToHex[abi:cxx11](std::vector<unsigned char, std::allocator<unsigned char> > const&)' /usr/bin/ld: /mnt/Workspace/CLang/TestCos/libs/linux/libcossdk.a(http_sender.cpp.o): in function `qcloud_cos::HttpSender::SendRequest(std::shared_ptr<qcloud_cos::TransferHandler> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, unsigned long, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::ostream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, unsigned long*, bool, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': /mnt/Workspace/Program/cos-cpp-sdk-v5/src/util/http_sender.cpp:333:(.text+0x51c0): undefined reference to `Poco::Net::Context::Context(Poco::Net::Context::Usage, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Net::Context::VerificationMode, int, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /usr/bin/ld: /mnt/Workspace/Program/cos-cpp-sdk-v5/src/util/http_sender.cpp:336:(.text+0x52df): undefined reference to `Poco::Net::HTTPSClientSession::HTTPSClientSession(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short, Poco::AutoPtr<Poco::Net::Context>)' /usr/bin/ld: /mnt/Workspace/Program/cos-cpp-sdk-v5/src/util/http_sender.cpp:465:(.text+0x704b): undefined reference to `Poco::DigestEngine::digestToHex[abi:cxx11](std::vector<unsigned char, std::allocator<unsigned char> > const&)' /usr/bin/ld: /mnt/Workspace/CLang/TestCos/libs/linux/libcossdk.a(codec_util.cpp.o): in function `qcloud_cos::CodecUtil::HmacSha1Hex(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': /mnt/Workspace/Program/cos-cpp-sdk-v5/src/util/codec_util.cpp:100:(.text+0xa07): undefined reference to `Poco::DigestEngine::digestToHex[abi:cxx11](std::vector<unsigned char, std::allocator<unsigned char> > const&)' clang-16: error: linker command failed with exit code 1 (use -v to see invocation) ninja: build stopped: subcommand failed.
CMakeLists.txt
cmake_minimum_required(VERSION 3.26) project(TestCos) set(CMAKE_CXX_STANDARD 20) enable_testing() find_package(GTest CONFIG REQUIRED) find_package(fmt CONFIG REQUIRED) find_package(loguru CONFIG REQUIRED) find_package(OpenSSL REQUIRED) find_package(Poco REQUIRED COMPONENTS Foundation Crypto XML JSON Util Net NetSSL) set(COS_SDK_H src/cos-cpp-sdk-v5/include) include_directories(${COS_SDK_H}) if (WIN32) link_directories(libs/Win32) elseif (UNIX) link_directories(libs/linux) elseif (APPLE) link_directories(libs/macOS) else () link_directories(libs/x64) endif () set(SRC src/main.cpp) add_executable(TestCos ${SRC}) target_link_libraries(TestCos PRIVATE fmt::fmt loguru GTest::gtest GTest::gtest_main GTest::gmock GTest::gmock_main OpenSSL::SSL OpenSSL::Crypto Poco::Foundation Poco::Crypto Poco::XML Poco::JSON Poco::Util Poco::Net Poco::NetSSL libcossdk.a)
vcpkg.json
{ "name": "test-cos", "version": "1.0.0", "dependencies": [ {"name": "openssl"}, {"name": "loguru"}, {"name": "fmt"}, {"name": "poco", "features": ["crypto","netssl"]}, {"name": "gtest"} ] }
main.cpp
#include <loguru/loguru.hpp> #include <cos_api.h> #include <cos_sys_config.h> #include <cos_config.h> #include <cos_defines.h> #include <cos_params.h> #include <string> void CosLogCallBack(const std::string& logInfo); int main(int argc, char **argv) { loguru::init(argc, argv); LOG_F(INFO, "Init cos"); qcloud_cos::CosConfig config("./cos-config.json"); config.SetLogCallback(&CosLogCallBack); qcloud_cos::CosAPI cosApi(config); return 0; } void CosLogCallBack(const std::string& logInfo) { LOG_F(INFO, "%s", logInfo.c_str()); }
The text was updated successfully, but these errors were encountered:
尝试重新基于源码编译poco
Sorry, something went wrong.
重新编译了poco并放在sdk中重新编译了sdk, 还是同样的问题
好的,我们这里排期复现看下问题
No branches or pull requests
编译代码时链接Poco出现问题,平台 Arch linux, 使用vcpkg管理第三方库
Message
CMakeLists.txt
vcpkg.json
main.cpp
The text was updated successfully, but these errors were encountered: