mysql_server_init: referenced symbol not found

"Preston, Lance A" <[email protected]>
Newsgroups gmane.comp.db.mysql.perl
Message-ID <99427D3108E4EF40854E1827D973CB12351A69@usplm204.amer.corp.eds.com>
After compiling and installing DBI 1.54 and DBD:mysql 4.004 on Solaris 8
(64-bit sparc), I get a "referenced symbol not found" error:

ld.so.1: test_mysql_access.pl: fatal: relocation error: file
/usr/local/lib/perl5/site_perl/5.8.7/sun4-solaris/auto/DBD/mysql/mysql.s
o: symbol mysql_server_init: referenced symbol not found

I believe I'm having trouble linking to
/usr/local/mysql/lib/libmysqlclient.a, because running "ldd -r" on
mysql.so turns up lots of missing references:

# ldd -r
/usr/local/lib/perl5/site_perl/5.8.7/sun4-solaris/auto/DBD/mysql/mysql.s
o
        librt.so.1 =>    /usr/lib/librt.so.1
        libgen.so.1 =>   /usr/lib/libgen.so.1
        libsocket.so.1 =>        /usr/lib/libsocket.so.1
        libnsl.so.1 =>   /usr/lib/libnsl.so.1
        libm.so.1 =>     /usr/lib/libm.so.1
        libc.so.1 =>     /usr/lib/libc.so.1
        libaio.so.1 =>   /usr/lib/libaio.so.1
        libdl.so.1 =>    /usr/lib/libdl.so.1
        libmp.so.2 =>    /usr/lib/libmp.so.2
        symbol not found: main
(/usr/local/lib/perl5/site_perl/5.8.7/sun4-solaris/auto/DBD/mysql/mysql.
so)
        /usr/platform/SUNW,Sun-Fire-V440/lib/libc_psr.so.1
        symbol not found: mysql_real_escape_string
(/usr/local/lib/perl5/site_perl/5.8.7/sun4-solaris/auto/DBD/mysql/mysql.
so)
        symbol not found: mysql_server_init
(/usr/local/lib/perl5/site_perl/5.8.7/sun4-solaris/auto/DBD/mysql/mysql.
so)
        symbol not found: mysql_init
(/usr/local/lib/perl5/site_perl/5.8.7/sun4-solaris/auto/DBD/mysql/mysql.
so)
        symbol not found: mysql_options
(/usr/local/lib/perl5/site_perl/5.8.7/sun4-solaris/auto/DBD/mysql/mysql.
so)
        symbol not found: mysql_real_connect
(/usr/local/lib/perl5/site_perl/5.8.7/sun4-solaris/auto/DBD/mysql/mysql.
so)
        symbol not found: mysql_errno
(/usr/local/lib/perl5/site_perl/5.8.7/sun4-solaris/auto/DBD/mysql/mysql.
so)
        symbol not found: mysql_error
(/usr/local/lib/perl5/site_perl/5.8.7/sun4-solaris/auto/DBD/mysql/mysql.
so)
        symbol not found: mysql_sqlstate
(/usr/local/lib/perl5/site_perl/5.8.7/sun4-solaris/auto/DBD/mysql/mysql.
so)
        symbol not found: mysql_commit
(/usr/local/lib/perl5/site_perl/5.8.7/sun4-solaris/auto/DBD/mysql/mysql.
so)
        symbol not found: mysql_rollback
(/usr/local/lib/perl5/site_perl/5.8.7/sun4-solaris/auto/DBD/mysql/mysql.
so)

        <<<<<<<< Output Truncated >>>>>>>>>>>>>>>>>

But I am including the location of mysql.h (/usr/local/mysql/include)
and libmysqlclient.a (/usr/local/mysql/lib) in the build:

# /usr/local/bin/perl Makefile.PL
--mysql_config=/usr/local/mysql/bin/mysql_config.lap PREFIX=/usr/local
I will use the following settings for compiling and testing:

  cflags        (mysql_config) = -I/usr/local/mysql/include
