1 message in com.mysql.lists.perlcompiling DBD-mysql on HP-UX 11.00 - ...
FromSent OnAttachments
Kangara, Madhu22 Aug 2003 16:16 
Subject:compiling DBD-mysql on HP-UX 11.00 - SOLVED
From:Kangara, Madhu (Madh@T-Mobile.com)
Date:08/22/2003 04:16:40 PM
List:com.mysql.lists.perl

Hi Jochen,

Thanks for giving me the confidence. I recompiled mysql source code with some more gcc options and finally I was sucessful in compiling DBD-mysql

So here is what I have done. 1) Created a new mysql client with gcc 3.2.3 with following options

$ CFLAGS="-fomit-frame-pointer -O3 -fPIC" $ CXX=gcc $ CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti -O3 -fPIC" $ ./configure --without-server --prefix=/usr/local/mysqlc --with-low-memory --enable-thread-safe-client --enable-local-infile --with-pthread --with-lib-ccflags=-fPIC --disable-shared

$ gmake

# gmake install

$ /usr/local/mysqlc/bin/mysql -v Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4429 to server version: 4.0.13

Reading history-file /home/madhu/.mysql_history Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

2) Then compiled DBD-mysql $ pwd /apps/depot/sw/DBD-mysql-2.1026

$ perl Makefile.PL --cflags="-I/usr/local/mysqlc/include/mysql" --libs="-L/usr/l ocal/mysqlc/lib/mysql -L/usr/local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.2.3 -lmys qlclient -lz -lcrypt -lnsl -lm -lgcc" --nocatchstderr I will use the following settings for compiling and testing:

cflags (Users choice) = -I/usr/local/mysqlc/include/mysql libs (Users choice) = -L/usr/local/mysqlc/lib/mysql -L/usr/local/lib/ gcc-lib/hppa2.0n-hp-hpux11.00/3.2.3 -lmysqlclient -lz -lcrypt -lnsl -lm -lgcc nocatchstderr (Users choice) = 1 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.30 installed in /opt/perl/lib/site_perl/5.8.0/PA-RISC2.0/auto/DBI Writing Makefile for DBD::mysql $ gmake cp lib/DBD/mysql.pm blib/lib/DBD/mysql.pm cp lib/DBD/mysql/INSTALL.pod blib/lib/DBD/mysql/INSTALL.pod cp lib/Mysql.pm blib/lib/Mysql.pm cp lib/Mysql/Statement.pm blib/lib/Mysql/Statement.pm cp lib/DBD/mysql.pod blib/lib/DBD/mysql.pod cp lib/Bundle/DBD/mysql.pm blib/lib/Bundle/DBD/mysql.pm gcc -c -I/opt/perl/lib/site_perl/5.8.0/PA-RISC2.0/auto/DBI -I/usr/local/mysqlc/ include/mysql -mpa-risc-2-0 -D_HPUX_SOURCE -fno-strict-aliasing -I/usr/local/inc lude -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"2.1026\" -DXS_ VERSION=\"2.1026\" -fPIC "-I/opt/perl/lib/5.8.0/PA-RISC2.0/CORE" dbdimp.c /opt/perl/bin/perl -p -e "s/~DRIVER~/mysql/g" < /opt/perl/lib/site_perl/5.8.0/PA -RISC2.0/auto/DBI/Driver.xst > mysql.xsi /opt/perl/bin/perl /opt/perl/lib/5.8.0/ExtUtils/xsubpp -typemap /opt/perl/lib/5 .8.0/ExtUtils/typemap mysql.xs > mysql.xsc && mv mysql.xsc mysql.c Warning: duplicate function definition 'rows' detected in mysql.xs, line 291 gcc -c -I/opt/perl/lib/site_perl/5.8.0/PA-RISC2.0/auto/DBI -I/usr/local/mysqlc/ include/mysql -mpa-risc-2-0 -D_HPUX_SOURCE -fno-strict-aliasing -I/usr/local/inc lude -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"2.1026\" -DXS_ VERSION=\"2.1026\" -fPIC "-I/opt/perl/lib/5.8.0/PA-RISC2.0/CORE" mysql.c Running Mkbootstrap for DBD::mysql () chmod 644 mysql.bs rm -f blib/arch/auto/DBD/mysql/mysql.sl LD_RUN_PATH="/usr/local/mysqlc/lib/mysql:/usr/local/lib:/lib:/usr/local/lib/ gcc- lib/hppa2.0n-hp-hpux11.00/3.2.3" /usr/bin/ld -b -L/usr/local/lib dbdimp.o mysql .o -o blib/arch/auto/DBD/mysql/mysql.sl -L/usr/local/mysqlc/lib/mysql -L/usr/ local/lib/gcc-lib/hppa2.0n-hp-hpux11.00/3.2.3 -lmysqlclient -lz -lcrypt -lnsl -l m -lgcc chmod 755 blib/arch/auto/DBD/mysql/mysql.sl cp mysql.bs blib/arch/auto/DBD/mysql/mysql.bs chmod 644 blib/arch/auto/DBD/mysql/mysql.bs Manifying blib/man3/Mysql.3 Manifying blib/man3/DBD::mysql::INSTALL.3 Manifying blib/man3/DBD::mysql.3 Manifying blib/man3/Bundle::DBD::mysql.3 $ gmake test PERL_DL_NONLAZY=1 /opt/perl/bin/perl "-MExtUtils::Command::MM" "-e" "test_harnes s(0, 'blib/lib', 'blib/arch')" t/*.t t/00base...........ok

