MySQL, Solaris 9 and DBD::mysql

MySQL, Solaris 9 and DBD::mysql

am 08.12.2004 20:36:38 von Sakshale eQuorian

Hi all;

I have run out of ideas related to getting DBD::mysql to work on a brand
spanking new Solaris 9 system with tons of stuff added from the Solaris
free software site. ( http://www.sunfreeware.com/ )

I've posted the gory details on the mysql install forum.

Ref: http://forums.mysql.com/read.php?11,7767,7767#msg-7767

Pointers would be appreciated.

Thanks
Sakshale


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: MySQL, Solaris 9 and DBD::mysql

am 08.12.2004 22:23:37 von Jochen Wiedmann

Sakshale eQuorian wrote:

>Ref: http://forums.mysql.com/read.php?11,7767,7767#msg-7767
>
>

Your problem is most probably related to the use of shared libraries
(libmysqlclient.so). Try using static libraries as follows:

- Create a new, empty directory. I assume /tmp/mysql-static.
- Copy the shared libraries (libmysqlclient.a, and perhaps others) to
that directory
- Use the "perl Makefile.PL" switch --libs for overriding "myqsl_config
--libs".
(You need the same flags, but replace the default lib directory with
your new
directory. In your case, this might be

perl Makefile.PL --libs=" -L/tmp/mysql-static -lmysqlclient -lposix4
-lcrypt -lgen -lsocket -lnsl -lm -lz"


Jochen


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: MySQL, Solaris 9 and DBD::mysql

am 08.12.2004 23:20:22 von Sakshale eQuorian

> Sakshale eQuorian wrote:
>
>>Ref: http://forums.mysql.com/read.php?11,7767,7767#msg-7767
>>
>>
>
> Your problem is most probably related to the use of shared libraries
> (libmysqlclient.so). Try using static libraries as follows:
>
> - Create a new, empty directory. I assume /tmp/mysql-static.
> - Copy the shared libraries (libmysqlclient.a, and perhaps others) to
> that directory
> - Use the "perl Makefile.PL" switch --libs for overriding "myqsl_config
> --libs".
> (You need the same flags, but replace the default lib directory with
> your new
> directory. In your case, this might be
>
> perl Makefile.PL --libs=" -L/tmp/mysql-static -lmysqlclient -lposix4
> -lcrypt -lgen -lsocket -lnsl -lm -lz"
>
>
> Jochen
>
Thank you for responding.

Unfortunately, that was one of the solutions I had found that did not work
in my instance.... I remember reading a note somewhere about Solaris
not supporting static libraries without some optional package from Sun.

(notice the use of /usr/ccs in the path)

[src]# cd /usr/local/mysql/lib/mysql/
[mysql]# ls
libdbug.a libmyisam.a libmysqlclient.la* libmystrings.a libvio.a
libheap.a libmyisammrg.a libmysqlclient_r.a libmysys.a
libmerge.a libmysqlclient.a libmysqlclient_r.la* libnisam.a
[mysql]# mkdir /tmp/mysql-static
[mysql]# cp -p *.a /tmp/mysql-static
[mysql]# cd /root/.cpan/build/DBD-mysql-2.9004
[DBD-mysql-2.9004]# make clean
rm -rf mysql.c *.xsi ./blib Makefile.aperl
blib/arch/auto/DBD/mysql/extralibs.all
blib/arch/auto/DBD/mysql/extralibs.ld perlmain.c tmon.out mon.out
so_locations pm_to_blib *.o *.a perl.exe perl perl mysql.bs mysql.bso
mysql.def libmysql.def mysql.exp mysql.x core core.*perl.*.? *perl.core
core.[0-9] core.[0-9][0-9] core.[0-9][0-9][0-9] core.[0-9][0-9][0-9][0-9]
core.[0-9][0-9][0-9][0-9][0-9]
mv Makefile Makefile.old > /dev/null 2>&1
[DBD-mysql-2.9004]#


[DBD-mysql-2.9004]# perl Makefile.PL --libs=" -L/tmp/mysql-static
-lmysqlclient -lposix4 -lcrypt -lgen -lsocket -lnsl -lm -lz"
I will use the following settings for compiling and testing:

cflags (mysql_config) = -I/usr/local/mysql/include/mysql
-fno-omit-frame-pointer
libs (Users choice) = -L/tmp/mysql-static -lmysqlclient
-lposix4 -lcrypt -lgen -lsocket -lnsl -lm -lz
nocatchstderr (default ) = 0
nofoundrows (default ) = 0
ssl (guessed ) = 0
testdb (default ) = test
testhost (default ) =
testpassword (default ) =
testuser (default ) =

To change these settings, see 'perl Makefile.PL --help' and
'perldoc INSTALL'.

Checking if your kit is complete...
Looks good
Using DBI 1.46 (for perl 5.008005 on sun4-solaris) installed in
/usr/local/lib/perl5/site_perl/5.8.5/sun4-solaris/auto/DBI/
Writing Makefile for DBD::mysql
[root@palsrv12 DBD-mysql-2.9004]# make
cp lib/DBD/mysql.pm blib/lib/DBD/mysql.pm
cp lib/DBD/mysql/GetInfo.pm blib/lib/DBD/mysql/GetInfo.pm
cp lib/Mysql.pm blib/lib/Mysql.pm
cp lib/DBD/mysql/INSTALL.pod blib/lib/DBD/mysql/INSTALL.pod
cp lib/Mysql/Statement.pm blib/lib/Mysql/Statement.pm
cp lib/Bundle/DBD/mysql.pm blib/lib/Bundle/DBD/mysql.pm
gcc -B/usr/ccs/bin/ -c
-I/usr/local/lib/perl5/site_perl/5.8.5/sun4-solaris/auto/DBI /
-I/usr/local/mysql/include/mysql -fno-omit-frame-pointer
-fno-strict-aliasing -pipe -I/usr/local/include -I/opt/gnu/include
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O -DVERSION=\"2.9004\"
-DXS_VERSION=\"2.9004\" -fPIC
"-I/usr/local/lib/perl5/5.8.5/sun4-solaris/CORE" dbdimp.c
/usr/local/bin/perl -p -e "s/~DRIVER~/mysql/g"
/usr/local/lib/perl5/site_perl/5.8.5/sun4-solaris/auto/DBI// Driver.xst >
mysql.xsi
/usr/local/bin/perl /usr/local/lib/perl5/5.8.5/ExtUtils/xsubpp -typemap
/usr/local/lib/perl5/5.8.5/ExtUtils/typemap mysql.xs > mysql.xsc && mv
mysql.xsc mysql.c
Warning: duplicate function definition 'do' detected in mysql.xs, line 196
Warning: duplicate function definition 'rows' detected in mysql.xs, line 294
gcc -B/usr/ccs/bin/ -c
-I/usr/local/lib/perl5/site_perl/5.8.5/sun4-solaris/auto/DBI /
-I/usr/local/mysql/include/mysql -fno-omit-frame-pointer
-fno-strict-aliasing -pipe -I/usr/local/include -I/opt/gnu/include
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O -DVERSION=\"2.9004\"
-DXS_VERSION=\"2.9004\" -fPIC
"-I/usr/local/lib/perl5/5.8.5/sun4-solaris/CORE" mysql.c
Running Mkbootstrap for DBD::mysql ()
chmod 644 mysql.bs
rm -f blib/arch/auto/DBD/mysql/mysql.so
LD_RUN_PATH="/usr/lib:/usr/local/lib" /usr/local/bin/perl myld gcc
-B/usr/ccs/bin/ -G -L/usr/local/lib -L/opt/gnu/lib dbdimp.o mysql.o -o
blib/arch/auto/DBD/mysql/mysql.so -L/tmp/mysql-static -lmysqlclient
-lposix4 -lcrypt -lgen -lsocket -lnsl -lm -lz
chmod 755 blib/arch/auto/DBD/mysql/mysql.so
cp mysql.bs blib/arch/auto/DBD/mysql/mysql.bs
chmod 644 blib/arch/auto/DBD/mysql/mysql.bs
Manifying blib/man3/DBD::mysql.3
Manifying blib/man3/DBD::mysql::INSTALL.3
Manifying blib/man3/Mysql.3
Manifying blib/man3/Bundle::DBD::mysql.3
[DBD-mysql-2.9004]#


[DBD-mysql-2.9004]# make test
PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00base...........install_driver(mysql) failed: Can't load
'/root/.cpan/build/DBD-mysql-2.9004/blib/arch/auto/DBD/mysql /mysql.so' for
module DBD::mysql: ld.so.1: /usr/local/bin/perl: fatal: relocation error:
file /root/.cpan/build/DBD-mysql-2.9004/blib/arch/auto/DBD/mysql/ mysql.so:
symbol mysql_get_parameters: referenced symbol not found at
/usr/local/lib/perl5/5.8.5/sun4-solaris/DynaLoader.pm line 230.
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
at t/00base.t line 38
t/00base...........dubious
Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED tests 4-5

[snip]

Failed 17/18 test scripts, 5.56% okay. 727/730 subtests failed, 0.41% okay.
make: *** [test_dynamic] Error 2
[DBD-mysql-2.9004]#



--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: MySQL, Solaris 9 and DBD::mysql

am 09.12.2004 08:44:08 von Jochen Wiedmann

On Wed, 8 Dec 2004 14:20:22 -0800 (PST), Sakshale eQuorian
wrote:

> in my instance.... I remember reading a note somewhere about Solaris
> not supporting static libraries without some optional package from Sun.

That is complete and utter nonsense. Sorry!


> [mysql]# ls
> libdbug.a libmyisam.a libmysqlclient.la* libmystrings.a libvio.a
> libheap.a libmyisammrg.a libmysqlclient_r.a libmysys.a
> libmerge.a libmysqlclient.a libmysqlclient_r.la* libnisam.a

Surprisingly for me, you have no dynamic libraries at all! In other
words, the creation of a separate directory is completely useless,
because it contains the same files.


> t/00base...........install_driver(mysql) failed: Can't load
> '/root/.cpan/build/DBD-mysql-2.9004/blib/arch/auto/DBD/mysql /mysql.so' for
> module DBD::mysql: ld.so.1: /usr/local/bin/perl: fatal: relocation error:
> file /root/.cpan/build/DBD-mysql-2.9004/blib/arch/auto/DBD/mysql/ mysql.so:
> symbol mysql_get_parameters: referenced symbol not found at

And this I do not understand. Think of it like this: If a dynamic
library is used, then the linker attempts to find the symbol at
runtime. This seems to be the case here. If a static library is used,
then the symbol is resolved above, when ld is invoked. (The line
beginning with LD_RUN_PATH.) In other words: If a symbol is missing,
then the linker should complain there.

To sum it up, I can only see two reasonable explanations:

- You have more than one libmysqlclient.* on your system and the
linker picks the wrong
file. This can happen, because your Perl seems to be configured to
look first into
/usr/local/lib /opt/gnu/lib by default.

- The symbol mysql_get_parameters is defined in some other file than
libmysqlclient.a.
Try a

find . -type f -exec grep mysql_get_parameters {} /dev/null \;


Jochen

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org