Need help with OpenSSL static library

Jonathan Day dayjonathanc at gmail.com
Fri Mar 10 12:59:42 UTC 2023


Hi,

I am working on a legacy multithreaded application for Visual
Studio/Windows that uses OpenSSL to handle encryption. It needs to be
compiled in both debug and release modes. I've managed to port it from
1.1.1 to 3.0.8. That part was relatively simple.

It worked fine compiled statically with OpenSSL 1.1.1. I can get the
program to compile and run correctly with the dynamic libraries in 3.0.8,
but my instructions are to get it working with the static libraries for
3.0.8 instead. This is where I run into problems.

The original libraries included were: Comctl32.lib, libssl.lib,
libcrypto.lib, ws2_32.lib, crypt32.lib

I've switched libcrypto.lib to libcrypto_static.lib and added GDI32.LIB,
ADVAPI32.LIB, USER32.LIB as per the INSTALL document.

This generates a whole series of warnings and errors. I've only included
the first few of each.

warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO'
specification
warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use
/NODEFAULTLIB:library
LINK : warning LNK4217: symbol '__time32' defined in
'libucrtd.lib(time.obj)' is imported by
'libcrypto_static.lib(libcrypto-lib-http_client.obj)' in function
'_OSSL_HTTP_REQ_CTX_set_request_line'
LINK : warning LNK4286: symbol '__time32' defined in
'libucrtd.lib(time.obj)' is imported by
'libcrypto_static.lib(libcrypto-lib-bss_conn.obj)'
LINK : warning LNK4286: symbol '__time32' defined in
'libucrtd.lib(time.obj)' is imported by
'libcrypto_static.lib(libdefault-lib-drbg.obj)'
LINK : warning LNK4217: symbol '__time32' defined in
'libucrtd.lib(time.obj)' is imported by
'libcrypto_static.lib(libcrypto-lib-bio_lib.obj)' in function
'_BIO_do_connect_retry'

(and a whole lot of further warnings, followed by)

libcrypto_static.lib(libcrypto-lib-params_from_text.obj) : error LNK2001:
unresolved external symbol __imp__strncpy
libcrypto_static.lib(libcrypto-lib-dso_win32.obj) : error LNK2001:
unresolved external symbol __imp__strncpy
libcrypto_static.lib(libcrypto-lib-asn1_lib.obj) : error LNK2001:
unresolved external symbol __imp__strncpy
libcrypto_static.lib(libcrypto-lib-ctrl_params_translate.obj) : error
LNK2001: unresolved external symbol __imp__strncpy
libcrypto_static.lib(libcrypto-lib-x509_obj.obj) : error LNK2001:
unresolved external symbol __imp__strncpy
libcrypto_static.lib(libcrypto-lib-evp_key.obj) : error LNK2001: unresolved
external symbol __imp__strncpy

(and a whole series of further link errors)

It seems obvious enough that the warnings and errors are part and parcel of
the same problem, that I'm using the incorrect additional libraries for the
type of build I'm trying to do.

The problem, then, is what extra libraries should I be including to work
with this application, given the errors I am getting and given that
everything needs to be safe for multithreading.

Any help would be gratefully received.

Jonathan Day
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mta.openssl.org/pipermail/openssl-users/attachments/20230310/094af4ba/attachment.htm>


More information about the openssl-users mailing list