t/10dsnlist........ok

t/20createdrop.....ok

t/30insertfetch....ok

t/40bindparam......ok

t/40blobs..........ok

t/40listfields.....ok

t/40nulls..........ok

t/40numrows........ok

t/50chopblanks.....ok

t/50commit.........ok

14/30 skipped: No transactions t/60leaks..........skipped all skipped: no reason given t/ak-dbd...........ok

t/akmisc...........ok

t/dbdadmin.........ok

t/insertid.........ok

t/mysql............ok

t/mysql2...........ok

All tests successful, 1 test and 14 subtests skipped. Files=18, Tests=765, 25 wallclock secs ( 4.10 cusr + 0.30 csys = 4.40 CPU)

With regards Madhu

-----Original Message----- From: Jochen Wiedmann [mailto:jo@ispsoft.de] Sent: Friday, August 22, 2003 2:02 PM To: Kangara, Madhu Subject: RE: FW: HELP - compiling DBD-mysql on HP-UX 11.00

Quoting "Kangara, Madhu" <Madh@T-Mobile.com>:

Jochen, I am sure that I have compiled my mysql with following options.( I always document all commands used to make a package)

CFLAGS="-fomit-frame-pointer -O3 -fpic" CXX=gcc \ CXXFLAGS="-felide-constructors -fno-exceptions -fno-rtti -O3" \ ./configure --prefix=/usr/local/mysql --disable-shared

So looks like my mysql lib and executables are non shared version. I tried compiling DBD-mysql as static version. Some how perl Makefile.PL is not accepting those options, especially --libs="/usr/local/mysql/lib/mysql/libmysqlclient.a"

It is complaining about Unrecognized argument in LIBS ignored: '/usr/local/mysql/lib/mysql/libmysqlclien t.a'

DBD-mysql documentations claims this is a valid option.

[...]

/usr/bin/ld: DP relative code in file /usr/local/mysql/lib/mysql/libmysqlclient. a(libmysql.o) - shared library must be position independent. Use +z or +Z to recompile. gmake: *** [blib/arch/auto/DBD/mysql/mysql.sl] Error 1

Silly me! The problem is that your MySQL client library (either of the files libmysqlclient.a or libmysqlclient.so, most possibly the former) isn't compiled with -fPIC!

I believe you used the above options for building libmysqlclient. However, the error message "DP relative code in file ... shared library must be position independent" is quite clear. Isn't it? Try also to enter these phrases into Google and you'll find a lot of messages which all tell the same: The file "libmysql.o" in "/usr/local/mysql/lib/mysql/libmysqlclient.a" is not built for PIC (position independent code).