tag:help.appveyor.com,2012-11-13:/discussions/problems/25318-openssl-x64-static-link-in-visual-studio-2015-doesnt-workAppVeyor: Discussion 2020-04-03T18:46:07Ztag:help.appveyor.com,2012-11-13:Comment/478020822019-11-04T04:35:01Z2019-11-04T05:30:40Zopenssl x64 static libs can't link in Visual Studio 2015<div><p>Using the Visual Studio 2015 image and trying to link against c:\openssl-win64\lib\VC\static\libeay32MT.lib and c:\openssl-win64\lib\VC\static\ssleay32MT.lib</p>
<p>I'm getting these errors:<br>
ssleay32MT.lib(t1_enc.obj) : error LNK2001: unresolved external symbol __iob_func<br>
libeay32MT.lib(cryptlib.obj) : error LNK2001: unresolved external symbol __iob_func<br>
libeay32MT.lib(eng_openssl.obj) : error LNK2001: unresolved external symbol __iob_func<br>
libeay32MT.lib(txt_db.obj) : error LNK2001: unresolved external symbol __iob_func<br>
libeay32MT.lib(ui_openssl.obj) : error LNK2001: unresolved external symbol __iob_func</p>
<p>A quick search indicates that it might mean that these libs were built with a previous version of MSVC and are not compatible with 2015. Do they need to be updated in the Visual Studio 2015 image?</p></div>patcherton.fixesthingstag:help.appveyor.com,2012-11-13:Comment/478020822019-11-05T17:58:08Z2019-11-05T17:58:08Zopenssl x64 static libs can't link in Visual Studio 2015<div><p>What version of OpenSSL would you need on VS 2015 image?</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/478020822019-11-05T20:01:05Z2019-11-05T20:06:53Zopenssl x64 static libs can't link in Visual Studio 2015<div><p>The version of openssl isn't what's important. What's important is that the .libs need to have been compiled with VS 2015 (or possibly later) because Microsoft changed __iob_func to __acrt_iob_func</p>
<p>From <a href="https://docs.microsoft.com/en-us/cpp/porting/visual-cpp-change-history-2003-2015?redirectedfrom=MSDN&view=vs-2019#stdio_and_conio">https://docs.microsoft.com/en-us/cpp/porting/visual-cpp-change-hist...</a></p>
<p>"If your project links with static libraries that were compiled with a release of Visual Studio earlier than 2015, the linker might report an unresolved external symbol. These errors might reference internal definitions for _iob, _iob_func, or related imports for certain functions in the form of imp*. Microsoft recommends that you recompile all static libraries with the latest version of the C++ compiler and libraries when you upgrade a project."</p></div>patcherton.fixesthingstag:help.appveyor.com,2012-11-13:Comment/478020822019-11-05T20:33:49Z2019-11-05T20:33:49Zopenssl x64 static libs can't link in Visual Studio 2015<div><p>OK, but we are not compiling OpenSSL libraries by ourselves, but rather install them from pre-built packages. There is a bunch of OpenSSL versions/releases on build VM: <a href="https://www.appveyor.com/docs/windows-images-software/#tools">https://www.appveyor.com/docs/windows-images-software/#tools</a></p>
<p>The script installing them: <a href="https://github.com/appveyor/build-images/blob/master/scripts/Windows/install_openssl.ps1">https://github.com/appveyor/build-images/blob/master/scripts/Window...</a></p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/478020822019-11-05T21:05:30Z2019-11-05T21:09:06Zopenssl x64 static libs can't link in Visual Studio 2015<div><blockquote>
<p>but we are not compiling OpenSSL libraries by ourselves, but rather install them from pre-built packages</p>
</blockquote>
<p>It's still the case that the preinstalled static libraries do not work regardless of where they came from. :(</p></div>patcherton.fixesthingstag:help.appveyor.com,2012-11-13:Comment/478020822019-11-10T19:22:53Z2019-11-10T19:23:30Zopenssl x64 static libs can't link in Visual Studio 2015<div><p>Is there any chance you could replace the packages in those builds with ones built with the right version of MSVC? See for instance: <a href="https://www.npcglib.org/~stathis/blog/precompiled-openssl/">https://www.npcglib.org/~stathis/blog/precompiled-openssl/</a></p>
<p>Statically linking against AppVeyor's currently installed C:\OpenSSL-Win64\ fails, but passes if you replace it with the MSVC 2015 binaries from <a href="https://www.npcglib.org/~stathis/downloads/openssl-1.0.2l-vs2015.7z">https://www.npcglib.org/~stathis/downloads/openssl-1.0.2l-vs2015.7z</a></p>
<p>Why include libraries that are guaranteed to not work?</p></div>patcherton.fixesthingstag:help.appveyor.com,2012-11-13:Comment/478020822019-11-11T17:07:32Z2019-11-11T17:07:32Zopenssl x64 static libs can't link in Visual Studio 2015<div><p>Thanks for pointing that out. If there are more requests to replace OpenSSL libs with alternative release we'd certainly do that. For now I assume you can easily download and replace them during your build.</p></div>Feodor Fitsner