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

[WIN][VS2015] Missing Crypt32.lib in Linker Dependencies #1147

Closed
23W opened this Issue Nov 28, 2016 · 4 comments

Comments

Projects
None yet
2 participants
@23W
Contributor

23W commented Nov 28, 2016

I did this

I use CMAKE for generate build files for libcurl in static form.
With such settings:

  • OpenSSL 1.1.0c library in static form
  • LibSSH2 1.8.0 in static form (for supporting SFTP, FTPS, ...)
  • zlib 1.2.8 in static form

I expected the following

But OpenSSL 1.1.0 in CAPI engine begins to use the Cryptography functions from Wincrypt.h, so Crypt32.lib is required. But in such configuration CMake does not add the Crypt32.lib in CURL_LIBS value.
As result I received the many linker errors with 'unresolved external CertFreeCertificateContext in file ...'
I am expecting the correct linking, but I don't know how to add the Crypt32.lib in dependencies.

curl/libcurl version

curl/libcurl 7.51.0-DEV

operating system

Windows 10 x64
Visual Studio 2015

@23W

This comment has been minimized.

Show comment
Hide comment
@23W

23W Nov 28, 2016

Contributor

this bug similar to #935

Contributor

23W commented Nov 28, 2016

this bug similar to #935

@bagder bagder added the cmake label Nov 28, 2016

@bagder

This comment has been minimized.

Show comment
Hide comment
@bagder

bagder Nov 28, 2016

Member

The #935 problem was for the schannel backend though and was fixed in: 2bbed9c. You probably need something similar. But really, building static means you need to figure out and provide all the dependencies yourself and you can't expect our build scripts to always have that right. It's a cat and mouse game that we always will be behind in.

Member

bagder commented Nov 28, 2016

The #935 problem was for the schannel backend though and was fixed in: 2bbed9c. You probably need something similar. But really, building static means you need to figure out and provide all the dependencies yourself and you can't expect our build scripts to always have that right. It's a cat and mouse game that we always will be behind in.

@23W

This comment has been minimized.

Show comment
Hide comment
@23W

23W Nov 29, 2016

Contributor

@bagder Yes, you are right. But, curl.exe can use libcrypto.lib and libssl.lib (OpenSSL 1.1.0 in static form) on Windows platforms also. So, it should to add Crypt32.lib in its dependencies. Am I right too?

My proposition: if curl\lubcurl compiled with OpenSSL then cmake should add Crypt32.lib in the dependency list in any case (ether dynamic OpenSSL or static). Then Visual C++ linker has to remove Crypt32.lib reference if it not is used in the assembly.

P.S.: Sorry, I do not know the CMakeLists.txt format and I can't to do this work alone.

Contributor

23W commented Nov 29, 2016

@bagder Yes, you are right. But, curl.exe can use libcrypto.lib and libssl.lib (OpenSSL 1.1.0 in static form) on Windows platforms also. So, it should to add Crypt32.lib in its dependencies. Am I right too?

My proposition: if curl\lubcurl compiled with OpenSSL then cmake should add Crypt32.lib in the dependency list in any case (ether dynamic OpenSSL or static). Then Visual C++ linker has to remove Crypt32.lib reference if it not is used in the assembly.

P.S.: Sorry, I do not know the CMakeLists.txt format and I can't to do this work alone.

@23W

This comment has been minimized.

Show comment
Hide comment
@23W

23W Nov 29, 2016

Contributor

I add pull request #1149, please review it.

Contributor

23W commented Nov 29, 2016

I add pull request #1149, please review it.

@bagder bagder closed this in 1b711ca Dec 27, 2016

@lock lock bot locked as resolved and limited conversation to collaborators May 7, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.