系统开发反馈用cpan 安装 perl 的mysql 模块装不上,报错,mysql 的home 目录在 /home/mysql 下。后面搞不定,让我去看看啥情况。
我试着看了一下:cpan 过程中有这么一个错,
gcc -c -I/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -DDBD_MYSQL_WITH_SSL -DDBD_MYSQL_INSERT_ID_IS_GOOD -g -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DVERSION=\"4.024\" -DXS_VERSION=\"4.024\" -fPIC "-I/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE" dbdimp.c
In file included from dbdimp.c:20:
dbdimp.h:23:49: error: mysql.h: No such file or directory
dbdimp.h:24:45: error: mysqld_error.h: No such file or directory
dbdimp.h:26:49: error: errmsg.h: No such file or directory
上面的提示是没有找到 mysql 的include 目录,这个做了一个软链接后,错误消失
继续cpan 方式安装,报错如下:
gcc -c -I/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI -I/home/mysql/include/mysql -Wreturn-type -Wtrigraphs -W -Wformat -Wsign-compare -Wunused-function -Wunused-value -Wunused-parameter -fno-omit-frame-pointer -g -DUNIV_LINUX -DDBD_MYSQL_INSERT_ID_IS_GOOD -g -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DVERSION=\"4.024\" -DXS_VERSION=\"4.024\" -fPIC "-I/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE" mysql.c
./mysql.xsi: In function 'XS_DBD__mysql__dr_dbixs_revision':
./mysql.xsi:36: error: 'DBIXS_REVISION' undeclared (first use in this function)
./mysql.xsi:36: error: (Each undeclared identifier is reported only once
./mysql.xsi:36: error: for each function it appears in.)
mysql.xs: In function 'XS_DBD__mysql__db_do':
mysql.xs:367: warning: comparison is always false due to limited range of data type
mysql.xs:368: warning: comparison is always false due to limited range of data type
mysql.xs:262: warning: unused variable 'statement_ptr'
mysql.xs: In function 'XS_DBD__mysql__st_more_results':
mysql.xs:693: warning: unused variable 'retval'
make: *** [mysql.o] Error 1
看报的error,这种提示似乎是版本不兼容。后面我单独把这个版本的源码下载下来,报错同上。
实在想不出是不是其它问题,换一个版本试试,我发现客户端呆版本是 5.1 的,所以找一个旧一点的 模块试试:
[root@APP DBD-mysql-4.006]# perl Makefile.PL
Cannot find the file 'mysql_config'! Your execution PATH doesn't seem
not contain the path to mysql_config. Resorting to guessed values!
Failed to determine directory of libmysqlclient.a|libmysqlclient.so. Use
perl Makefile.PL "--libs=-L<dir> -lmysqlclient -lz -lm -lcrypt -lnsl"
to set this directory. For details see the INSTALL.html file,
section "Linker flags" or type
perl Makefile.PL --help
按照提示,这里需要指定mysql 库的位置
[root@APP DBD-mysql-4.006]# perl Makefile.PL "--libs=-L/home/mysql/lib/mysql/ -lmysqlclient -lz -lm -lcrypt -lnsl"
Cannot find the file 'mysql_config'! Your execution PATH doesn't seem
not contain the path to mysql_config. Resorting to guessed values!
I will use the following settings for compiling and testing:
cflags (guessed ) = -I/usr/include/mysql
embedded (guessed ) =
libs (User's choice) = -L/home/mysql/lib/mysql/ -lmysqlclient -lz -lm -lcrypt -lnsl
mysql_config (guessed ) = mysql_config
nocatchstderr (default ) = 0
nofoundrows (default ) = 0
ssl (guessed ) = 0
testdb (default ) = test
testhost (default ) =
testpassword (default ) =
testsocket (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.52 (for perl 5.008008 on x86_64-linux-thread-multi) installed in /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI/
Writing Makefile for DBD::mysql
[root@SHANGH21-46-DX-APP DBD-mysql-4.006]# make
cp lib/DBD/mysql.pm blib/lib/DBD/mysql.pm
cp lib/DBD/mysql/GetInfo.pm blib/lib/DBD/mysql/GetInfo.pm
cp lib/DBD/mysql/INSTALL.pod blib/lib/DBD/mysql/INSTALL.pod
cp lib/Bundle/DBD/mysql.pm blib/lib/Bundle/DBD/mysql.pm
gcc -c -I/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI -I/usr/include/mysql -DDBD_MYSQL_INSERT_ID_IS_GOOD -g -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DVERSION=\"4.006\" -DXS_VERSION=\"4.006\" -fPIC "-I/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE" dbdimp.c
dbdimp.c: In function 'alloc_param':
dbdimp.c:112: warning: comparison is always false due to limited range of data type
dbdimp.c: In function 'alloc_bind':
dbdimp.c:130: warning: comparison is always false due to limited range of data type
dbdimp.c: In function 'alloc_fbind':
dbdimp.c:146: warning: comparison is always false due to limited range of data type
dbdimp.c: In function 'alloc_fbuffer':
dbdimp.c:161: warning: comparison is always false due to limited range of data type
dbdimp.c: In function 'parse_params':
dbdimp.c:464: warning: implicit declaration of function 'parse_number'
dbdimp.c: In function 'dbd_discon_all':
dbdimp.c:1946: warning: unused variable 'imp_xxh'
dbdimp.c: In function 'mysql_st_prepare':
dbdimp.c:2330: warning: unused variable 'limit_flag'
/usr/bin/perl -p -e "s/~DRIVER~/mysql/g" /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI/Driver.xst > mysql.xsi
/usr/bin/perl /usr/lib/perl5/5.8.8/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.8.8/ExtUtils/typemap mysql.xs > mysql.xsc && mv mysql.xsc mysql.c
Warning: duplicate function definition 'do' detected in mysql.xs, line 225
Warning: duplicate function definition 'rows' detected in mysql.xs, line 612
gcc -c -I/usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBI -I/usr/include/mysql -DDBD_MYSQL_INSERT_ID_IS_GOOD -g -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DVERSION=\"4.006\" -DXS_VERSION=\"4.006\" -fPIC "-I/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE" mysql.c
mysql.xs: In function 'XS_DBD__mysql__db_do':
mysql.xs:315: warning: comparison is always false due to limited range of data type
mysql.xs:316: warning: comparison is always false due to limited range of data type
mysql.xs:239: warning: unused variable 'statement_ptr'
mysql.xs: In function 'XS_DBD__mysql__st_more_results':
mysql.xs:550: warning: implicit declaration of function 'mysql_st_next_results'
mysql.xs:549: warning: unused variable 'retval'
mysql.xs: In function 'XS_DBD__mysql__GetInfo_dbd_mysql_get_info':
mysql.xs:686: warning: implicit declaration of function 'is_prefix'
Running Mkbootstrap for DBD::mysql ()
chmod 644 mysql.bs
rm -f blib/arch/auto/DBD/mysql/mysql.so
/usr/bin/perl myld gcc -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic dbdimp.o mysql.o -o blib/arch/auto/DBD/mysql/mysql.so \
-L/home/mysql/lib/mysql/ -lmysqlclient -lz -lm -lcrypt -lnsl \
chmod 755 blib/arch/auto/DBD/mysql/mysql.so
cp mysql.bs blib/arch/auto/DBD/mysql/mysql.bs
chmod 644 blib/arch/auto/DBD/mysql/mysql.bs
Manifying blib/man3/DBD::mysql.3pm
Manifying blib/man3/DBD::mysql::INSTALL.3pm
Manifying blib/man3/Bundle::DBD::mysql.3pm
[root@SHANGH21-46-DX-APP DBD-mysql-4.006]# make install
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/mysql/mysql.so
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/mysql/mysql.bs
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/Bundle/DBD/mysql.pm
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/mysql.pm
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/mysql/GetInfo.pm
Installing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/mysql/INSTALL.pod
Installing /usr/share/man/man3/DBD::mysql::INSTALL.3pm
Installing /usr/share/man/man3/Bundle::DBD::mysql.3pm
Installing /usr/share/man/man3/DBD::mysql.3pm
Writing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/mysql/.packlist
Appending installation info to /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/perllocal.pod
[root@APP DBD-mysql-4.006]#
ps: linux 下版本的各种不兼容导致的报错遇到不是头一回了,主要是要有耐心。
没有评论:
发表评论