CPAN and DBD::mysql install failure

N

newsgroups

I am having trouble getting CPAN to install DBD::mysql. Unfortunately
I am not certain what the error means. From looking in previous posts
I saw that mysql_config may have the wrong paths stated. So I fixed
those. But I am still getting the error below. Can anyone point me
towards the solution?

It seems it can't find dbdimp.o and mysql.o. This is true...they don't
exist on the system. But what are they and what program is responsible
for generating them?

gcc3.3.2
perl 5.8.6
solaris 9
mysql 5.0.3 (beta)
"make" is available as I just previously installed CGI and DBI without
issue


ERROR:
<snip>
Checking if your kit is complete...
Looks good
Using DBI 1.48 (for perl 5.008006 on sun4-solaris) installed in
/usr/local/lib/perl5/site_perl/5.8.6/sun4-solaris/auto/DBI/
Writing Makefile for DBD::mysql
cp lib/DBD/mysql.pm blib/lib/DBD/mysql.pm
cp lib/DBD/mysql/GetInfo.pm blib/lib/DBD/mysql/GetInfo.pm
cp lib/Mysql.pm blib/lib/Mysql.pm
cp lib/DBD/mysql/INSTALL.pod blib/lib/DBD/mysql/INSTALL.pod
cp lib/Mysql/Statement.pm blib/lib/Mysql/Statement.pm
cp lib/Bundle/DBD/mysql.pm blib/lib/Bundle/DBD/mysql.pm
gcc -c -I/usr/local/lib/perl5/site_perl/5.8.6/sun4-solaris/auto/DBI/
-I/usr/local/mysql5/include -Xa -xstrconst -mt -D_FORTEC_ -xarch=v9
-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=\"2.9006\" -DXS_VERSION=\"2.9006\" -fPIC
"-I/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE" dbdimp.c
gcc: unrecognized option `-Xa'
gcc: language arch=v9 not recognized
gcc: dbdimp.c: linker input file unused because linking not done
/usr/bin/perl -p -e "s/~DRIVER~/mysql/g"
/usr/local/lib/perl5/site_perl/5.8.6/sun4-solaris/auto/DBI//Driver.xst
mysql.xsi
/usr/bin/perl /usr/local/lib/perl5/5.8.6/ExtUtils/xsubpp -typemap
/usr/local/lib/perl5/5.8.6/ExtUtils/typemap mysql.xs > mysql.xsc && mv
mysql.xsc mysql.c
Warning: duplicate function definition 'do' detected in mysql.xs, line
196
Warning: duplicate function definition 'rows' detected in mysql.xs,
line 294
gcc -c -I/usr/local/lib/perl5/site_perl/5.8.6/sun4-solaris/auto/DBI/
-I/usr/local/mysql5/include -Xa -xstrconst -mt -D_FORTEC_ -xarch=v9
-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=\"2.9006\" -DXS_VERSION=\"2.9006\" -fPIC
"-I/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE" mysql.c
gcc: unrecognized option `-Xa'
gcc: language arch=v9 not recognized
gcc: mysql.c: 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/bin/perl myld gcc -G -L/usr/local/lib
dbdimp.o mysql.o -o blib/arch/auto/DBD/mysql/mysql.so
-L/usr/local/mysql5/lib -lmysqlclient -lz -lposix4 -lcrypt -lgen
-lsocket -lnsl -lm
gcc: dbdimp.o: No such file or directory
gcc: mysql.o: No such file or directory
*** Error code 1
make: Fatal error: Command failed for target
`blib/arch/auto/DBD/mysql/mysql.so'
/usr/ccs/bin/make -- NOT OK
Running make test
Can't test without successful make
Running make install
make had returned bad status, install seems impossible

cpan>
 
S

Sherm Pendley

It seems it can't find dbdimp.o and mysql.o. This is true...they don't
exist on the system. But what are they and what program is responsible
for generating them?

You're looking too far down. Errors like that tend to cascade - quite
often, later errors are triggered by earlier ones. With that in mind...
gcc -c -I/usr/local/lib/perl5/site_perl/5.8.6/sun4-solaris/auto/DBI/
-I/usr/local/mysql5/include -Xa -xstrconst -mt -D_FORTEC_ -xarch=v9
-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=\"2.9006\" -DXS_VERSION=\"2.9006\" -fPIC
"-I/usr/local/lib/perl5/5.8.6/sun4-solaris/CORE" dbdimp.c
gcc: unrecognized option `-Xa'
gcc: language arch=v9 not recognized

This is the first error to appear. The fact that the "-Xa" option
appears immediately after the -I that adds the search path for MySQL
headers leads me to think that it might have been part of the output of
mysql_config.

