2013-10-15 81 views
1

我想在(64位)Windows 7上使用OpenSSL構建C文件。我已經從官方OpenSSL站點下載了最新的完整二進制文件,並且正在使用MinGW,並已將相應的bin目錄添加到PATH。但是我收到以下錯誤:OpenSSL ON WINDOWS !! - ld.exe找不到-lcrypto/-leay32

c:\Workspace\OSAccess\c>gcc -I%JAVA_HOME%\include -I%JAVA_HOME%\include\win32 -Ic:\OpenSSL-Win64\include -std=c99 -lm -lcrypto -o libosaccess.dll osaccess.c 
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lcrypto 
collect2.exe: error: ld returned 1 exit status 

我無法找到任何文件名爲libcrypto.dllcryptolib.dll,所以我試圖從源代碼建立自己的OpenSSL,使用附帶的安裝說明,因爲我可以看到靜態庫對於cryptossl似乎不隨Windows安裝一起發貨。我在其他帖子中看到了其他一些庫的參考文獻,libeay32ssleay32,但是這些庫返回相同的錯誤。

如果我刪除-lcrypto(或其它),然後我得到Undefined reference錯誤:

c:\Workspace\OSAccess\c>gcc -I%java_home%\include -I%java_home%\include\win32 -Ic:\OpenSSL-Win64\include -std=c99 -lm -o libosaccess.dll osaccess.c 
C:\Users\xxxx\AppData\Local\Temp\ccbi3e1T.o:osaccess.c:(.text+0x383): undefined reference to '[email protected]' 
C:\Users\xxxx\AppData\Local\Temp\ccbi3e1T.o:osaccess.c:(.text+0x3d1): undefined reference to '[email protected]' 
C:\Users\xxxx\AppData\Local\Temp\ccbi3e1T.o:osaccess.c:(.text+0x445): undefined reference to '[email protected]' 
C:\Users\xxxx\AppData\Local\Temp\ccbi3e1T.o:osaccess.c:(.text+0x73d): undefined reference to 'EVP_CIPHER_CTX_init' 
C:\Users\xxxx\AppData\Local\Temp\ccbi3e1T.o:osaccess.c:(.text+0x742): undefined reference to 'EVP_aes_256_cbc' 
C:\Users\xxxx\AppData\Local\Temp\ccbi3e1T.o:osaccess.c:(.text+0x76a): undefined reference to 'EVP_EncryptInit_ex' 
C:\Users\xxxx\AppData\Local\Temp\ccbi3e1T.o:osaccess.c:(.text+0x794): undefined reference to 'EVP_EncryptUpdate' 
C:\Users\xxxx\AppData\Local\Temp\ccbi3e1T.o:osaccess.c:(.text+0x7d2): undefined reference to 'EVP_EncryptFinal_ex' 
C:\Users\xxxx\AppData\Local\Temp\ccbi3e1T.o:osaccess.c:(.text+0x81c): undefined reference to 'EVP_CIPHER_CTX_cleanup' 
C:\Users\xxxx\AppData\Local\Temp\ccbi3e1T.o:osaccess.c:(.text+0x865): undefined reference to 'EVP_CIPHER_CTX_init' 
C:\Users\xxxx\AppData\Local\Temp\ccbi3e1T.o:osaccess.c:(.text+0x86a): undefined reference to 'EVP_aes_256_cbc' 
C:\Users\xxxx\AppData\Local\Temp\ccbi3e1T.o:osaccess.c:(.text+0x892): undefined reference to 'EVP_DecryptInit_ex' 
C:\Users\xxxx\AppData\Local\Temp\ccbi3e1T.o:osaccess.c:(.text+0x8bc): undefined reference to 'EVP_DecryptUpdate' 
C:\Users\xxxx\AppData\Local\Temp\ccbi3e1T.o:osaccess.c:(.text+0x8fa): undefined reference to 'EVP_DecryptFinal_ex' 
C:\Users\xxxx\AppData\Local\Temp\ccbi3e1T.o:osaccess.c:(.text+0x930): undefined reference to 'EVP_CIPHER_CTX_cleanup' 
+0

有一看[無法找到的,libcrypto庫錯誤](http://stackoverflow.com/questions/10368671/cannot-find-libcrypto-library-error) –

+1

添加'-Lc:\ OpenSSL-Win64 -leay32'就是解決這個問題的方法。 – MeanwhileInHell

+0

...和'-Lc:\ Windows \ System32 -lnetapi32'爲Netbios錯誤 – MeanwhileInHell

回答

0

如果libcrypto.dll或cryptolib.dll是不存在的,我會建議你嘗試任何其他複製系統。我有類似的問題,幸運地發現它在另一個系統上,複製工作也很好。

問候, 耆那教