2017-05-03 124 views
1

在構建OpenSSL-1.1.0d時,出現錯誤。「undefined reference to strerror_r」with OpenSSL-1.1.0e和MinGW

./libcrypto.a(o_str.o):o_str.c:(.text+0x5cb): undefined reference to `strerror_r' 
collect2.exe: error: ld returned 1 exit status 
make[2]: *** [Makefile.shared:187: link_app.] Error 1 
make[2]: Leaving directory '/c/MinGW/openssl-1.1.0d' 
make[1]: *** [Makefile:5966: apps/openssl.exe] Error 2 
make[1]: Leaving directory '/c/MinGW/openssl-1.1.0d' 
make: *** [Makefile:128: all] Error 2 

我也跟着下面的步驟來構建它

  1. tar -xf vv.tar.gz

  2. perl Configure mingw no-shared

  3. make

說明來自Compiling OpenSSL on Windows (mingw32)

爲什麼鏈接失敗,我該如何解決?

+0

您標記爲'C++'。您必須使用C編譯器構建庫;不是C++編譯器。 MinGW在前段時間被放棄。你可以用Cygwin代替嗎? OpenSSL項目提供了在[INSTALL](https://github.com/openssl/openssl/blob/master/INSTALL)和[NOTES.WIN](https://github.com/openssl/openssl)中使用MinGW進行構建的說明/blob/master/NOTES.WIN)。你可以用它們來代替嗎?您可能需要定義'_XOPEN_SOURCE = 600'。另請參閱OpenSSL wiki上的[編譯和安裝](https://wiki.openssl.org/index.php/Compilation_and_Installation)。 – jww

+0

對不起C++標記,感謝您的回覆..我不知道你的所有建議,但我仍然得到相同的錯誤.. :('./libcrypto.a(o_str.o):o_str.c:(.text+0x5cb) :未定義的參考'strerror_r'' –

回答

1

strerror_r可能無法在MinGW的實施,您需要檢查minwg最新文檔

+0

謝謝Pras ..它更改爲最新版本的mingw後工作..感謝所有...... :) –

相關問題