3

尝试在 SLES 12-SP2 x86_64 上构建 openssl 1.0.2p 但失败了我以标准用户身份运行以下命令:

cd /usr/src/openssl-1.0.2p
./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib
make

控制台的摘录

make[4]: Entering directory '/usr/src/openssl-1.0.2p'
...
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: libcrypto.a(gost_sign.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
Makefile.shared:169: recipe for target 'link_a.gnu' failed
make[4]: *** [link_a.gnu] Error 1
make[4]: Leaving directory '/usr/src/openssl-1.0.2p'
Makefile:357: recipe for target 'do_linux-shared' failed
make[3]: *** [do_linux-shared] Error 2
make[3]: Leaving directory '/usr/src/openssl-1.0.2p'
Makefile:310: recipe for target 'libcrypto.so.1.0.0' failed
make[2]: *** [libcrypto.so.1.0.0] Error 2
make[2]: Leaving directory '/usr/src/openssl-1.0.2p'
Makefile:109: recipe for target 'shared' failed
make[1]: *** [shared] Error 2
make[1]: Leaving directory '/usr/src/openssl-1.0.2p/crypto'
Makefile:287: recipe for target 'build_crypto' failed
make: *** [build_crypto] Error 1
tony@linux-31cz:/usr/src/openssl-1.0.2p> 
4

1 回答 1

3
./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib

其次是...

/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld:
libcrypto.a(gost_sign.o): relocation R_X86_64_32 against
`.rodata.str1.1' can not be used when making a shared object;
recompile with -fPIC
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld:
final link failed: Nonrepresentable section on output

听起来您之前已构建但省略了shared. 然后你重新配置并添加了shared.

您应该执行 amake distclean然后重新开始。执行 a distclean,然后运行./config ...​​,make dependsmake然后make install

OpenSSL 1.0.2 需要make depends,因此请确保包含该步骤。

另请参阅OpenSSL wiki 上的编译和安装。

于 2018-09-25T11:28:23.207 回答