Re: Static linking to Connector/C++ on linux giving errors
dpkg -l | grep libmysql gives me the following:
ii libmysqlclient-dev 5.7.29-0ubuntu0.18.04.1 amd64 MySQL database development files
ii libmysqlclient20:amd64 5.7.29-0ubuntu0.18.04.1 amd64 MySQL database client library
ii libmysqlcppconn-dev:amd64 8.0.19-1ubuntu18.04 amd64 Development header files and libraries for MySQL C++ client applications
ii libmysqlcppconn7:amd64 8.0.19-1ubuntu18.04 amd64 MySQL Driver for C++ which mimics the JDBC 4.0 API
ii libmysqlcppconn7-dbgsym:amd64 8.0.19-1ubuntu18.04 amd64 debug symbols for libmysqlcppconn7
ii libmysqlcppconn8-2:amd64 8.0.19-1ubuntu18.04 amd64 MySQL database connector for C++
ii libmysqlcppconn8-2-dbgsym:amd64 8.0.19-1ubuntu18.04 amd64 debug symbols for libmysqlcppconn8-2
This should be correct. I removed the 32-bit and installed the missing ones. The 32-bit package might have been the reason for dynamic linking not working. I still get the following error when linking statically:
/tmp/ccc6BRyC.o: In function `mysqlx::abi2::r0::string::traits<char>::to_str[abi:cxx11](mysqlx::abi2::r0::string const&)':
main.cc:(.text._ZN6mysqlx4abi22r06string6traitsIcE6to_strB5cxx11ERKS2_[_ZN6mysqlx4abi22r06string6traitsIcE6to_strB5cxx11ERKS2_]+0x2e): undefined reference to `mysqlx::abi2::r0::string::Impl::to_utf8[abi:cxx11](mysqlx::abi2::r0::string const&)'
collect2: error: ld returned 1 exit status
I'm using this compiler statement:
g++ main.cc -o test -I /usr/include/mysql-cppconn-8/include /usr/include/mysql-cppconn-8/lib64/libmysqlcppconn8-static.a -lssl -lcrypto -lpthread -lresolv
So, the error here doesn't seem to be related to the packages mentioned. Any idea?
Subject
Views
Written By
Posted
3198
April 08, 2020 09:19AM
1295
April 09, 2020 03:42PM
1418
April 09, 2020 06:08PM
1035
April 11, 2020 04:54AM
964
April 13, 2020 03:47AM
1053
April 13, 2020 07:28AM
967
April 13, 2020 09:53AM
926
April 13, 2020 09:57AM
883
April 13, 2020 03:48PM
856
April 13, 2020 04:01PM
848
April 14, 2020 02:13AM
Re: Static linking to Connector/C++ on linux giving errors
1281
April 14, 2020 05:09AM
876
April 14, 2020 06:04AM
1016
April 15, 2020 10:20AM
981
April 15, 2020 11:06AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.