Steve Sapovits | 2 Feb 05:48 2003

Solaris 2.7 run time linking problem


I posted this to PerlMonks and an earlier version to the DBI mailing
list.  Any ideas?
----

I have a problem on Solaris 2.7 that's stumped me. I have rather
large Perl installations on 2 Solaris boxes: 1 Solaris 2.7; the
other 2.8. Each has over 250 CPAN modules loaded, as well as a
number of prerequisite libraries. Both use GNU (gcc) build
environments. Both appear to be using the same versions of all
software.

Friday, I went to install DBD::mysql. I already had this loaded
on the 2.8 box. I built it there against a recent Solaris binary
download of mysql. No problems ... all tests pass, etc. On the
2.7 box I'm stuck. Everything builds okay but all the tests yield
errors like this:

t/00base............install_driver(mysql) failed: Can't load 'blib/arch/auto/DBD
/mysql/mysql.so' for module DBD::mysql: ld.so.1: /usr/local/bin/perl: fatal: 
relocation error: file blib/arch/auto/DBD/mysql/mysql.so: symbol 
mysql_real_escape_string: referenced symbol not found at 
/usr/local/lib/perl5/5.6.1/sun4-solaris/DynaLoader.pm line 206.
  at (eval 1) line 3
Compilation failed in require at (eval 1) line 3.
Perhaps a required shared library or dll isn't installed where expected

Basically it looks like at run-time the mysql client library is missing
in action. I've been building freeware for some time so I checked all
the obvious things: missing shared libraries, unset LD_LIBRARY_PATH,
(Continue reading)

Jochen Wiedmann | 2 Feb 21:48 2003
Picon

Re: Solaris 2.7 run time linking problem

Quoting Steve Sapovits <sapovitss <at> gsicommerce.com>:

> relocation error: file blib/arch/auto/DBD/mysql/mysql.so: symbol 
> mysql_real_escape_string: referenced symbol not found at 

This could indicate a problem with the version of MySQL you
are using: The current driver requires a version with the
"mysql_real_escape_string" function (do not remember which
version introduced that).

If I may be right, try installing a new version (the client
libraries are sufficient and you may use the configure
option --without-server).

Good luck,

Jochen

---------------------------------------------------------------------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread2015 <at> lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe <at> lists.mysql.com instead.

Steve Sapovits | 2 Feb 22:04 2003

Re: Solaris 2.7 run time linking problem

Jochen Wiedmann wrote:

> This could indicate a problem with the version of MySQL you
> are using: The current driver requires a version with the
> "mysql_real_escape_string" function (do not remember which
> version introduced that).
> 
> If I may be right, try installing a new version (the client
> libraries are sufficient and you may use the configure
> option --without-server).

I checked and that function is in all versions I tried.
Plus, I get other unresolved references in other tests.
Basically, it doesn't see the MySQL client libs at all,
no matter how I try building/linking the DBD::mysql piece.

I suspect it's an issue of Solaris 5.7 not having the
right link options to pull all the correct objects into
the mysql.so shared object DBD::mysql creates at build
time.  But I've tried about everything I know of there
and no luck ...

--

-- 
Steve Sapovits    GSI Commerce, Inc.    http://www.gsicommerce.com
Email:   sapovitss <at> gsicommerce.com
Work:    610-491-7087
Mobile:  610-574-7706
Pager:   877-239-4017

---------------------------------------------------------------------
(Continue reading)

Jochen Wiedmann | 2 Feb 22:12 2003
Picon

Re: Solaris 2.7 run time linking problem

Quoting Steve Sapovits <sapovitss <at> gsicommerce.com>:

> I suspect it's an issue of Solaris 5.7 not having the
> right link options to pull all the correct objects into
> the mysql.so shared object DBD::mysql creates at build
> time.  But I've tried about everything I know of there
> and no luck ...

Try using a static library.

---------------------------------------------------------------------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread2017 <at> lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe <at> lists.mysql.com instead.

Steve Sapovits | 2 Feb 22:15 2003

Re: Solaris 2.7 run time linking problem

Jochen Wiedmann wrote:

> Try using a static library.

