日期:2014-05-16  浏览次数:20668 次

linux 5 x64上安装基础软件的一些错误修复
因项目需要,以下为linux as 5 上安装基础软件时一些错误修复,仅作备忘
1、安装zlib时出现错误
引用
su – dbra
su root
cd  /dbra/app/softs/ruby-1.8.6-p114/ext/zlib             
ruby extconf.rb --with-zlib-dir=/dbra/app/lib/zlib
make
make install

[root@bflinux zlib]# make
gcc -I. -I. -I/dbra/app/lib/ruby/lib/ruby/1.8/x86_64-linux -I. -DHAVE_ZLIB_H  -DOS_CODE=OS_UNIX -I/dbra/app/lib/zlib/include  -O3 -DUSE_MMAP -fPIC -c zlib.c
gcc -shared -o zlib.so zlib.o -L'.' -L'/dbra/app/lib/ruby/lib' -Wl,-R'/dbra/app/lib/ruby/lib' -L'/dbra/app/lib/zlib/lib' -Wl,-R'/dbra/app/lib/zlib/lib' -L.  -rdynamic -Wl,-export-dynamic    -lz  -ldl -lcrypt -lm   -lc
/usr/bin/ld: /dbra/app/lib/zlib/lib/libz.a(adler32.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/dbra/app/lib/zlib/lib/libz.a: could not read symbols: Bad value
collect2: ld 返回 1
make: *** [zlib.so] 错误 1



解决办法 :
重新安装 zlib-1.2.3.tar.gz

tar -zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure

vi Makefile
找到 CFLAGS=-O3 -DUSE_MMAP
在后面加入-fPIC,即变成CFLAGS=-O3 -DUSE_MMAP -fPIC
接下面步骤
make
make install

2、安装openssl错误
引用
su - dbra
su root
cd /dbra/app/softs/ruby-1.8.6-p114/ext/openssl  
rm -rf *.o,openssl.so,Makefile
ruby extconf.rb --with-openssl-dir=/dbra/app/lib/openssl
make
make install

ossl_asn1.c:727: 警告:传递参数 1 (属于 ‘ASN1_get_object’)时在不兼容的指针类型间转换
gcc -I. -I. -I/dbra/app/lib/ruby/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/dbra/app/lib/openssl/include  -fPIC -g -O2  -c ossl_x509cert.c
gcc -I. -I. -I/dbra/app/lib/ruby/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/dbra/app/lib/openssl/include  -fPIC -g -O2  -c ossl_x509req.c
gcc -I. -I. -I/dbra/app/lib/ruby/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/dbra/app/lib/openssl/include  -fPIC -g -O2  -c ossl_pkey_rsa.c
gcc -I. -I. -I/dbra/app/lib/ruby/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/dbra/app/lib/openssl/include  -fPIC -g -O2  -c ossl_pkey_dsa.c
ossl_pkey_dsa.c: In function ‘ossl_dsa_initialize’:
ossl_pkey_dsa.c:141: 警告:传递参数 1 (属于 ‘PEM_ASN1_read_bio’)时在不兼容的指针类型间转换
ossl_pkey_dsa.c:141: 警告:传递参数 4 (属于 ‘PEM_ASN1_read_bio’)时在不兼容的指针类型间转换
ossl_pkey_dsa.c: In function ‘ossl_dsa_to_public_key’:
ossl_pkey_dsa.c:313: 警告:传递参数 2 (属于 ‘ASN1_dup’)时在不兼容的指针类型间转换
gcc -I. -I. -I/dbra/app/lib/ruby/lib/ruby/1.8/x86_64-linux -I. -DRUBY_EXTCONF_H=\"extconf.h\" -I/dbra/app/lib/openssl/include  -fPIC -g -O2  -c ossl_hmac.c
gcc -shared -o openssl.so ossl_engine.o ossl_bio.o ossl_config.o ossl_x509revoked.o ossl_bn.o ossl_cipher.o ossl_x509.o ossl_pkcs7.o ossl_x509ext.o ossl_rand.o ossl.o ossl_pkey_dh.o openssl_missing.o ossl_ssl.o ossl_x509attr.o ossl_x509name.o ossl_digest.o ossl_x509store.o ossl_pkcs12.o ossl_ns_spki.o ossl_x509crl.o ossl_ocsp.o ossl_pkey.o ossl_asn1.o ossl_x509cert.o ossl_x509req.o ossl_pkey_rsa.o ossl_pkey_dsa.o ossl_hmac.o -L'.' -L'/dbra/app/lib/ruby/lib' -Wl,-R'/dbra/app/lib/ruby/lib' -L'/dbra/app/lib/openssl/lib' -Wl,-R'/dbra/app/lib/openssl/lib' -L.  -rdynamic -Wl,-export-dynamic    -lssl -lcrypto  -ldl -lcrypt -lm   -lc
/usr/bin/ld: /dbra/app/lib/openssl/lib/libssl.a(s2_meth.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/dbra/app/lib/openssl/lib/libssl.a: could not read symbols: Bad value
collect2: ld 返回 1
make: *** [openssl.so] 错误 1