If that's the case, the the additional definition of -D_FORTEC leads me
to believe that MySQL wasn't built with GCC, but with Sun's Forte C
compiler. So, mysql_config is providing compiler flags that work with
that compiler, but not with GCC.

Try using the CPAN shell to "look DBD::mysql"; that will download and
unpack the module, and open up a subshell in the build directory. From
there, run "mysql_config" by hand to see what its notion of the proper
include and library flags is, and adjust those as needed to build with
GCC instead of Forte.

You can manually provide the adjusted options to Makefile.PL when you
run that. Details can be found in the INSTALL.html file that's included
with DBD::mysql, but in a nutshell it's:

perl Makefile.PL --cflags='-I/foo/bar' --libs='-L/foo/baz'

Another possibility - although I consider it less likely - is that the
problem compiler flags are being produced by Perl itself. To see what
flags Perl is producing, run this:

perl -MConfig -e 'print $Config{ccflags}, "\n"'

If that's where they're coming from, that's a sign that Perl itself was
built with Forte. You might have some luck either hacking Config.pm, or
the generated Makefile to fix the flags to work with GCC.

sherm--
 
R

Robert Mazur

Sherm said:
(e-mail address removed) wrote:

First off, thanks Sherm for taking the time to write such a fantastic,
detailed response.
This is the first error to appear. The fact that the "-Xa" option
appears immediately after the -I that adds the search path for MySQL
headers leads me to think that it might have been part of the output of
mysql_config.

If that's the case, the the additional definition of -D_FORTEC leads me
to believe that MySQL wasn't built with GCC, but with Sun's Forte C
compiler. So, mysql_config is providing compiler flags that work with
that compiler, but not with GCC.
Yes, this is correct. The MySQL version I am using is a binary version
from MySQL...and they used Forte C to compile it for Solaris. So it
sounds like you are on top of the cause.

My perl version is compiled with gcc. I had to roll my own as the
version that came with Solaris 9 was built with cc. Solaris does not
install with a default c compiler, so I use gcc. Well, CPAN would not
build modules using my gcc when the original perl was built using cc.
So I built 5.8.6 with gcc to get CPAN working. And it does.

So it seems that I have reached this point for a number of reasons.
Try using the CPAN shell to "look DBD::mysql"; that will download and
unpack the module, and open up a subshell in the build directory. From
there, run "mysql_config" by hand to see what its notion of the proper
include and library flags is, and adjust those as needed to build with
GCC instead of Forte.

You can manually provide the adjusted options to Makefile.PL when you
run that. Details can be found in the INSTALL.html file that's included
with DBD::mysql, but in a nutshell it's:

perl Makefile.PL --cflags='-I/foo/bar' --libs='-L/foo/baz'
Well, this is certainly a gray area for me, as we are bumped up against
my knowledge barrier for this sort of topic. But I used "look
DBD::mysql", and then ran mysql_config. I see all the options there.
But I'm not sure what to do about them.

So I looked through the Install.html for dbd::mysql and came to the
section saying "If Perl was compiled with gcc or egcs, but MySQL was
compiled with another compiler"....yes this is my situation. As
suggested, while building from the source (without CPAN) I ran:

perl Makefile.PL
--libs='-L/usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.3.2/libgcc.a'

The Makefile builds, but I still get:

<snip>
gcc: unrecognized option `-Xa'
<rob writing: and further down...>
gcc: dbdimp.o: No such file or directory
gcc: mysql.o: No such file or directory
gcc: no input files
*** Error code 1
make: Fatal error: Command failed for target
`blib/arch/auto/DBD/mysql/mysql.so'

So I know that I am still not addressing the problem, but I am not sure
where to go. Part of me is thinking that I should build MySQL with gcc
as well (as suggested by the Install.html). To be honest, I tried that
already too, but ran into build problems with MySQL. But perhaps my
learning efforts ought to be pointed that direction.
Another possibility - although I consider it less likely - is that the
problem compiler flags are being produced by Perl itself. To see what
flags Perl is producing, run this:

perl -MConfig -e 'print $Config{ccflags}, "\n"'
You are correct that this does not seem like the problem.

So yes, I know I need to provide some flags to the Makefile.PL to
indicate the two different compilers that were used. I am still
struggling to figure out exactly what though.

Thanks again Sherm. You have put me on the right track. If you have
further words of wisdom I am very happy to read them. I'll post here a
result should I figure out how to do this.

Thanks!
Rob
 
S

Sherm Pendley

Robert said:
....

So I looked through the Install.html for dbd::mysql and came to the
section saying "If Perl was compiled with gcc or egcs, but MySQL was
compiled with another compiler"....yes this is my situation. As
suggested, while building from the source (without CPAN) I ran:

perl Makefile.PL
--libs='-L/usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.3.2/libgcc.a'