I started down this path a bit.  But I think to do that I have
to build the DBD::mysql piece into the Perl binary itself.  Not
something I really want to do -- I need to be able to easily
upgrade, etc.   Very frustrating since it works out of the box
on Solaris 2.8 systems and since other DynaLoader loaded pieces
for other Perl modules work okay.  I've been comparing the makes
and have not found any obvious differences.

--

-- 
Steve Sapovits    GSI Commerce, Inc.    http://www.gsicommerce.com
Email:   sapovitss <at> gsicommerce.com

---------------------------------------------------------------------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread2018 <at> lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe <at> lists.mysql.com instead.

Jochen Wiedmann | 2 Feb 23:44 2003
Picon

Re: Solaris 2.7 run time linking problem

Quoting Steve Sapovits <sapovitss <at> gsicommerce.com>:

> I started down this path a bit.  But I think to do that I have
> to build the DBD::mysql piece into the Perl binary itself.  Not
> something I really want to do -- I need to be able to easily
> upgrade, etc.   Very frustrating since it works out of the box
> on Solaris 2.8 systems and since other DynaLoader loaded pieces
> for other Perl modules work okay.  I've been comparing the makes
> and have not found any obvious differences.

There is absolutely no reason to build a statically linked
Perl. The driver was even developed on Solaris in the
beginning.

Jochen

---------------------------------------------------------------------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread2019 <at> lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe <at> lists.mysql.com instead.

Steve Sapovits | 3 Feb 04:06 2003

Re: Solaris 2.7 run time linking problem

Jochen Wiedmann wrote:

> There is absolutely no reason to build a statically linked
> Perl. The driver was even developed on Solaris in the
> beginning.

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'm talking about the DBD::mysql piece.  I'm missing how that
can be static and then become part of a Perl program ... I
believe all other Perl modules I use that have a C code piece
build that piece as a shared library so it can be loaded
dynamically.  Maybe I'm wrong about that though.

I am using a static mysqlclient.a -- I've tried that and the
shared version I built from source.  The make assumes a static
mysqlclient.a by default and that's where most of my attempts
have been directed.

--

-- 
Steve Sapovits    GSI Commerce, Inc.    http://www.gsicommerce.com
Email:   sapovitss <at> gsicommerce.com

---------------------------------------------------------------------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread2020 <at> lists.mysql.com

(Continue reading)

Steve Sapovits | 3 Feb 05:05 2003

Re: Solaris 2.7 run time linking problem


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

(Continue reading)

Jochen Wiedmann | 3 Feb 07:30 2003
Picon

Re: Solaris 2.7 run time linking problem

Zitiere Steve Sapovits <sapovitss <at> gsicommerce.com>:

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

That's not my intention. Specifying options like the name
of the static library is exactly what mysql_config (or
the --libs options) are good for.

However, for the future, it might be helpful, if you could
publish a diff between your original mysql_config and the
current.

Regards,

Jochen

---------------------------------------------------------------------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread2022 <at> lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe <at> lists.mysql.com instead.

Jörgen Myhrman | 6 Feb 08:15 2003
Picon

Perl dynaloader does not find MySQL

Hi!

I cannot get the Perl module DBD-MySQL to work under Win XP. Recieve the
following:

[Wed Feb 05 13:56:20 2003] [error] [client 127.0.0.1] Premature end of
script headers: add_object.pl
[Wed Feb 05 13:56:20 2003] [error] [client 127.0.0.1] Can't load 
C:/Perl/site/lib/auto/DBD/mysql/mysql.dll' for module DBD::mysql:
load_file:Det gr inte att hitta den angivna modulen at
C:/Perl/lib/DynaLoader.pm line 229.
[Wed Feb 05 13:56:20 2003] [error] [client 127.0.0.1]  at
C:/wwwroot/cgi-bin/sell/sellit_professional/add_object.pl line 6
[Wed Feb 05 13:56:20 2003] [error] [client 127.0.0.1] Compilation failed in
require at C:/wwwroot/cgi-bin/sell/sellit_professional/add_object.pl line 6.
[Wed Feb 05 13:56:20 2003] [error] [client 127.0.0.1] BEGIN
failed--compilation aborted at
C:/wwwroot/cgi-bin/sell/sellit_professional/add_object.pl line 6.

Yet the mysql.dll is right there...
Should I move the DBD-MySQL files somewhere else?

Best regards,
Jrgen Myhrman
jorgen <at> myhrmans.net

Hi!
(Continue reading)