Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Interfacing 64-bit Perl with 32-bit MySQL from sunfreeware.com on Solaris

by bigmacbear (Monk)
on Jun 01, 2007 at 01:16 UTC ( #618615=perlquestion: print w/replies, xml ) Need Help??

bigmacbear has asked for the wisdom of the Perl Monks concerning the following question:

Just thought I would post this for the benefit of other monks since I was able to find a solution to my problem already.

I was setting up a web server on a Solaris 10 system using an in-house build of Perl and the MySQL binaries from sunfreeware.com (SMCmysql). It so happens that all the packages on sunfreeware.com are built in 32-bit mode, while our in-house Perl package is built in 64-bit mode. I really did not want to re-compile one or the other, although it looks at first like that is the only way around this problem.

My first crack at a solution was to uninstall SMCmysql and install instead the 64-bit binaries from MySQL AB's "community server" download site. With some foresight, I downloaded the same version from both sites (5.0.27). It seemed to work like a champ, although I did have to re-build the Makefile and get rid of the Sun-specific compiler and linker flags (more on this below).

Some weeks or months later, I needed to install PHP on the box, and the simplest solution for that was to install the sunfreeware.com PHP package. Of course, I then had to re-install SMCmysql, which broke the DBD::mysql module I'd so carefully built -- or so I thought. (Actually, in hindsight, that should have continued to work just fine if I'd left it alone, but the next time I tried to rebuild DBD::mysql it did in fact break.)

So I hit Google, and found the answer to making 64-bit Perl, sunfreeware.com's MySQL and DBD:mysql work and play together without re-compiling any packages other than DBD::mysql itself. Here's how:

  1. When you go get SMCmysql from sunfreeware.com, also download the 64-bit MySQL binaries for that version from MySQL AB.
  2. Install SMCmysql in the usual place. Install the other package (named simply "mysql") in an alternate location, say "/root" (using pkgadd -R /root). It will not install completely; that's OK. Add the binary directory thus created (/root/opt/mysql/mysql/bin, don't ask me why) to root's PATH.
  3. Install DBI and DBD::mysql from CPAN.
  4. The latter install will almost certainly fail if you're using gcc, because MySQL AB use the Sun compilers. To get around this, change directory to the newest .cpan/build/DBD-mysql* directory, gather only the -I argument from cflags and the -L and -l arguments from libs in the output of mysql_config (which should be on the screen from the failed build), and feed them to MakeMaker like so: perl Makefile.PL --cflags="I/..." --libs="-L/... -lmysqlclient ...". Then do a make install.
  5. Once you have installed DBD::mysql you can remove the extra binaries with pkgrm -R /root mysql.

Hope this helps.

  • Comment on Interfacing 64-bit Perl with 32-bit MySQL from sunfreeware.com on Solaris

Replies are listed 'Best First'.
Re: Interfacing 64-bit Perl with 32-bit MySQL from sunfreeware.com on Solaris
by robot_tourist (Hermit) on Jun 01, 2007 at 14:01 UTC

    Hi bigmacbear, this is totally over my head (I don't have to use any Sun boxen where I work), but I've had the odd interesting problem with HP-UX systems, though not quite as involved. I think you should also post your advice to whatever related forums and newsgroups you can find (unless you have already done so). I know if I had a problem installing something, even if it was perl related, on an HP-UX box I'd probably search google groups and/or the HP website first.

    How can you feel when you're made of steel? I am made of steel. I am the Robot Tourist.
    Robot Tourist, by Ten Benson

      This was very helpful, but confusing I guess..
      bash-3.00# /usr/local/mysql/bin/mysql_config --libs -L/usr/local/lib -R/usr/local/lib -R/usr/lib -L/usr/local/pgsql/lib -R +/usr/local/pgsql/lib -L/usr/lib -R/usr/openwin/lib -L/usr/openwin/lib + -L/usr/local/ssl/lib -R/usr/local/ssl/lib -L/usr/local/BerkeleyDB.4. +2/lib -R/usr/local/BerkeleyDB.4.2/lib -L/usr/X11R6/lib -R/usr/X11R6/l +ib -L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lposix4 -lgen -ls +ocket -lnsl -lm -L/usr/local/ssl/lib -lssl -lcrypto bash-3.00# /usr/local/mysql/bin/mysql_config --cflags -I/usr/local/mysql/include/mysql -L/usr/local/pgsql/lib -R/usr/local/ +pgsql/lib -L/usr/local/lib -R/usr/local/lib -L/usr/local/ssl/lib -R/u +sr/local/ssl/lib -L/usr/openwin/lib -R/usr/openwin/lib -I/usr/local/r +rdtool-1.2.19/include -DHAVE_RWLOCK_T
      Now you can run
      /usr/local/bin/perl --cflags "-I/usr/local/mysql/include/mysql -L/usr +/local/pgsql/lib -R/usr/local/pgsql/lib -L/usr/local/lib -R/usr/local +/lib -L/usr/local/ssl/lib -R/usr/local/ssl/lib -L/usr/openwin/lib -R/ +usr/openwin/lib -I/usr/local/rrdtool-1.2.19/include -DHAVE_RWLOCK_T +" and --libs="-L/usr/local/lib -R/usr/local/lib -R/usr/lib -L/usr/loc +al/pgsql/lib -R/usr/local/pgsql/lib -L/usr/lib -R/usr/openwin/lib -L/ +usr/openwin/lib -L/usr/local/ssl/lib -R/usr/local/ssl/lib -L/usr/loca +l/BerkeleyDB.4.2/lib -R/usr/local/BerkeleyDB.4.2/lib -L/usr/X11R6/lib + -R/usr/X11R6/lib -L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lp +osix4 -lgen -lsocket -lnsl -lm -L/usr/local/ssl/lib -lssl -lcrypto"
      it will differ on every system, but the mysql_config will tell you. after, you will probably still be screwed a little.. remember to: export LD_LIBRARY_PATH=/usr/local/mysql/lib/myql etc...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://618615]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2019-07-20 17:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?