Need help with OpenSSL static library

Jonathan Day dayjonathanc at gmail.com
Mon Mar 13 12:16:17 UTC 2023


> > > 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'
> >
> > Looks like some part was compiled with '-MDd' and some other parts
> > (the .libs?) with '-MTd'.
>
> Yes, or -MD (or /MD) versus -MT, or some other combination thereof. It's
some
> form of mixed MSVC runtimes, which is what the LNK4098 message is
> warning you about.

I've tried various options without much success, but I'll keep trying. Does
anyone on the list know the specific flag that OpenSSL's static library
compiles under?

I'm puzzled as to how fixing that would fix the errors (the missing
functions), but it's possible Visual Studio is getting confused.

The code I have is compiled both as a debug version (/MTd) and a release
version (/MT) and both produce the same errors. So if this is the problem
then OpenSSL must be compiled under one of the other two. That's going to
be a problem. But an understood problem is easier to solve than one that's
not understood!

If OpenSSL static is compiled with /MD or /MDd, is there any way to change
the build script to compile it with /MT or /MTd?

If I have to rebuild the libraries, then I run into a second problem - it's
not detecting that I have a 64-bit Visual Studio and is trying to compile
everything as 32-bit and errors out on the 64-bit build. I can compile my
code as 64-bit, so it's not a problem with Visual Studio - I've seen
something on the Internet about NASM being 32-bit only, but that's old and
I don't know if it's still valid.

Is NASM a problem with 64-bit builds and should I de-install it to get the
code to build correctly in 64-bits?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mta.openssl.org/pipermail/openssl-users/attachments/20230313/4ed2942d/attachment.htm>


More information about the openssl-users mailing list