Poco + OpenSSL compiled with VS2017
I basically want to end up with POCO linked against OpenSSL, for use with VS2017 compiler. Has anyone had success doing this?
I've been toying with the build for a few hours now, with little success. I initially downloaded OpenSSL binaries for linking. In this scenario, I was able to build POCO, but when I try to link to POCO, it fails. The project linking to poco is configured with the additional dependency directories and files (both for POCO and OpenSSL).
I can get the link errors down to just a handful of unresolved external dependencies on __iob_func.
Can anyone with experience with building Poco with SSL for VS2017 provide some guidance?
Posted Aug 25, 2017, 8:51 PM UTC
31
In the end I got there thank to this post
I downloaded openssl-1.0.2l, and augmented the VS2015 build script available from the here. The OpenSSL build script takes a reasonable amount of time to complete, but is worth every minute. The augmentation to the build script include pointing the script to the correct path of the vcvars32.bat & vcvars64.bat locations. I also updated text reference to VS2015 to VS2017.
As prerequisites, you will need NASM installed, along with 7-zip. Both these applications will need to be available via the system path variable.
Prior to starting the build the following tree describes the basic structure
Steps
Add the rebuild_openssl_vs2017.cmd linked above to your build_openssl directory. Check the contents suits the installation of your visual studio.
Open command prompt with admin rights
cd
build_openssl\rebuild_openssl_vs2017.cmd
Sit back for a while
When the build finishes you should have the following structure
C:\ -- |__ - openssl1.0.2l.tar.gz |__ - build_openssl
|__ - copy_openssl_pys.py |__ - patch_ntdll_mak.py |__ - rebuild_openssl_vs2010.cmd |__ - rebuild_openssl_vs2013.cmd |__ - rebuild_openssl_vs2015.cmd |__ - rebuild_openssl_vs2017.cmd |__ - poco
|__ - openssl-1.0.2l-32bit-debug-DLL-VS2017.7z |__ - openssl-1.0.2l-32bit-debug-static-VS2017.7z |__ - openssl-1.0.2l-32bit-release-DLL-VS2017.7z |__ - openssl-1.0.2l-32bit-release-static-VS2017.7z |__ - openssl-1.0.2l-64bit-debug-DLL-VS2017.7z |__ - openssl-1.0.2l-64bit-debug-static-VS2017.7z |__ - openssl-1.0.2l-64bit-release-DLL-VS2017.7z |__ - openssl-1.0.2l-64bit-release-static-VS2017.7z
Unzip the required 7z file for your poco build. So far I've just used 'openssl-1.0.2l-64bit-debug-static-VS2017'
In the poco directory, edit the buildwin.cmd file. The only edit I needed was 'set OPENSSL_DIR=C:\openssl-1.0.2l-64bit-debug-static-VS2017' to match the location of the openssl build you wish to link against.
Update the components file in poco directory (I did not need any of the SQL libraries).
Launch x64 Native Tools Command Prompt for VS 2017 and do the following
cd \poco buildwin 150 build static_md debug samples tests msbuild
When the build completes you should be able to navigate to the location C:\poco\NetSSL_OpenSSL\samples\Mail. Here you will find a sample that contains all the required information to build an application linking against NetSSL_OpenSSL
Hopefully this information helps someone!