Bug #39288 | MySQL Embedded server (libmysqld.a) is built without -fPIC flag | ||
---|---|---|---|
Submitted: | 6 Sep 2008 17:06 | Modified: | 14 Jan 2013 11:06 |
Reporter: | Edward Hades | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Compiling | Severity: | S2 (Serious) |
Version: | 5.1.26-rc, 5.0, 5.1 bzr | OS: | Linux |
Assigned to: | Joerg Bruehe | CPU Architecture: | Any |
Tags: | Contribution |
[6 Sep 2008 17:06]
Edward Hades
[8 Sep 2008 7:21]
Sveta Smirnova
Thank you for the report. Verified as described.
[8 Sep 2008 7:48]
Sveta Smirnova
Workaround: `export CFLAGS='-fPIC'` before running configure
[24 Sep 2008 11:27]
Soren Harward
I looked through a build log of 5.0.60 and determined that the only library built with PIC, even when --with-pic is enabled by the configure script, is libmysqlclient.a . libmysqld.a is gathered from: libmysqld_int.a libregex.a libmyisam.a libmyisamrg.a libheap.a libmysys.a libmystrings.a libdbug.a libvio.a All of these need to be built with PIC. The CFLAGS="-fPIC" temporary workaround does work for me, though.
[3 Oct 2008 20:03]
Robin Johnson
As a larger question in this, why is the submitter trying to link a shared library against a static one (esp one as large s libmysqld)? libmysqld should be provided in a shared library form as well for linking against I think.
[3 Oct 2008 21:28]
Edward Hades
Well, yes, linking against libmysqld.so can solve all our problems. The problem is, there is no libmysqld.so, neither built by mysql's build system, nor available in any distribution to my knowledge.
[9 Nov 2008 21:07]
Robin Johnson
Sveta: Any plans to make a shared libmsqld.so to solve this properly?
[27 Nov 2008 17:40]
Ingmar Vanhassel
Is there any progress on this? Any plans on including this in a future mysql release, or anyone working on it?
[27 Nov 2008 21:02]
Sveta Smirnova
Robin, Ingmar, target version is 6.0, so bug should be fixed in version 6.0 sometime.
[28 Nov 2008 10:21]
Lenz Grimmer
I don't agree on setting the target version of this to 6.0. We finally re-enabled the embedded Server in 5.1, so I think it deserves to be built properly. This change is not affecting any source code at all, it does not introduce any change in behavior. It just requires the surrounding build scripts and Makefiles to be fixed. Why is such a trivial change being postponed to 6.0? I am fine with postponing the creation of a shared library version of the MySQL embedded server to a future version, if it's too intrusive to do (I now submitted WL#4650 about this). But not building the static libraries with PIC is a bug that needs to be fixed ASAP, as it is a roadblock for the adoption of MySQL Embedded.
[31 Dec 2008 0:45]
David Carlos
Any updates on this? I think it's important and trivial enough to have it fixed soon.
[6 Jan 2009 7:38]
Lenz Grimmer
Requesting a re-triage of this one.
[16 Jan 2009 10:14]
Markus Moll
I have tried to modify the makefiles myself in order to create a shared libmysqld. The smaller libraries that libmysqld depends on (mysys, strings, regex, vio...) can easily be changed to use libtool. However, libmysqld has a special treatment for Metrowerks on MacOS (a few object files seem to be linked in twice). Is this really necessary (don't have a mac)? And wouldn't it be cleaner to depend on the sources directly and let libtool do the work? This way, the problem of including object files more than once wouldn't exist. Anyway, there might be some problem with the build process that I don't see.
[23 Jan 2009 0:18]
Elias Probst
Please take a look at the bugreport [1] filed at the Gentoo bugtracker. There are a lot details about the whole problem + a partially working patch [2] for the MySQL makefiles. [1] Bugreport: http://bugs.gentoo.org/show_bug.cgi?id=238487 [2] Patch: http://bugs.gentoo.org/show_bug.cgi?id=238487#c47 Regards, Elias P.
[2 Apr 2009 5:42]
Jannick Kuhr
There is a new (at least for me) working patch against mysql in gentoo's bugzilla: Bug: http://bugs.gentoo.org/show_bug.cgi?id=238487 Patch: http://bugs.gentoo.org/attachment.cgi?id=186704 Perhaps it is worth a review?
[16 Apr 2009 22:33]
Jorge Manuel B. S. Vicetto
Following up on the last comment, if you want to check the patches for mysql-5.0.76 and mysql-community-5.0.77, here are the direct links: mysql-5.0.76 - http://git.overlays.gentoo.org/gitweb/?p=proj/mysql-extras.git;a=blob_plain;f=0204_all_emb... mysql-community-5.0.77 - http://git.overlays.gentoo.org/gitweb/?p=proj/mysql-extras.git;a=blob_plain;f=0204_all_emb...
[4 May 2009 20:04]
Jeff Mitchell
Unfortunately, the Gentoo patch doesn't work properly. When the patch is applied, regardless of whether you're running on x86 or x86_64, if you try to run Amarok (the one app I know of that's currently using libmysqld) it can't find its library linked against libmysqld unless Amarok is compiled *with* -Wl,--as-needed. No one seems to have figured out why, yet. The Gentoo people hacked around this by forcing -Wl,--as-needed on in their Amarok ebuild, but there is clearly something wrong.
[21 Jul 2009 20:57]
Christian Hammers
Please make libmysqld a proper shared library! The performance issues talked about in http://lists.mysql.com/internals/35950 really seem questionable after reading various posts in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=508406#52 and the following 3-4 postings. On the other hand, static libraries are a PITA when it comes to security updates from which MySQL has had more than one in the past.
[4 Mar 2010 21:20]
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/102373 3126 Vladislav Vaintroub 2010-03-04 Bug#39288 : create a shared libmysqld.so. Plugins are unlikely to work with libmysqld.so, as we do _not_ force plugin to export all symbols. Exporting all symbols is definitely possible, on some platforms with whole-archive, -rdynamic or similar hacks. However, it makes much more sense to finish the "Server API" so neither mysqld nor libmysqld needs to export anything.
[7 Sep 2010 21:36]
Lenz Grimmer
Possible patch for 5.1: http://dev.gentoo.org/~reavertm/mysql-5.1.50-use-libtool.patch
[7 Sep 2010 21:56]
Lenz Grimmer
Another related bug report in the Gentoo Bug tracker: https://bugs.gentoo.org/show_bug.cgi?id=306315
[27 Oct 2010 11:21]
Kristian Nielsen
Here is a direct link to the patch for this that is now included in Gentoo: http://git.overlays.gentoo.org/gitweb/?p=proj/mysql-extras.git;a=blob;f=02040_all_embedded...
[23 Dec 2010 20:55]
Sveta Smirnova
Bug #59104 was marked as duplicate of this one.
[14 Jan 2013 5:58]
Ramesh Maddali
Message from Danny: Old e-mail from 2010 indicates that this bug is fixed in 5.5+. Does it still need to be fixed in 5.1? Building all the objects that go into the library archive with -fPIC is not a minor change and affects all other binaries. -ramesh
[14 Jan 2013 11:06]
Erlend Dahl
Closing on behalf of Ramesh.