Bug #41245 MY_HOOKS class within a function in sql/sql_insert.cc breaks linking on QNX
Submitted: 4 Dec 2008 22:29 Modified: 17 Jan 2014 12:13
Reporter: Dimitri Tarassenko Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Compiling Severity:S1 (Critical)
Version:5.1.30 OS:Any (QNX 6.2.1, FreeBSD, Linux)
Assigned to: CPU Architecture:Any
Tags: Contribution, do_postlock, MY_HOOKS, QNX, sql_insert.o

[4 Dec 2008 22:29] Dimitri Tarassenko
Description:
QNX linker fails to resolve symbols created for virtual methods in MY_HOOKS class in sql/sql_insert.cc.

During make stage, the following error occurs:

sql_insert.o(.gnu.linkonce.d._vt.Q313select_result61prepare__13select_createRt4List1Z4ItemP18st_select_lex_unit.0_8MY_HOOKS+0xc): undefined reference to `_._Q313select_result61prepare__13select_createRt4List1Z4ItemP18st_select_lex_unit.0_8MY_HOOKS.11465'
sql_insert.o(.gnu.linkonce.d._vt.Q313select_result61prepare__13select_createRt4List1Z4ItemP18st_select_lex_unit.0_8MY_HOOKS+0x1c): undefined reference to `do_postlock__Q313select_result61prepare__13select_createRt4List1Z4ItemP18st_select_lex_unit.0_8MY_HOOKSPP8st_tableUi.11464'
collect2: ld returned 1 exit status

How to repeat:
configure, make on QNX

Suggested fix:
Moving the MY_HOOKS class declaration outside the select_create::prepare() solves the problem, the resulting code builds and links nicely.
[4 Dec 2008 22:31] Dimitri Tarassenko
tags fixed
[5 Dec 2008 10:08] Sveta Smirnova
Thank you for the report.

Verified as described.
[8 Feb 2009 9:37] Daniel Fischer
This bug only affects MySQL 5.1 and higher, and QNX is not a supported platform for MySQL 5.1.

As of this writing, QNX is planned to remain a supported platform for MySQL 5.0 until 2009-Dec-31, but MySQL 5.0 is not affected by this bug.
[23 Apr 2009 16:48] MySQL Verification Team
See bug: http://bugs.mysql.com/bug.php?id=44432.
[24 Apr 2009 11:00] Mark Kramer
I'm experiencing the same problem on FreeBSD, but then with MySQL 5.1.34.

> Moving the MY_HOOKS class declaration
> outside the select_create::prepare()
> solves the problem, the resulting code
> builds and links nicely.

Ok, can someone please tell me how this is done? (I'm not a C guru; but I'd still like to have a working shiny new MySQL).
[21 May 2010 13:29] Andrew Eigus
Same problem on Slackware Linux 8.1:

gcc -v
Reading specs from /usr/lib/gcc-lib/i386-slackware-linux/2.95.3/specs
gcc version 2.95.3 20010315 (release)

Any patches available?

Andrew
[21 May 2010 13:49] Dimitri Tarassenko
Fixes compile problems

Attachment: mysql-5.1.30.patch (application/octet-stream, text), 2.82 KiB.

[21 May 2010 14:58] Magnus Blåudd
Move the MY_HOOK class out from the funciton as patch suggests.
[24 May 2010 17:12] Valeriy Kravchuk
All reporters:

Please, specify what exact gcc version do you use.
[24 May 2010 17:54] Dimitri Tarassenko
[root@cv4 src]# gcc -v
Reading specs from /usr/lib/gcc-lib/ntox86/2.95.3qnx-nto/specs
gcc version 2.95.3qnx-nto 20010315 (release)
[17 Jan 2014 12:13] Ståle Deraas
Posted by developer:
 
This bug was reported on legal code, which caused problems for some old compilers/linkers. Recent compilers/linkers does not have this problem.