我想從github發佈https://github.com/openssl/openssl/archive/OpenSSL-fips-2_0_13.tar.gz建立openssl並嘗試手動編譯它。我試圖編譯這個在Mac OSX版本10.11.5,這是我採取與openssl鏈接器和編譯器錯誤
./Configure darwin64-x86_64-cc
make
一系列的步驟,但是當我編譯通常根據我得到這個錯誤
bsaes-x86_64.s:580:1: error: invalid symbol redefinition
_bsaes_enc_key_convert:
INSTALL
文件,我在鏈接步驟中出現en錯誤,大概是因爲存檔文件是爲32位系統構建的。這是警告從./config && make
步存檔鏈接時運行./config
WARNING! If you wish to build 64-bit library, then you have to
invoke './Configure darwin64-x86_64-cc' *manually*.
You have about 5 seconds to press Ctrl-C to abort.
,然後得到相應的錯誤,當我得到的是這種
ld: warning: ld: warning: ignoring file openssl/lib/libssl.a, file was
built for archive which is not the architecture being linked (x86_64):
openssl/lib/libssl.aignoring file openssl/lib/libcrypto.a, file was built
for archive which is not the architecture being linked (x86_64):
openssl/lib/libcrypto.a
注我建立這一個C++項目使用C編譯器編譯C代碼並使用C++編譯器(或者因爲兩個編譯器使用相同的鏈接器,所以使用ld
?)來鏈接代碼(不知道這是否有所作用)
有人能告訴我如何正確構建和鏈接openssl嗎?
您***不能用C++編譯器構建OpenSSL庫。您必須使用C編譯器。稍後,您可以使用C++編譯器編譯用戶程序。您也可以執行'KERNEL_BITS = 64 ./config shared no-ssl2 no-ssl3 enable-ec_nistp_64_gcc_128 ...'。一個相關的問題是Stack Overflow上的[在OS X上構建多元OpenSSL](http://stackoverflow.com/q/25530429)。另請參閱OpenSSL wiki上的[編譯和安裝](https://wiki.openssl.org/index.php/Compilation_and_Installation)。 – jww
@jww我在說我使用的是C++編譯器時錯了,我正在使用C編譯器編譯代碼,然後使用C++編譯器進行鏈接。我將更正問題 – Curious