we started linking our application with -libmysqlcppconn-static to support MySQL .
When we compile for debugging, everything is fine, but when we compile for release using gcc -O2 , we get errors.
We tracked the compiler option to be -funit-at-a-time . We get errors in the form:
libmysqlcppconn-static.a (mysql_connection.cpp.o): sql::mysql::MySQL_Savepoint::getSavepointId()': mysql_connection.cpp:(.text+0x8d): undefined reference to function sql::mysql::MySQL_Savepoint::getSavepointId()': mysql_connection.cpp:(.text+0x8d): undefined reference to std :: allocator :: allocator ( ) 'mysql_connection.cpp :(. text + 0x133): undefined reference to `std :: allocator :: ~ allocator ()'
We are currently working on this by including -fno-unit-at-a-time . Any understanding of how we can fix this will be appreciated.
Philc source share