Bug #47739 The archive plugin cannot be loaded on Solaris with dtrace enabled.
Submitted: 30 Sep 2009 11:40 Modified: 23 Aug 2012 17:37
Reporter: Horst Hunger Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Archive storage engine Severity:S3 (Non-critical)
Version:next OS:Solaris (SunOS 5.10 Generic_127128-11 i86pc i386 i86pc)
Assigned to: Assigned Account CPU Architecture:Any
Tags: archive, DTrace, plugin

[30 Sep 2009 11:40] Horst Hunger
Description:
the installation of the archive plugin resulted in

CURRENT_TEST: main.archive_plugin
mysqltest: At line 6: query 'INSTALL PLUGIN archive SONAME 'ha_archive.so'' failed: 1126: Can't open shared library '/home/hh221802/bzr/mysql-47146/mysql-test/../storage/archive/.libs/ha_archive.so' (errno: 2 ld.so.1: mysqld: fatal: relocation error: file /home/hh221802/bzr/mysql-47146/mysql-test/../storage/archive/.libs/ha_archive.so:)

How to repeat:
run the sql statement mentioned in the error text after having made the plugin.

Suggested fix:
Change the Makefile.am so that dtrace will be executed and the right objects will be linked to the shared library.
[30 Sep 2009 13:15] 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/85208

2881 Horst Hunger	2009-09-30
      Fix for Bug#47739. Dtrace was never executed with the Makefile.am and trying to load the plugin on Solaris with dtrace enabled failed. The changes now let dtrace make the probes_mysql.o and link it together with .libs/ha_archive_la-ha_archive.o (which is the right object) to the shared library.
[30 Sep 2009 15:22] Joerg Bruehe
With two minor changes, I approve the patch.
Details are in mail.
[5 Oct 2009 14:10] 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/85763

2880 Horst Hunger	2009-10-05
      2. fix for bug#47739: The first patch was not complete and the making of mysqld failed. This patch contains the needed files for making mysqld (probes_all.d) as well as for linking the shared library.
[23 Oct 2009 10:06] 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/87911

2894 Horst.Hunger	2009-10-23
      Patch for bug#47739: Inserted review results. With this atch it now possible to link archive statically to mysqld and to have archive as shared library, in both varants with DTRACE.
[23 Oct 2009 10: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/87917

2915 Horst.Hunger	2009-10-23
      Fix for bug#47739: inserts of the review got lost. inserted them again.
[23 Oct 2009 10:56] Horst Hunger
pushed the patch to mysql-next-mr-bugfixing.
[27 Oct 2009 10:52] 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/88311

2915 Horst.Hunger	2009-10-27
      Fix for bug#47739: inserts of the review got lost. inserted them again with fixed copyright lines.
[31 Oct 2009 8:17] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20091031081410-qkxmjsdzjmj840aq) (version source revid:lars-erik.bjork@sun.com-20091023144402-05x9kn8fz878z011) (merge vers: 6.0.14-alpha) (pib:13)
[12 Nov 2009 8:16] Bugs System
Pushed into 5.5.0-beta (revid:alik@sun.com-20091110093229-0bh5hix780cyeicl) (version source revid:mikael@mysql.com-20091102100915-a2nbfxaqprpgptfw) (merge vers: 5.5.0-beta) (pib:13)
[29 Jan 2010 11:25] Horst Hunger
pushed into mysql-next-mr-bugfixing. merged and pushed into mysql-6.0-codebase-bugfixing.
[29 Jan 2010 11:26] Horst Hunger
Mistake, I meant another bug.
[24 Feb 2010 7:49] Horst Hunger
As the patch let the make still fail sometimes I'll take over the changes from "example".
[30 Mar 2010 8:39] 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/104603

3144 Horst.Hunger	2010-03-30
      Revised fix for bug#47739 including changes in Makefile.am corresonding to those of example and a test.
[13 Apr 2010 17:48] 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/105561