-I/usr/local/lib/perl5/5.8.7/sun4-solaris/CORE
/usr/local/mysql/lib/libmysqlclient.a
  embedded      (guessed     ) = 
  libs          (mysql_config) = -lz -lposix4 -lgen -lsocket -lnsl -lm
-L/usr/local/lib/perl5/5.8.7/sun4-solaris/CORE -lperl
-L/usr/local/mysql/lib -lmysqlclient
  mysql_config  (Users choice) = /usr/local/mysql/bin/mysql_config.lap
  nocatchstderr (default     ) = 0
  nofoundrows   (default     ) = 0
  ssl           (guessed     ) = 0
  testdb        (default     ) = test
  testhost      (default     ) = 
  testpassword  (default     ) = 
  testsocket    (default     ) = 
  testuser      (default     ) = 

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

Using DBI 1.54 (for perl 5.008007 on sun4-solaris) installed in
/usr/local/lib/perl5/site_perl/5.8.7/sun4-solaris/auto/DBI/

# make
gcc -c  -I/usr/local/lib/perl5/site_perl/5.8.7/sun4-solaris/auto/DBI
-I/usr/local/mysql/include
-I/usr/local/lib/perl5/5.8.7/sun4-solaris/CORE
/usr/local/mysql/lib/libmysqlclient.a -DDBD_MYSQL_INSERT_ID_IS_GOOD -g
-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -O    -DVERSION=\"4.004\"  -DXS_VERSION=\"4.004\"
-fPIC "-I/usr/local/lib/perl5/5.8.7/sun4-solaris/CORE"   dbdimp.c
gcc: /usr/local/mysql/lib/libmysqlclient.a: linker input file unused
because linking not done
gcc -c  -I/usr/local/lib/perl5/site_perl/5.8.7/sun4-solaris/auto/DBI
-I/usr/local/mysql/include
-I/usr/local/lib/perl5/5.8.7/sun4-solaris/CORE
/usr/local/mysql/lib/libmysqlclient.a -DDBD_MYSQL_INSERT_ID_IS_GOOD -g
-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -O    -DVERSION=\"4.004\"  -DXS_VERSION=\"4.004\"
-fPIC "-I/usr/local/lib/perl5/5.8.7/sun4-solaris/CORE"   mysql.c
gcc: /usr/local/mysql/lib/libmysqlclient.a: linker input file unused
because linking not done
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/bin/perl myld gcc  -G -L/usr/local/lib
dbdimp.o  mysql.o  -o blib/arch/auto/DBD/mysql/mysql.so   -lz -lposix4
-lgen -lsocket -lnsl -lm -L/usr/local/lib/perl5/5.8.7/sun4-solaris/CORE
-lperl -L/usr/local/mysql/lib -lmysqlclient   
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/Bundle::DBD::mysql.3

# make install
Installing
/usr/local/lib/perl5/site_perl/5.8.7/sun4-solaris/auto/DBD/mysql/mysql.s
o
Files found in blib/arch: installing files in blib/lib into architecture
dependent library tree
Writing
/usr/local/lib/perl5/site_perl/5.8.7/sun4-solaris/auto/DBD/mysql/.packli
st
Appending installation info to
/usr/local/lib/perl5/5.8.7/sun4-solaris/perllocal.pod


I am using Perl 5.8.7, gcc 3.4.6, make 3.81, and mysql 4.1.22  (64-bit)

I also tried adding /usr/local/mysql/lib to my LD_LIBRARY_PATH, but that
does not help. I also had the same issue with DBI 1.53 and DBD:mysql
4.003. 

Why do I get "referenced symbol not found" when the missing references
are defined in libmysqlclient.a and that path is included in the linker?
And what can I do to fix this?

Thanks for your help!

Lance Preston
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.