That looks... odd. -L adds a directory to the library search path, but
libgcc.a isn't a directory...

But nit-picking aside, you have the right idea. The "mysql_config"
utility lists several options, --libs and --cflags among them. For
instance, on my machine, it produces (in part):

--cflags [-I/usr/include -fno-omit-frame-pointer]

--libs [-L/usr/lib -lmysqlclient -lz -lm]

To run Makefile.PL with the equivalent options, I'd run:

perl Makefile.PL --libs '-L/usr/lib -lmysqlclient -lz -lm' \
--cflags='-I/usr/include -fno-omit-frame-pointer'

The trick in your case is that what mysql_config produces isn't quite
right. So instead of simply pasting it verbatim, you need to replace the
Forte-specific flags with their GCC equivalents. Unfortunately, I don't
know what the Forte flags mean, so I can't offer anything more specific
than that.

The easiest thing to try would be to simply remove the problematic flags
"-Xa" and "-xarch=v9". Who knows, you might get lucky. Otherwise, you're
in for a bit of a tedious task, looking up each Forte option and then
its GCC equivalent.

sherm--
 
R

Robert Mazur

Sherm said:
Robert Mazur wrote:

But nit-picking aside, you have the right idea. The "mysql_config"
utility lists several options, --libs and --cflags among them. For
instance, on my machine, it produces (in part):

--cflags [-I/usr/include -fno-omit-frame-pointer]

--libs [-L/usr/lib -lmysqlclient -lz -lm]

To run Makefile.PL with the equivalent options, I'd run:

perl Makefile.PL --libs '-L/usr/lib -lmysqlclient -lz -lm' \
--cflags='-I/usr/include -fno-omit-frame-pointer'

The trick in your case is that what mysql_config produces isn't quite
right. So instead of simply pasting it verbatim, you need to replace the
Forte-specific flags with their GCC equivalents. Unfortunately, I don't
know what the Forte flags mean, so I can't offer anything more specific
than that.
sherm--

Thanks again Sherm. I think I am getting the hang of it. I was able to
get Makefile.PL and "make" to complete succesfully with:

perl Makefile.PL
--libs='-L/usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.3.2/
-L/usr/local/mysql5/lib -lmysqlclient -lz -lposix4 -lcrypt -lgen
-lsocket -lnsl -lm' --cflags='-I/usr/local/mysql5/include -xstrconst
-mt' --testuser=<my_real_user> --testpassword=<my_real_pass>

But "make test" reveals that the build is not without errors, as it
returns that I failed 95% of the tests. In reading through MySQL's
docs, it says if Perl reports that it can't find the `../mysql/mysql.so'
module, then it probably can't find `libmysqlclient.so' module. That is
what each one of the errors is reporting.

This is no surprise, as a "find" on my whole system does not reveal this
module. I am guessing the MySQL install is responsible for providing
this...not sure.

So though I'm not up and running, but I feel like I know where I stand
at least. I will keep fighting.

Thanks again Sherm. You've been a terrific help.
Rob
 
R

Robert Mazur

Robert said:
In reading through MySQL's
docs, it says if Perl reports that it can't find the `../mysql/mysql.so'
module, then it probably can't find `libmysqlclient.so' module. That is
what each one of the errors is reporting.

This is no surprise, as a "find" on my whole system does not reveal this
module. I am guessing the MySQL install is responsible for providing
this...not sure.

OK, so I am very slowly crawling through this issue. It seems
DBD::mysql will not build without access to libmysqlclient.so.

Knowing this is my problem, I have now found multiple resources stating
libmysqlclient.so is not available on a binary install of MySQL for
Solaris. Not sure why, but it is not. The solution (as I read) is to
build MySQL from source to get the module in order to build DBD:mysql.

So, I am back to my issue two days ago of not being able to build MySQL
from source due to errors! :) Funny how things come around. But that
is the issue I will now try to conquer.

So it seems my issue is beginning to leave the realm of a "perl issue".
If I am able to get things going, I will return here and post how, for
future stumbling users like myself.

Thanks!
Rob
 
N

newsgroups

Solution to getting DBD::mysql to build:

Build MySQL from source so that the libraries needed for the DBD::mysql
install exist. Some of them are not provided with the binary downloads
of MySQL. This worked for me on both a Solaris9 box, as well as a
SuSE9.1 box using MySQL4.1.11 and perl 5.8.6...both built with gcc.

Note that when installing DBD::mysql, you will want MySQL up and
running, and you will want to be sure you have proper permissions set
to access the database. You may want to install DBD::mysql by hand
(opposed to CPAN) so you can pass user/pass args to be used when perl
tries to access the database. Otherwise you are going to get errors
during the "make test".

Have fun everyone.
Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top