Static linking against libmysql on linux giving undefined references
Posted by: Bertil Davidson
Date: June 12, 2020 03:01AM

Hi,

I have created a shared library that statically link against version 5.7.29 by libmysqlclient.a and it works well. But now when I try to link against version 8.0.20 of libmysqlclient.a, I get the following undefined references when I run the ld command:

undefined reference to ’operator delete(void*, unsigned long)'
undefined reference to ’std::__throw_out_of_range_fmt(char const*, ...)'

I have also tried to link a regular application statically against version 8.0.20 of libmysqlclient.a, but then I got even more undefined references.

Development environment is Red Hat Enterprise Linux 7.7 (x86, 64-bit) and gcc 4.8.5.
Compiler options: -std=c++0x –D_GNU_SOURCE –O0 –g3 –Wall –c –fPIC – MMD –MP
Link options: –shared –lpthread –lc –lrt –ldl –lssl -lcrypto -lresolv

My question is:

1. Are there any changes in libmysqlclient.a between 5.7.29 and 8.0.20 that could explain this?
2. Are there any special compiler or link options I need to use?
3. Do I need to link to any other libraries?

Thanks!

Options: ReplyQuote


Subject
Views
Written By
Posted
Static linking against libmysql on linux giving undefined references
978
June 12, 2020 03:01AM


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.