Buy commercial curl support from WolfSSL. We help you work
out your issues, debug your libcurl applications, use the API, port to new
platforms, add new features and more. With a team lead by the curl founder
himself.
Re: Requesting Help on libcurl compile
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
From: Coffee Bug via curl-library <curl-library_at_lists.haxx.se>
Date: Thu, 15 Sep 2022 13:37:20 +0800
Hello, Ray. I appreciate the response.
I added -lcrypt32 to the original code and successfully was able to resolve
most errors to just the following:
C:\msys64\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\12.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe:
C:\libs\curl_new64\lib\libcurl.a(strerror.o):strerror.c|| undefined
reference to `__imp___sys_nerr'
C:\msys64\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\12.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe:
C:\libs\curl_new64\lib\libcurl.a(strerror.o):strerror.c|| undefined
reference to `__imp___sys_errlist'
The following compiled successfully:
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
/* print from errlist such as "Illegal byte sequence" etc */
printf("%s\n", _sys_errlist[_sys_nerr - 1]);
return 0;
}
But in the following, I received an *"Illegal byte sequence"* output:
#include <stdlib.h>
#include <stdio.h>
#include <curl/curl.h>
int main(int argc, char *argv[])
{
/* print from errlist such as "Illegal byte sequence" etc */
printf("%s\n", _sys_errlist[_sys_nerr - 1]);
return 0;
}
Thank you!
On Thu, Sep 15, 2022 at 2:03 AM Ray Satiro via curl-library <
curl-library_at_lists.haxx.se> wrote:
> On 9/14/2022 4:48 AM, Coffee Bug via curl-library wrote:
> > #include <curl/curl.h>
> > int main() {
> > curl_global_init(CURL_GLOBAL_DEFAULT);
> > }
> >
> > I already encounter the following errors:
> >
> > libs\curl_new64\lib\libcurl.a(strerror.o):strerror.c|| undefined
> > reference to `__imp___sys_nerr'|
> > libs\curl_new64\lib\libcurl.a(strerror.o):strerror.c|| undefined
> > reference to `__imp___sys_errlist'|
> > libs\curl_new64\lib\libcurl.a(openssl.o):openssl.c|| undefined
> > reference to `__imp_CertOpenSystemStoreA'|
> > libs\curl_new64\lib\libcurl.a(openssl.o):openssl.c|| undefined
> > reference to `__imp_CertEnumCertificatesInStore'|
> > libs\curl_new64\lib\libcurl.a(openssl.o):openssl.c|| undefined
> > reference to `__imp_CertEnumCertificatesInStore'|
> > libs\curl_new64\lib\libcurl.a(openssl.o):openssl.c|| undefined
> > reference to `__imp_CertGetIntendedKeyUsage'|
> > libs\curl_new64\lib\libcurl.a(openssl.o):openssl.c|| undefined
> > reference to `__imp_CertGetEnhancedKeyUsage'|
> > libs\curl_new64\lib\libcurl.a(openssl.o):openssl.c|| undefined
> > reference to `__imp_CertGetEnhancedKeyUsage'|
> > libs\curl_new64\lib\libcurl.a(openssl.o):openssl.c|| undefined
> > reference to `__imp_CertFreeCertificateContext'|
> > libs\curl_new64\lib\libcurl.a(openssl.o):openssl.c|| undefined
> > reference to `__imp_CertCloseStore'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertFreeCertificateContext'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_PFXImportCertStore'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertFindCertificateInStore'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertCloseStore'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertFreeCertificateContext'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertCloseStore'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertEnumCertificatesInStore'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertEnumCertificatesInStore'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertFreeCertificateContext'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertFreeCertificateContext'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertFreeCertificateContext'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertOpenStore'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CryptStringToBinaryA'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertFindCertificateInStore'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertEnumCertificatesInStore'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertFreeCertificateContext'|
> > libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
> > undefined reference to `__imp_CertOpenStore'|
> > libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
> > undefined reference to `__imp_CertGetCertificateChain'|
> > libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
> > undefined reference to `__imp_CertFreeCertificateChainEngine'|
> > libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
> > undefined reference to `__imp_CertCloseStore'|
> > libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
> > undefined reference to `__imp_CertFreeCertificateChain'|
> > libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
> > undefined reference to `__imp_CertFreeCertificateContext'|
> > libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
> > undefined reference to `__imp_CertCreateCertificateChainEngine'|
> > libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
> > undefined reference to `__imp_CryptQueryObject'|
> > libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
> > undefined reference to `__imp_CertAddCertificateContextToStore'|
> > libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
> > undefined reference to `__imp_CertFreeCertificateContext'|
> > libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
> > undefined reference to `__imp_CertGetNameStringA'|
> > libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
> > undefined reference to `__imp_CertFindExtension'|
> > libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
> > undefined reference to `__imp_CryptDecodeObjectEx'|
> > ||error: ld returned 1 exit status|
> > ||=== Build failed: 40 error(s), 4 warning(s) (0 minute(s), 2
> > second(s)) ===|
> >
> > I use the following software versions:
> > - mingw-w64: downloaded and installed thru msys2
> > - libcurl: 7.85.0
> > - ide: codeblocks
> >
> > I have included in the compiler setup:
> > CURL_STATICLIB
> >
> > And have setup the linker options with:
> > -s -static -Wl,--add-stdcall-alias
> >
> > I have also added libraries (in the following order):
> > -loleaut32 -luser32 -lcurl -lnghttp2 -lidn2 -lngtcp2
> > -lngtcp2_crypto_openssl -lnghttp3 -lssl -lssh2 -lcrypto -lz -lwldap32
> > -lws2_32 -lwinmm -lgdi32 -lbcrypt -lbrotlidec -lbrotlicommon -lzstd
> > -lgsasl
> >
> > I would appreciate any instructions on how I should proceed. I
> > suspect I might have not ordered the linking of libraries correctly?
> > Thank you.
>
>
> You can resolve most of those with -lcrypt32, but I'm not sure why you
> see the sys_nerr and sys_errlist, that is odd. Try to compile this:
>
> #include <stdlib.h>
> #include <stdio.h>
>
> int main(int argc, char *argv[])
> {
> /* print from errlist such as "Illegal byte sequence" etc */
> printf("%s\n", _sys_errlist[_sys_nerr - 1]);
> return 0;
> }
>
> --
> Unsubscribe: https://lists.haxx.se/listinfo/curl-library
> Etiquette: https://curl.se/mail/etiquette.html
>
Date: Thu, 15 Sep 2022 13:37:20 +0800
Hello, Ray. I appreciate the response.
I added -lcrypt32 to the original code and successfully was able to resolve
most errors to just the following:
C:\msys64\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\12.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe:
C:\libs\curl_new64\lib\libcurl.a(strerror.o):strerror.c|| undefined
reference to `__imp___sys_nerr'
C:\msys64\mingw64\bin\..\lib\gcc\x86_64-w64-mingw32\12.2.0\..\..\..\..\x86_64-w64-mingw32\bin\ld.exe:
C:\libs\curl_new64\lib\libcurl.a(strerror.o):strerror.c|| undefined
reference to `__imp___sys_errlist'
The following compiled successfully:
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
/* print from errlist such as "Illegal byte sequence" etc */
printf("%s\n", _sys_errlist[_sys_nerr - 1]);
return 0;
}
But in the following, I received an *"Illegal byte sequence"* output:
#include <stdlib.h>
#include <stdio.h>
#include <curl/curl.h>
int main(int argc, char *argv[])
{
/* print from errlist such as "Illegal byte sequence" etc */
printf("%s\n", _sys_errlist[_sys_nerr - 1]);
return 0;
}
Thank you!
On Thu, Sep 15, 2022 at 2:03 AM Ray Satiro via curl-library <
curl-library_at_lists.haxx.se> wrote:
> On 9/14/2022 4:48 AM, Coffee Bug via curl-library wrote:
> > #include <curl/curl.h>
> > int main() {
> > curl_global_init(CURL_GLOBAL_DEFAULT);
> > }
> >
> > I already encounter the following errors:
> >
> > libs\curl_new64\lib\libcurl.a(strerror.o):strerror.c|| undefined
> > reference to `__imp___sys_nerr'|
> > libs\curl_new64\lib\libcurl.a(strerror.o):strerror.c|| undefined
> > reference to `__imp___sys_errlist'|
> > libs\curl_new64\lib\libcurl.a(openssl.o):openssl.c|| undefined
> > reference to `__imp_CertOpenSystemStoreA'|
> > libs\curl_new64\lib\libcurl.a(openssl.o):openssl.c|| undefined
> > reference to `__imp_CertEnumCertificatesInStore'|
> > libs\curl_new64\lib\libcurl.a(openssl.o):openssl.c|| undefined
> > reference to `__imp_CertEnumCertificatesInStore'|
> > libs\curl_new64\lib\libcurl.a(openssl.o):openssl.c|| undefined
> > reference to `__imp_CertGetIntendedKeyUsage'|
> > libs\curl_new64\lib\libcurl.a(openssl.o):openssl.c|| undefined
> > reference to `__imp_CertGetEnhancedKeyUsage'|
> > libs\curl_new64\lib\libcurl.a(openssl.o):openssl.c|| undefined
> > reference to `__imp_CertGetEnhancedKeyUsage'|
> > libs\curl_new64\lib\libcurl.a(openssl.o):openssl.c|| undefined
> > reference to `__imp_CertFreeCertificateContext'|
> > libs\curl_new64\lib\libcurl.a(openssl.o):openssl.c|| undefined
> > reference to `__imp_CertCloseStore'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertFreeCertificateContext'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_PFXImportCertStore'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertFindCertificateInStore'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertCloseStore'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertFreeCertificateContext'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertCloseStore'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertEnumCertificatesInStore'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertEnumCertificatesInStore'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertFreeCertificateContext'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertFreeCertificateContext'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertFreeCertificateContext'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertOpenStore'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CryptStringToBinaryA'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertFindCertificateInStore'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertEnumCertificatesInStore'|
> > libs\curl_new64\lib\libcurl.a(schannel.o):schannel.c|| undefined
> > reference to `__imp_CertFreeCertificateContext'|
> > libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
> > undefined reference to `__imp_CertOpenStore'|
> > libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
> > undefined reference to `__imp_CertGetCertificateChain'|
> > libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
> > undefined reference to `__imp_CertFreeCertificateChainEngine'|
> > libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
> > undefined reference to `__imp_CertCloseStore'|
> > libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
> > undefined reference to `__imp_CertFreeCertificateChain'|
> > libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
> > undefined reference to `__imp_CertFreeCertificateContext'|
> > libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
> > undefined reference to `__imp_CertCreateCertificateChainEngine'|
> > libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
> > undefined reference to `__imp_CryptQueryObject'|
> > libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
> > undefined reference to `__imp_CertAddCertificateContextToStore'|
> > libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
> > undefined reference to `__imp_CertFreeCertificateContext'|
> > libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
> > undefined reference to `__imp_CertGetNameStringA'|
> > libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
> > undefined reference to `__imp_CertFindExtension'|
> > libs\curl_new64\lib\libcurl.a(schannel_verify.o):schannel_verify.c||
> > undefined reference to `__imp_CryptDecodeObjectEx'|
> > ||error: ld returned 1 exit status|
> > ||=== Build failed: 40 error(s), 4 warning(s) (0 minute(s), 2
> > second(s)) ===|
> >
> > I use the following software versions:
> > - mingw-w64: downloaded and installed thru msys2
> > - libcurl: 7.85.0
> > - ide: codeblocks
> >
> > I have included in the compiler setup:
> > CURL_STATICLIB
> >
> > And have setup the linker options with:
> > -s -static -Wl,--add-stdcall-alias
> >
> > I have also added libraries (in the following order):
> > -loleaut32 -luser32 -lcurl -lnghttp2 -lidn2 -lngtcp2
> > -lngtcp2_crypto_openssl -lnghttp3 -lssl -lssh2 -lcrypto -lz -lwldap32
> > -lws2_32 -lwinmm -lgdi32 -lbcrypt -lbrotlidec -lbrotlicommon -lzstd
> > -lgsasl
> >
> > I would appreciate any instructions on how I should proceed. I
> > suspect I might have not ordered the linking of libraries correctly?
> > Thank you.
>
>
> You can resolve most of those with -lcrypt32, but I'm not sure why you
> see the sys_nerr and sys_errlist, that is odd. Try to compile this:
>
> #include <stdlib.h>
> #include <stdio.h>
>
> int main(int argc, char *argv[])
> {
> /* print from errlist such as "Illegal byte sequence" etc */
> printf("%s\n", _sys_errlist[_sys_nerr - 1]);
> return 0;
> }
>
> --
> Unsubscribe: https://lists.haxx.se/listinfo/curl-library
> Etiquette: https://curl.se/mail/etiquette.html
>
-- Unsubscribe: https://lists.haxx.se/listinfo/curl-library Etiquette: https://curl.se/mail/etiquette.htmlReceived on 2022-09-15