Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I got problems when using the libs installed by vcpkg #24291

Closed
huangrunqian opened this issue Apr 21, 2022 · 9 comments
Closed

I got problems when using the libs installed by vcpkg #24291

huangrunqian opened this issue Apr 21, 2022 · 9 comments
Assignees
Labels
requires:repro The issue is not currently repro-able

Comments

@huangrunqian
Copy link

huangrunqian commented Apr 21, 2022

My system is Windows10, and I installed openssl & zlib by
vcpkg.exe install openssl:x64-windows openssl-windows:x64-windows zlib:x64-windows
Then I built other projects linking to these libs, and I got following errors:

 error LNK2019: Unresolved external symbol deflateEnd    
 error LNK2019: Unresolved external symbol deflateInit_    
 error LNK2019: Unresolved external symbol deflateInit2_    
 error LNK2019: Unresolved external symbol EVP_DigestSignUpdate    
 error LNK2019: Unresolved external symbol SSL_get1_peer_certificate

However, if I copy libcrypto.lib and libssl.lib installed by anaconda and cover the libs installed by vcpkg, the last two errors could be solved. Does that mean the libs I installed didn't packed these when building? What should I do to solve these problems?

@FrankXie05
Copy link
Contributor

FrankXie05 commented Apr 21, 2022

@huangrunqian Thanks for posting issue, sorry, I didn't reproduce your problem locally.

E:\test\vcpkg> ./vcpkg install openssl:x64-windows                                                                  
Computing installation plan...    
The following packages will be built and installed:                                                                         
openssl[core]:x64-windows -> 3.0.2#3                                                                          
     Detecting compiler hash for triplet x64-windows...                                                        
	 Restored 0 packages from C:\Users\test\AppData\Local\vcpkg\archives in 347.6 us. Use --debug to see more details. Starting package 1/1: openssl:x64-windows  
	 Building package openssl[core]:x64-windows...                                                                         
	 -- Using cached openssl-3.0.2.tar.gz.                                                                                 
	 -- Cleaning sources at E:/test/vcpkg/buildtrees/openssl/src/openssl-3-67d457a95e.clean. Use --editable to skip cleaning for the packages you specify.     
	 -- Extracting source E:/test/vcpkg/downloads/openssl-3.0.2.tar.gz                                                     
	 -- Using source at E:/test/vcpkg/buildtrees/openssl/src/openssl-3-67d457a95e.clean                                    
	 -- Copying openssl release source files...                                                                          
	 -- Copying openssl release source files... done                                                                     
	 -- Configure x64-windows-rel                                                                                        
	 -- Configure x64-windows-rel done                                                                                  
     -- Build x64-windows-rel                                                                                           
     -- Build x64-windows-rel done                                                                                      
     -- Copying openssl debug source files...                                                                            
	 -- Copying openssl debug source files... done                                                                        
	 -- Configure x64-windows-dbg                                                                                         
	 -- Configure x64-windows-dbg done                                                                                    
	 -- Build x64-windows-dbg                                                                                             
	 -- Build x64-windows-dbg done                                                                                        
	 -- Installing: E:/test/vcpkg/packages/openssl_x64-windows/share/openssl/copyright                                     
	 -- Fixing pkgconfig file: E:/test/vcpkg/packages/openssl_x64-windows/lib/pkgconfig/libcrypto.pc                        
	 -- Fixing pkgconfig file: E:/test/vcpkg/packages/openssl_x64-windows/lib/pkgconfig/libssl.pc                           
	 -- Fixing pkgconfig file: E:/test/vcpkg/packages/openssl_x64-windows/lib/pkgconfig/openssl.pc                          
	 -- Using cached msys-mingw-w64-i686-pkg-config-0.29.2-3-any.pkg.tar.zst.                                              
	 -- Using cached msys-mingw-w64-i686-libwinpthread-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst.                         
	 -- Using msys root at E:/test/vcpkg/downloads/tools/msys2/9a1ec3f33446b195                                            
	 -- Fixing pkgconfig file: E:/test/vcpkg/packages/openssl_x64-windows/debug/lib/pkgconfig/libcrypto.pc                 
	 -- Fixing pkgconfig file: E:/test/vcpkg/packages/openssl_x64-windows/debug/lib/pkgconfig/libssl.pc                   
	 -- Fixing pkgconfig file: E:/test/vcpkg/packages/openssl_x64-windows/debug/lib/pkgconfig/openssl.pc                  
	 -- Installing: E:/test/vcpkg/packages/openssl_x64-windows/share/openssl/usage                                        
	 -- Performing post-build validation                                                                                 
	 -- Performing post-build validation done                                                                            
	 Stored binary cache: C:\Users\test\AppData\Local\vcpkg\archives\19\1936fbf6ca756735e6e0b7a8662673c264999762a674c63786554fab3dcdfed2.zip        
	 Installing package openssl[core]:x64-windows...                                                                       
	 Elapsed time for package openssl:x64-windows: 20.6 min                                                                 
	 Total elapsed time: 20.85 min   
	 
	The package openssl is compatible with built-in CMake targets: 
	 
		 find_package(OpenSSL REQUIRED)                                                                      
		 target_link_libraries(main PRIVATE OpenSSL::SSL OpenSSL::Crypto)                                   
	 
