2016-12-31 46 views
3

我想從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嗎?

+0

您***不能用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

+0

@jww我在說我使用的是C++編譯器時錯了,我正在使用C編譯器編譯代碼,然後使用C++編譯器進行鏈接。我將更正問題 – Curious

回答

2

嘗試在./configure使用no-asm選項:

$ make clean 
$ ./Configure darwin64-x86_64-cc no-asm 
$ make test 
$ make 
.... 

橢圓曲線程序似乎在這個版本中被打破,所以也許提交有關的bug報告,否則它應該編譯/構建沒有問題。

+0

謝謝。我向openssl報告:https://github.com/openssl/openssl/issues/4860 – gary