Bug #80536 cmake problem with 5.6.x mysql_config and -fno-rtti
Submitted: 26 Feb 2016 21:01 Modified: 1 Mar 2016 5:00
Reporter: David Bennett (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / C++ Severity:S2 (Serious)
Version:1.1.7 OS:Ubuntu (15.04)
Assigned to: CPU Architecture:Any
Tags: cmake make gcc no-rtti typeid

[26 Feb 2016 21:01] David Bennett
Description:
When building on Ubuntu 15.04 using the standard system mysql_config (version 5.6.x), the resulting make will fail due to the inherited Ubuntu 15.04 mysql compile time parameter -fno-rtti

This causes a failure in the source when typeid() is used as runtime type information is required for typeid() to function.

How to repeat:
On Ubuntu 15.04 with GNU g++ 4.x

  ~/mysql-connector-cpp$ sudo apt-get install libmysqlclient-dev
  ~/mysql-connector-cpp$ git checkout 1.1.7
  ~/mysql-connector-cpp$ cmake .
  ~/mysql-connector-cpp$ make

Will result in compile failure:

In file included from /root/git/MetricBench.perclab/build/mysql-connector-cpp/cppconn/connection.h:35:0,
                 from /root/git/MetricBench.perclab/build/mysql-connector-cpp/driver/mysql_connection.h:30,
                 from /root/git/MetricBench.perclab/build/mysql-connector-cpp/driver/mysql_connection.cpp:65:
/root/git/MetricBench.perclab/build/mysql-connector-cpp/cppconn/variant.h: In member function ‘T* sql::BaseVariantImpl::get() const’:
/root/git/MetricBench.perclab/build/mysql-connector-cpp/cppconn/variant.h:59:15: error: cannot use typeid with -fno-rtti
   if (typeid(T).name() == typeid(void).name()) {

Suggested fix:
After reading the -cxxflags from mysql_config, remove the -fno-rtti compile parameter if found.
[29 Feb 2016 13:07] Umesh Shastry
Hello David,

Thank you for the report.
I'm not seeing this issue at my end on Ubuntu 15.04/15.10 with/without -fno-rtti. Only thing I'm seeing is as reported in Bug #80539.

Any other info which help me to trigger this issue? I'll join the worklog shortly.

Thanks,
Umesh
[29 Feb 2016 13:07] Umesh Shastry
test results

Attachment: 80536.results (application/octet-stream, text), 9.92 KiB.

[29 Feb 2016 16:07] David Bennett
Umesh,

Here is the compiler command that is being generated with make VERBOSE=1 before the failure occurs, it looks as though 

/usr/bin/g++-4.9   -DCPPCONN_SO_BUILD=\"\" -DDBUG_OFF -Dmysqlcppconn_EXPORTS -fPIC -I/root/git/MetricBench.perclab/build/MetricBench_boost/include -I/usr/include/mysql -I/tmp/mysql-connector-cpp -I/tmp/mysql-connector-cpp/cppconn -I/tmp/driver/nativeapi    -Wall -fPIC -Woverloaded-virtual    -I/usr/include/mysql -DBIG_JOINS=1 -felide-constructors -fpermissive -fno-rtti  -fno-strict-aliasing   -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing -o CMakeFiles/mysqlcppconn.dir/mysql_connection.cpp.o -c /tmp/mysql-connector-cpp/driver/mysql_connection.cpp
[1 Mar 2016 5:00] David Bennett
I am closing this and will delete the PR.   I believe the problem was already fixed in commit c7a14129b9cdff14797ed73753c4b1083dd51c7a
[1 Mar 2016 5:06] Umesh Shastry
Thank you David for confirming!

Thanks,
Umesh