PS E:\test\vcpkg> 

Capture

For openssl, libcrypto.lib name seems to have changed, make sure you use the latest vcpkg and try again.

@FrankXie05 FrankXie05 added the requires:repro The issue is not currently repro-able label Apr 21, 2022
@FrankXie05
Copy link
Contributor

Maybe you can specify these two libs in Visual Studio. Related issue #12001

@huangrunqian
Copy link
Author

I just tried git pull and vcpkg.exe update, and then vcpkg.exe install openssl:x64-windows-static openssl-windows:x64-windows-static. Then I use dumpbin on Windows to find the symbol EVP_DigestSignUpdate and SSL_get1_peer_certificate in the libs, but I still couldn't find them, while I could find them in the libs with the same name installed by anaconda.

@FrankXie05
Copy link
Contributor

Please delete the cache before retry, this is the result of my query notation. Obviously, openssl has the required symbols in the exported libcrypto.lib and libssl.lib.

image

image

@huangrunqian
Copy link
Author

huangrunqian commented May 7, 2022

I tried to delete the whole vcpkg folder and restart everything:
git clone --single-branch -b master https://github.com/microsoft/vcpkg.git
cd vcpkg
git checkout a82c62d
git pull
bootstrap-vcpkg.bat
vcpkg.exe update
vcpkg.exe install openssl:x64-windows openssl-windows:x64-windows rapidjson:x64-windows re2:x64-windows boost-interprocess:x64-windows boost- stacktrace:x64-windows zlib:x64-windows pthread:x64-windows b64:x64-windows
Then I got the following error:
企业微信截图_20220507143923

@FrankXie05
Copy link
Contributor

Is the error still the same? If not, please provide the error log:
D:\github\vcpkg\buildtrees\openssl\build-x64-windows-rel-1-err.log

@huangrunqian
Copy link
Author

I used CMD for administrator to run the commands, and installed openssl successfully. However, now I got
error LNK2019: Unresolved external symbol SSL_get_peer_certificate
Still used dumpbin to check libssl.lib, there is no SSL_get_peer_certificate there.

@huangrunqian
Copy link
Author

However, there is SSL_get1_peer_certificate and EVP_DigestSignUpdate now.

@huangrunqian
Copy link
Author

Maybe it's not the problem of the openssl lib... I cleaned my project and built from the start, everything seemed fine and I don't know why. So I'm just closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
requires:repro The issue is not currently repro-able
Projects
None yet
Development

No branches or pull requests

2 participants