http://www.perlmonks.org?node_id=1051543

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

Hi Monks,

I am new to this community. I am not an expert in the perl but I know something to start with.

I have a Linux system in which perl 5.8.8 (64 bit) and perl 5.8.0 (32 bit) is installed. I have a lib xxxxx which is 32 bit. and I didnt had DBI and DBD.

I had to use DBI and xxxxx in a perl script. There is no internet connection directly from linux system. but once downloded on my desktop i can transfer the file to the linux system.

I downloaded DBI-1.628 and DBD 1.16 and installed successfully. configured the path in environment accordingly

Now I was successfuly using DBI. But when I added xxxxx it gave an error as it was a 32 bit lib. so I configured my PATH variable accordingly and was able to use 32 bit perl.

Not it is giving error for DBI ELFFCLASS64. I also tried uninstalling DBI and installing it again with perl 32 bit. But can't get success in getting 32 bit DBI.so it is generating 64 bit DBI.so only.

Seeking your help. Any help will be appriciated.

Thanks in Advance.

Replies are listed 'Best First'.
Re: Installing 32 BIT DBI and DBD
by kevbot (Vicar) on Aug 30, 2013 at 05:17 UTC
    If you can, you may want to consider using perlbrew. You can install a specific version of perl, and you can force it to install a 32-bit version of perl. See this post for instructions on how to install a 32-bit perl using perlbrew. Although that node is specific to Mac OS X, I think it should also work on linux. After installation of your 32-bit perl using perlbrew, you can switch to that version of perl using the perlbrew command line application. Then, that particular perl installation should work with 32-bit libraries.
      Hi Kevbot, The first thin I am looking for is in my scenerio is there seperate package for 32 bit DBI or there is some configuration missing in my environment. Thanks, Gaurav
        That doesn't quite make sense, which means there are way too many details missing. some module xxxxx that ... throws some... 32bit error of some sort? That is not a lot to work with, although I've heard of 32bit errors
Re: Installing 32 BIT DBI and DBD
by gaurav_herein (Novice) on Aug 30, 2013 at 06:59 UTC
    Hi Kevbot, xxxxx is throwing ELFCLASS32 error and DBI is working fine when using 64 bit perl. AND xxxxx is working fine and DBI is throwing ELFCLASS64 error when using 32 bit perl Thanks.

      so the one-bittness perl is loading another-bitness .so and complaining?

      In that case you've got a path problem, you gotta make sure the 32bit-ness programs can't see the the 64bit-ness paths. Change LD_LIBRARY_PATH, figure out the paths like ldd -v ..so like this ...

        Its set to 32 bit lib of oracle. and PERL5LIB is set to 32 bit perl
Re: Installing 32 BIT DBI and DBD
by gaurav_herein (Novice) on Aug 30, 2013 at 11:44 UTC
    I have set the path that by default it will pick 32 bit perl Still i am getting 64 bit DBI.so. I dont know where I am going wrong. when I give the command perl -v it give me the details
Re: Installing 32 BIT DBI and DBD
by gaurav_herein (Novice) on Sep 02, 2013 at 04:18 UTC
    Hi Monks, I am still not able to get out from this

      Hi Monks, I am still not able to get out from this

      And then what happened? Sorry, but I don't think we can help you, can you guess/imagine why?

      Whenever someone asks a question or makes a suggestion, your response is yes, i've tried that, I know I've done it right ... but its not working

      There isn't a whole lot left to try :)

Re: Installing 32 BIT DBI and DBD
by gaurav_herein (Novice) on Sep 03, 2013 at 04:59 UTC

    Finally with some work around I fixed it. yeeepeee..!!!

    Here is the steps I took.

    1. changed "CC = gcc" to "CC = gcc -m32"

    2. changed " LD_RUN_PATH="$(LD_RUN_PATH)" $(LD) $(LDDLFLAGS) $(LDFROM) $(OTHERLDFLAGS) -o $@ $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) $(PERL_ARCHIVE_AFTER) $(EXPORT_LIST) $(CHMOD) $(PERM_RWX) $@"

    to

    "$(CC) $(LDDLFLAGS) $(LDFROM) $(OTHERLDFLAGS) -o $@ $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) $(PERL_ARCHIVE_AFTER) $(EXPORT_LIST) $(CHMOD) $(PERM_RWX) $@"

    This worked in installing 32 bit DBI.

    in installing DBD I changed lib to lib32 to the paths which were pointing to oracle 64 bit client lib which was at 3-4 places.

    This worked installing DBD 32 bit.

    Updating for others references.

    Thanks

      Finally with some work around I fixed it. yeeepeee..!!! Here is the steps I took. Updating for others references.

      Congratulations, I know that feeling :)

      So you hacked Makefile? That works. The following might also work

      Before running Makefile.PL

      export CFLAGS='-m32' export CXXFLAGS='-m32' export LDFLAGS='-m32'

      Or as arguments to Makefile.PL

      perl Makefile.PL CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32

      This should propagate -m32 as arguments to gcc/ldd

        OK. I will try this as well on other server next time.

        Thanks Guys :)