9 messages in com.mysql.lists.perlRe: Solaris 2.7 run time linking problem
FromSent OnAttachments
Steve Sapovits01 Feb 2003 20:48 
Jochen Wiedmann02 Feb 2003 12:47 
Steve Sapovits02 Feb 2003 13:04 
Jochen Wiedmann02 Feb 2003 13:11 
Steve Sapovits02 Feb 2003 13:15 
Jochen Wiedmann02 Feb 2003 14:43 
Steve Sapovits02 Feb 2003 19:06 
Steve Sapovits02 Feb 2003 20:05 
Jochen Wiedmann02 Feb 2003 22:29 
Subject:Re: Solaris 2.7 run time linking problem
From:Steve Sapovits (sapo@gsicommerce.com)
Date:02/02/2003 08:05:29 PM
List:com.mysql.lists.perl

I wrote:

Okay, so I obviously am missing something then. Any pointers on how to get started down the static path? I looked for 'static' and all I found was some old commented out code in the make ... nothing in the docs for example.

I got it. I was not approaching 'static' the right way.

Following some notes I found on the web, I had been modifying mysql_config. The problem is, that was putting any changes in as link options. What I needed to do was add the static libmysqlclient.a library as one of the mysql.so objects. That is, specify the .a so its objects are extracted and used to build mysql.so, instead of making it a run time link dependency. I'm not sure how Solaris 2.8 gets away with it the other way ... there is no shared libmysqlclient.so there and it somehow does use the static .a at run time. I think it may be a subtle linker difference, where 2.8 sees that there's only a .a and pulls the objects in regardless of where the -lmysqlclient option is found on the command line. When I used 'nm' against the two mysql.so libs created (2.8 and 2.7) it became obvious there was a linker difference. On 2.7 the mysql functions were all UNDEF; not so on 2.8. Same linker line on each.

So line 106 of the generated Makefile now looks like this:

OBJECT = $(O_FILES) /usr/local/mysql/lib/libmysqlclient.a

where it was:

OBJECT = $(O_FILES)

I'm not seeing how to incorporate this into Makefile.PL or if there's something there I missed that generates this.

I did, by the way, find working static options to build mysql.a instead of mysql.so. But the tests for those tried (as I thought) to build a static perl executable linking that in, which failed. That's not a path I wanted to go down anyway.

Maybe someone can figure out how to incorporate this or maybe it's not worth it ... I'm okay knowing I can fix it. Moving forward, my need to run on Solaris 2.7 should go away anyway.

Thanks for all feedback.