I am trying to install DBD-mysql-4.022 on RHEL5 2.6.18-194.el5 box. I have two versions of Perl on the given box (5.8.8 - default & 5.16.1)

Installation of DBD-mysql-4.022 failed with the following error:

# Error: Can't load '/root/.cpan/build/DBD-mysql-4.022/blib/arch/ +auto/DBD/mysql/mysql.so' for module DBD::mysql: /root/.cpan/build/DBD +-mysql-4.022/blib/arch/auto/DBD/mysql/mysql.so: undefined symbol: mys +ql_get_server_version at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-m +ulti/DynaLoader.pm line 230.

I found that this can be fixed by specifying path to libmysqlclient.a

Ref: http://cpansearch.perl.org/src/JWIED/DBD-mysql-2.1012/INSTALL.html#known%20problems
[root@RHEL5 DBD-mysql-4.022]# perl Makefile.PL --libs='/usr/lib64/mysq +l/libmysqlclient.a' PLEASE NOTE: For 'make test' to run properly, you must ensure that the database user 'root' can connect to your MySQL server and has the proper privileges that these tests require such as 'drop table', 'create table', 'drop procedure', 'create procedure' as well as others. mysql> grant all privileges on test.* to 'root'@'localhost' identified + by 's3kr1t'; You can also optionally set the user to run 'make test' with: perl Makefile.PL --testuser=username I will use the following settings for compiling and testing: cflags (mysql_config ) = -I/usr/include/mysql -g -pipe -Wp,-D +_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-s +ize=4 -m64 -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-stric +t-aliasing -DMY_PTHREAD_FASTMUTEX=1 embedded (mysql_config ) = libs (User's choice) = /usr/lib64/mysql/libmysqlclient.a mysql_config (guessed ) = mysql_config nocatchstderr (default ) = 0 nofoundrows (default ) = 0 ssl (guessed ) = 0 testdb (default ) = test testhost (default ) = testpassword (default ) = testsocket (default ) = testuser (guessed ) = root To change these settings, see 'perl Makefile.PL --help' and 'perldoc INSTALL'. Checking if your kit is complete... Looks good Unrecognized argument in LIBS ignored: '/usr/lib64/mysql/libmysqlclien +t.a' Multiple copies of Driver.xst found in: /usr/lib64/perl5/site_perl/5.8 +.8/x86_64-linux-thread-multi/auto/DBI/ /usr/lib64/perl5/vendor_perl/5 +.8.8/x86_64-linux-thread-multi/auto/DBI/ at Makefile.PL line 941 Using DBI 1.622 (for perl 5.008008 on x86_64-linux-thread-multi) insta +lled in /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/au +to/DBI/ Writing Makefile for DBD::mysql Writing MYMETA.yml and MYMETA.json
As we can see above, DBD-mysql is referring to the default (5.8.8) perl. I am not sure how to tell Makefile.pl to refer the latest installed perl i.e., 5.16.1. I saw that the Makefile.pl has the following entry to find the perl installation:
use Config; exec ($Config{perlpath}, $0, @ARGV )|| die $!;
Now i know that if i prepend my latest (5.16.1) perl installation path to the variable PATH, it might work but my concern is that later if i revert the settings in PATH, then will DBD-mysql still use Perl version 5.16.1? I am asking this mainly because i don't want to disturb the existing PATH settings for applications that require Perl 5.8.8 and at the same time want to ensure that DBD-mysql always refers the latest perl i.e., 5.16.1.

Also, how can i undo what i have done by using perl Makefile.PL --libs='/usr/lib64/mysql/libmysqlclient.a' just to make sure that everything is clean?


In reply to Specify particular Perl path to a module during installation by Technext

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.