3131 Horst.Hunger	2010-04-13
      patch for bug#47739 including the review results:
      1. The DTRACEFILES should contain libarchive_a-ha_archive.o instead of the .c file
      2. Adding the missing include/have_archive_plugin.inc file
      3. Add an second:
      
            UNINSTALL PLUGIN archive;
      
         right after the first one to verify that the second UNINSTALL will fail and produce the correct error message.
[21 Apr 2010 12:36] Horst Hunger
Pushed the patch into next-mr-bugfixing and 6.0-codebase-bugfixing at 2010-04-14.
[5 Oct 2010 13:14] Martin Knaup
The patch seems to have introduced another problem. When compiling 5.5.6-rc on Solaris 10 x86 64bit and DTrace enabled, the build fails when linking ha_example.so with lots of unresolved references. The important configure options in this context should be --enable-dtrace and --with-plugins=max-no-ndb.

Reason is that in the Makefile in ./storage/example/ the following line (786 in Makefile.in)

$(CP) $(DTRACESHAREDFILES) .libs

copies the ha_example_la-ha_example.o from ./storage/example/ (without PIC options) into ./storage/example/.libs, overwriting the existing ha_example_la-ha_example.o (which was built with PIC).
The following linker call to build .libs/ha_example.so.0.0.0 with .libs/ha_example_la-ha_example.o fails, which is obvious.

To fix this problem I removed the copy of the library to the wrong place and  build probes_sh_mysql.o in .libs only:

--- mysql-5.5.6-rc/storage/example/Makefile.in  2010-09-17 22:48:40.000000000 +0200
+++ mysql-5.5.6-rc_patched/storage/example/Makefile.in  2010-10-05 12:33:46.000000000 +0200
@@ -454,7 +454,7 @@ EXTRA_DIST = CMakeLists.txt plug.in
 @HAVE_DTRACE_DASH_G_TRUE@libexample_a_LIBADD = probes_mysql.o
 @HAVE_DTRACE_DASH_G_TRUE@libexample_a_DEPENDENCIES = probes_mysql.o dtrace_files dtrace_providers
 # For example as shared library
-@HAVE_DTRACE_DASH_G_TRUE@ha_example_la_LIBADD = probes_sh_mysql.o
+@HAVE_DTRACE_DASH_G_TRUE@ha_example_la_LIBADD = .libs/probes_sh_mysql.o
 # Hack: We "depend" on ".libs/" but have no rule for it,
 # but it is created as a byproduct of the ".lo"
 @HAVE_DTRACE_DASH_G_TRUE@DTRACESHAREDDEPS = ha_example_la-ha_example.lo
@@ -782,8 +782,8 @@ uninstall-am: uninstall-pkgpluginLTLIBRA
 @HAVE_DTRACE_DASH_G_TRUE@      echo timestamp > dtrace_sources

 @HAVE_DTRACE_DASH_G_TRUE@probes_sh_mysql.o: $(DTRACEPROVIDER) $(DTRACESHAREDDEPS)
-@HAVE_DTRACE_DASH_G_TRUE@      $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACESHAREDFILES) -o $@
-@HAVE_DTRACE_DASH_G_TRUE@      $(CP) $(DTRACESHAREDFILES) .libs
+@HAVE_DTRACE_DASH_G_TRUE@      $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) .libs/$(DTRACESHAREDFILES) -o .libs/$@
+
 @HAVE_DTRACE_DASH_G_TRUE@probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES)
 @HAVE_DTRACE_DASH_G_TRUE@      $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@
 # Tell versions [3.59,3.63) of GNU make to not export all variables.

Most likely not the right way to handle .libs etc but now the 5.5.6-rc compiles without any problem again.
[23 Aug 2012 17:37] Paul DuBois
Noted in 5.5.8 changelog.

The ARCHIVE storage engine could not be loaded with DTrace enabled on
Solaris.