minio / minio-cpp

MinIO C++ Client SDK for Amazon S3 Compatible Cloud Storage
https://minio-cpp.min.io/
Apache License 2.0
136 stars 56 forks source link

Issue with using libminiocpp.a #98

Closed tthh7 closed 12 months ago

tthh7 commented 12 months ago

I encountered an issue when building my program using libminiocpp.a. My compilation LDFLAGS are: -L/usr/local/lib -lminiocpp -L/home/xxx/minio-cpp/build/vcpkg_installed/x64-linux/lib -lcurlpp -lcurl -lssl -lcrypto -linih -lINIReader -lpugixml -lz. The compilation is successful, but when I try to use it, I encounter the following error: undefined symbol: _ZN5minio2s37BaseUrlC1ESsbSs

balamurugana commented 12 months ago

Looks like you have a partial installation. You would need to fix it at your end

tthh7 commented 12 months ago

看来您进行了部分安装。你需要在最后修复它

libminiocpp.a was compiled following the tutorial, and my program requires the use of this libminiocpp.a. I have added the relevant dependencies, but I still encounter the error: error: undefined symbol: _ZN5minio2s37BaseUrlC1ESsbSs. It resolves to minio::s3::BaseUrl::BaseUrl(std::string, bool, std::string). When using libminiocpp.a, what additional dependencies do I need? Can you provide me with some examples?

balamurugana commented 12 months ago

You could use vcpkg for build. An example CMake file is attached at https://github.com/minio/minio-cpp/issues/96#issuecomment-1764566160

tthh7 commented 12 months ago

您可以用于vcpkg构建。示例 CMake 文件附在#96(评论)

I would like to ask how to compile it into a dynamic library?

balamurugana commented 12 months ago

Refer CMake documentation.

tthh7 commented 11 months ago

请参阅 CMake 文档。

Thank you for your patient response. I have identified the root cause of the 'undefined symbol: _ZN5minio2s37BaseUrlC1ESsbSs' issue. When I use minio-cpp in my own program, the problem occurs, and it's not due to an incomplete build of minio-cpp. Upon resolving this symbol, I found that the function is named 'minio::s3::BaseUrl::BaseUrl(std::string, bool, std::string)'. However, when minio-cpp is compiled using vcpkg and a higher version of GCC, the corresponding function resolves as 'minio::s3::BaseUrl::BaseUrl(std::__cxx11::basic_string<char, std::char_traits, std::allocator >, bool)'. Since my program is compiled with '-D_GLIBCXX_USE_CXX11_ABI=0', it ultimately leads to the occurrence of this problem.