On Fri, Nov 12, 2010 at 1:11 PM, Warren Young <mysqlpp@stripped> wrote:
> On 11/12/2010 11:58 AM, Warren Young wrote:
>> On Nov 12, 2010, at 9:44 AM, Adrian Cornish wrote:
>> This is related to link order, please place static library
>>> mysqlpp_ssqls2parser before the "--as-needed" flag and it will link
>>> g++ -o test_ssqls2 test_ssqls2_ssqls2.o -lmysqlpp_ssqls2parse
>>> -Wl,--as-needed -L. -L/usr/local/lib/mysql -lmysqlclient -lmysqlpp
>> To make that fix apply to MySQL++, you'd have to patch Bakefile, or
>> convince the maintainer to do it for you. There's nothing in
>> mysql++.bkl you can change to force -l flags to appear before -L.
> On thinking more about it, I don't even see why Vaclav (the Bakefile
> maintainer) would accept that solution. -L *should* appear before -l.
> There has to be a better solution. I can't believe this is the only
> command line ordering g++ will accept to give the right result.
As far as I can determine all that matters is that -lmysqlpp_ssqls2parse
comes before -Wl,--as-needed. If it is after it appears gcc cannot work out
that some functions needed to be included from the .so files to link against
the static .a library. The path stuff does not seem to be relevant. I would
also assume that all the .so libraries should be after the -Wl,--as-needed
since the whole point of it seems to be to only link in used functions.