Обсуждение: [PATCH] fix msvc build libpq error LNK2019 when link openssl;

Поиск
Список
Период
Сортировка

[PATCH] fix msvc build libpq error LNK2019 when link openssl;

От
"gamefunc"
Дата:
# I:
    (default target) (1) -> (Link target) ->
      libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019:  __imp_CertOpenStore, capi_open_store
      libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019:  __imp_CertCloseStore, capi_find_key
      libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019:  __imp_CertEnumCertificatesInStore, capi_find_cert
      libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019:  __imp_CertFindCertificateInStore, capi_find_cert
      libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019:  __imp_CertDuplicateCertificateContext,
capi_load_ssl_client_cert
      libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019:  __imp_CertFreeCertificateContext, capi_dsa_free
      libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019:  __imp_CertGetCertificateContextProperty,
capi_cert_get_fname 

# A:
    loss crypt32.lib

# Fix:
    Mkvcbuild.pm: fix: add:
        $libpq->AddLibrary('crypt32.lib');
        $postgres->AddLibrary('crypt32.lib')

    and simple fix: "Unable to determine Visual Studio version":
        replace(
            "my $vsVersion = DetermineVisualStudioVersion();",
            "my $vsVersion = "17.00";");
Вложения

Re: [PATCH] fix msvc build libpq error LNK2019 when link openssl;

От
Michael Paquier
Дата:
On Mon, Feb 27, 2023 at 09:58:28AM +0800, gamefunc wrote:
> # I:
>     (default target) (1) -> (Link target) ->
>       libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019:  __imp_CertOpenStore, capi_open_store
>       libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019:  __imp_CertCloseStore, capi_find_key
>       libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019:  __imp_CertEnumCertificatesInStore, capi_find_cert
>       libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019:  __imp_CertFindCertificateInStore, capi_find_cert
>       libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019:  __imp_CertDuplicateCertificateContext,
capi_load_ssl_client_cert
>       libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019:  __imp_CertFreeCertificateContext, capi_dsa_free
>       libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019:  __imp_CertGetCertificateContextProperty,
capi_cert_get_fname 

@@ -94,7 +94,7 @@ sub mkvcbuild
    die 'Must run from root or msvc directory'
      unless (-d 'src/tools/msvc' && -d 'src')

-   my $vsVersion = DetermineVisualStudioVersion();
+   my $vsVersion = "17.00";

This diff forces the creation of a VS2022Solution(), which would be
incorrect when using an MSVC environment different than 17.0 as
version number, no?

Note that buildfarm member drongo is providing coverage for 64b
Windows builds with Visual 2019 and OpenSSL:
https://buildfarm.postgresql.org/cgi-bin/show_history.pl?nm=drongo&br=HEAD

Are you sure that you just didn't mix 64b builds with 32b libraries,
or vice-versa?
--
Michael

Вложения

RE: [PATCH] fix msvc build libpq error LNK2019 when link openssl;

От
gamefunc
Дата:

sorry i should have made it clear – I am only reporting my build error issue;

the patch is only for illustrative purpose, not for merging to upstream;

And my English is not good, so I can only write simple descriptions;

>> This diff forces the creation of a VS2022Solution():

yes, my env: vs2022, openssl3.0.7;

 

>> Note that buildfarm member drongo is providing coverage for 64b:

thank you, But I need to build libpq myself because I need to add functions to libpq for my example use; https://github.com/gamefunc/Aiolibpq_simple;

 

>> Are you sure that you just didn't mix 64b builds with 32b libraries;

no, all 64b;

 

From: Michael Paquier
Date: 2023
227 13:27
To: gamefunc
CC: pgsql-hackers
Subject: Re: [PATCH] fix msvc build libpq error LNK2019 when link openssl;

 

On Mon, Feb 27, 2023 at 09:58:28AM +0800, gamefunc wrote:

> # I:

>     (default target) (1) -> (Link target) ->

>       libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019:  __imp_CertOpenStore capi_open_store 

>       libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019:  __imp_CertCloseStore capi_find_key 

>       libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019:  __imp_CertEnumCertificatesInStore capi_find_cert 

>       libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019:  __imp_CertFindCertificateInStore capi_find_cert

>       libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019:  __imp_CertDuplicateCertificateContext capi_load_ssl_client_cert

>       libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019:  __imp_CertFreeCertificateContext capi_dsa_free

>       libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2019:  __imp_CertGetCertificateContextProperty capi_cert_get_fname

 

@@ -94,7 +94,7 @@ sub mkvcbuild

    die 'Must run from root or msvc directory'

      unless (-d 'src/tools/msvc' && -d 'src')

 

-   my $vsVersion = DetermineVisualStudioVersion();

+   my $vsVersion = "17.00";

 

This diff forces the creation of a VS2022Solution(), which would be

incorrect when using an MSVC environment different than 17.0 as

version number, no?

 

Note that buildfarm member drongo is providing coverage for 64b

Windows builds with Visual 2019 and OpenSSL:

https://buildfarm.postgresql.org/cgi-bin/show_history.pl?nm=drongo&br=HEAD

 

Are you sure that you just didn't mix 64b builds with 32b libraries,

or vice-versa?

--

Michael