From: Warren Young Date: November 12 2010 9:31pm Subject: Re: Link error when building mysql++-3.1.0 with --as-needed List-Archive: http://lists.mysql.com/plusplus/9118 Message-Id: <4CDDB23A.6070701@etr-usa.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 11/12/2010 2:03 PM, Adrian Cornish wrote: > As far as I can determine all that matters is that -lmysqlpp_ssqls2parse > comes before -Wl,--as-needed. If true, that's a screwy way for the GNU linker to implement that feature. I assume Gentoo is adding this flag by diddling autoconf somehow, so it can inject this option into LDFLAGS. There's no easy way that code can figure out that some -l flags refer to static helper libraries and others to dynamic ones, so it has to do something simple like prepend it blindly. We *could* fix it in MySQL++ by doing without helper libraries entirely, rebuilding all the ssqls2parse modules separately for each program that used them so they just appear among *.o for that program's link command. That's quite inefficient, however. Andrew, you say Gentoo would reject a patch that removed --as-needed for MySQL++. Unless there are serious penalties for doing that, I don't see why. This sounds like a small tweak, a nice thing to have for programs that cope with it, but not something worth fighting over. If you're right and they do reject such a patch, you could instead offer a patch that manually reorders the LDFLAGS=foo... line in the Makefile after the "configure" step. That's more work for you, but there should be no way to argue against that. Regardless, I retract my suggestion that we involve the Bakefile maintainer in this. His code is doing the right thing already.