OpenSSL在WINDOWS上! !- ld.exe找不到-lcrypto/-leay32[复制]

时间:2022-11-16 09:33:30

This question already has an answer here:

这个问题已经有了答案:

I am trying to build a C file using OpenSSL on (64-bit) Windows 7. I have downloaded the latest full binary from the official OpenSSL site, and am using MinGW, and have added the respective bin directories to PATH. However I am getting the following error :

我正在尝试用OpenSSL(64位)Windows 7构建一个C文件。我已经从官方的OpenSSL站点下载了最新的完整的二进制文件,并且正在使用MinGW,并将各自的bin目录添加到PATH中。但是我得到了以下错误:

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

I cannot find any file called libcrypto.dll or cryptolib.dll, so I tried to build my own OpenSSL from source, using the install notes supplied, as I can see that the static libraries for crypto and ssl do not seem to be shipped with the Windows install. I have seen references in other posts to a couple of other libraries, libeay32 and ssleay32, but these return the same error.

我找不到任何名为libcrypto的文件。dll或cryptolib。因此,我尝试使用提供的安装说明来从源代码构建自己的OpenSSL,因为我可以看到,用于加密和ssl的静态库似乎没有安装Windows安装。我在其他文章中看到过其他一些库的引用,比如libeay32和ssleay32,但是这些都返回了相同的错误。

If I remove the -lcrypto (or other) then I get Undefined reference errors:

如果我删除-lcrypto(或其他),那么我将得到未定义的引用错误:

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 'Netbios@4'
C:\Users\xxxx\AppData\Local\Temp\ccbi3e1T.o:osaccess.c:(.text+0x3d1): undefined reference to 'Netbios@4'
C:\Users\xxxx\AppData\Local\Temp\ccbi3e1T.o:osaccess.c:(.text+0x445): undefined reference to 'Netbios@4'
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'

1 个解决方案

#1


0  

If libcrypto.dll or cryptolib.dll are not there , i will recommend you to try and copy it from any other system . I had similar problem with , luckily found it on another system and copying worked well too.

如果libcrypto。dll或cryptolib。dll不在那里,我将建议你尝试从其他系统复制它。我也遇到过类似的问题,幸运的是在另一个系统中发现了它,复制也很有效。

Regards, Jain

问候,耆那教徒的

#1


0  

If libcrypto.dll or cryptolib.dll are not there , i will recommend you to try and copy it from any other system . I had similar problem with , luckily found it on another system and copying worked well too.

如果libcrypto。dll或cryptolib。dll不在那里,我将建议你尝试从其他系统复制它。我也遇到过类似的问题,幸运的是在另一个系统中发现了它,复制也很有效。

Regards, Jain

问候,耆那教徒的