microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
23.27k stars 6.42k forks source link

[mysql-connector-cpp[jdbc]] X64-linux link fail #41380

Open crackun24 opened 1 month ago

crackun24 commented 1 month ago

Could not find the function in the .a lib file while getting the mysql driver image error msg: image

dg0yt commented 1 month ago

get_driver_instance is an inline function. The errors indicate that the definition is found.

Copy text, not screenshots. There might be missing link libraries, but it is cut away.

crackun24 commented 1 month ago

OK I have solved this problem by switching the abi version.Thank you a lot.

dg0yt commented 1 month ago

I have solved this problem by switching the abi version.

It is not clear what this means. Did you switch to the x64-linux-dynamic triplet?

crackun24 commented 1 month ago

use this definition GLIBCXX_USE_CXX11_ABI=0

crackun24 commented 1 month ago

The issue occurs at this specific code location:

CPPCONN_PUBLIC_FUNC void check(const std::string &);
CPPCONN_PUBLIC_FUNC void check(const std::map<std::string,std::string> &);

/*
  Checks if user standard lib is compatible with connector one
*/
inline static void check_lib()
{
  check(std::string{});
  check(std::map<std::string,std::string>{});
}

Build info:


[1/1] Linking CXX executable AuditSys
FAILED: AuditSys 
: && /usr/bin/c++ -g  CMakeFiles/AuditSys.dir/src/main.cpp.o CMakeFiles/AuditSys.dir/src/Config.cpp.o CMakeFiles/AuditSys.dir/src/DB.cpp.o CMakeFiles/AuditSys.dir/src/AuditMgr.cpp.o CMakeFiles/AuditSys.dir/src/WeChatHandler.cpp.o CMakeFiles/AuditSys.dir/src/Util.cpp.o CMakeFiles/AuditSys.dir/src/Alter.cpp.o CMakeFiles/AuditSys.dir/src/thrift/audit_types.cpp.o CMakeFiles/AuditSys.dir/src/thrift/PostAuditPassToMCServer.cpp.o CMakeFiles/AuditSys.dir/src/thrift/PostBuildingReqToBuildServer.cpp.o CMakeFiles/AuditSys.dir/src/thrift/onMessagePost.cpp.o CMakeFiles/AuditSys.dir/src/thrift/msg_types.cpp.o CMakeFiles/AuditSys.dir/src/thrift/PostBuildingResToAudit.cpp.o -o AuditSys  /home/crackun24/env/vcpkg/installed/x64-linux/debug/lib/libmysqlcppconn8-static.a  /home/crackun24/env/vcpkg/installed/x64-linux/debug/lib/libthriftd.a  /home/crackun24/env/vcpkg/installed/x64-linux/debug/lib/libfmtd.a  /home/crackun24/env/vcpkg/installed/x64-linux/debug/lib/libspdlogd.a  /home/crackun24/env/vcpkg/installed/x64-linux/debug/lib/libhv_static.a  /home/crackun24/env/vcpkg/installed/x64-linux/debug/lib/libssl.a  /home/crackun24/env/vcpkg/installed/x64-linux/debug/lib/libcrypto.a  /home/crackun24/env/vcpkg/installed/x64-linux/debug/lib/libfmtd.a  /home/crackun24/env/vcpkg/installed/x64-linux/debug/lib/libjsoncpp.a  -lpthread  -lm  -ldl  -lrt  -lstdc++ && cd /home/crackun24/.vs/AuditSys/7457900a-e668-4ad2-9bd4-4f5f7ac87b0d/out/build/Linux-GCC-Debug && /usr/bin/cmake -E copy_if_different /home/crackun24/.vs/AuditSys/7457900a-e668-4ad2-9bd4-4f5f7ac87b0d/src/config.toml /home/crackun24/.vs/AuditSys/7457900a-e668-4ad2-9bd4-4f5f7ac87b0d/out/build/Linux-GCC-Debug/config.toml
/usr/bin/ld: CMakeFiles/AuditSys.dir/src/DB.cpp.o: in function `check_lib()':
/home/crackun24/env/vcpkg/installed/x64-linux/include/jdbc/cppconn/driver.h:82:(.text+0x95): undefined reference to `check(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: /home/crackun24/env/vcpkg/installed/x64-linux/include/jdbc/cppconn/driver.h:83:(.text+0xc9): undefined reference to `check(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&)'
/usr/bin/ld: CMakeFiles/AuditSys.dir/src/DB.cpp.o: in function `sql::mysql::get_driver_instance_by_name(char const*)':
/home/crackun24/env/vcpkg/installed/x64-linux/include/jdbc/mysql_driver.h:116:(.text+0x173): undefined reference to `sql::mysql::_get_driver_instance_by_name(char const*)'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
dg0yt commented 1 month ago

Now this is useful feedback. There seems to be a problem with some port messing around abi-changing toolchain settings. i.e. there is aport bug.

https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html

github-actions[bot] commented 1 week ago

This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 28 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.