Bug #29645 Link failure when using the embedded server
Submitted: 9 Jul 2007 10:59 Modified: 16 Mar 2008 10:50
Reporter: Kent Boortz Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.2.4 OS:HP/UX (11.23 IA64)
Assigned to: Tatiana Azundris Nuernberg CPU Architecture:Any

[9 Jul 2007 10:59] Kent Boortz
Description:
A test to link an application with the embedded server
using the flags returned by "mysql_config" fails with

 aCC -o out-cxx -I/data/mysqldev/tmp-200707041118-5.2.4-alpha-20224/hpita2-64bit/test/mysql-5.2.4-alpha-hpux11.23-ia64-64bit/include +O2 +DD64 +DSitanium2 -mt -AC99 -DPTHREAD_COMPAT_MODE test.cc +DD64 -L/data/mysqldev/tmp-200707041118-5.2.4-alpha-20224/hpita2-64bit/test/mysql-5.2.4-alpha-hpux11.23-ia64-64bit/lib -lmysqld -lz -lpthread -lnsl -lm  -lpthread   -lrt

The symbols it complains about are all C++ runtime symbols, like "new",
"delete", "__cxa_pure_virtual"....

How to repeat:
Link an embedded application with the embedded library

Suggested fix:
Make sure "mysql_config" outputs all the needed flags for linking.
[13 Feb 2008 13:13] Kent Boortz
Link test program (will not run)

Attachment: test.c (text/plain), 8.45 KiB.

[13 Feb 2008 17:31] Tatiana Azundris Nuernberg
Possibly related, Bug#20508
[25 Feb 2008 4:54] Tatiana Azundris Nuernberg
$ ldd -v -r out-cxx
  find library=libdl.so.1; required by /usr/lib/hpux64/libc.so.1
        libdl.so.1 =>   /usr/lib/hpux64/libdl.so.1
        symbol not found: __cxa_vec_new2        (out-cxx)
        symbol not found: __cxa_vec_new3        (out-cxx)
        symbol not found: __cxa_begin_catch     (out-cxx)
...
[25 Feb 2008 5:11] Tatiana Azundris Nuernberg
Bug is as follows:

- mysql_config has --cflags, but not --cxxflags
- therefore, --cflags must break neither C nor C++ compilation
- mysql_config renders -AC99. this puts the HP compiler into
  C-mode and can not be fixed by just adding another -AA when
  compiling C++.
- therefore, we need to filter out -AC99 in mysql_config (we
  already do something equivalent for Sun Forte C++) to be
  able to compile using the C++ compiler.
- adding to mysql_config's filter-list fixes C++/libmysqld build
  on HP/UX (with HP compiler).
[25 Feb 2008 6:51] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/42924

ChangeSet@1.2608, 2008-02-25 07:50:55+01:00, tnurnberg@mysql.com +1 -0
  Bug#29645: Link failure when using the embedded server
  
  mysql_config --cflags gave a flag that forced the HP/UX
  C++ compiler into C-mode; as a result, C++ sources could
  not be compiled correctly.
  
  We now filter out the offending flag (like we do for Sun)
  so that --cflags will work for both C and C++.
[25 Feb 2008 6:54] Tatiana Azundris Nuernberg
flags verified manually on HP/UX; mysql_config.sh -> mysql_config and filtering of offending flag tested manually (existence of flag platform-dependent)
[10 Mar 2008 6:03] Tatiana Azundris Nuernberg
pushed to 5.0.58, 5.1.24, 6.0.5 in opt
[13 Mar 2008 19:28] Bugs System
Pushed into 6.0.5-alpha
[13 Mar 2008 19:36] Bugs System
Pushed into 5.1.24-rc
[13 Mar 2008 19:43] Bugs System
Pushed into 5.0.60
[16 Mar 2008 10:50] MC Brown
A note has been added to the 5.0.60, 5.1.24 and 6.0.5 changelogs: 

The mysql_config command would output CFLAGS values that were incompatible with C++ for the HP-UX platform.
[30 Mar 2008 17:35] Jon Stephens
Also noted in the 5.1.23-ndb-6.3.11 changlog.