I am trying to build gSoap binaries with ssl support. I have downloaded the latest gSoap and binaries for WIN32 openssl from this website: http://slproweb.com/products/Win32OpenSSL.html
According to the gSoap documentation, I have to compile using the standard procedure with the DWITH_OPENSSL option enabled. I think the most natural option would be tu use minGW, but I have little experience with this tool. When I try this, (and after applying this patch I am left with two missing libraries a link time: -lssl and -lcrypto.
I guess I have to add a -L option to the compiling directive, but I dont see any libssl or libcrypto (should it be .a or .lib ?) in the openssl lib folder. Must I recompile these too or am I missing something ?
Yes, as I know if you use minGW
1st off install openssl
and after that add path + flag like in followed example:
gcc -I/include/
-I/local/include
-L/local/lib
-o download_file download_file.c -llibcurl -lcurl
Here I compile basic C
file.
Or if you run ./configure
add flags like this:
LDFLAGS+="-L/local/lib -lcurl" LIBS+=-I/local/include ....
You can also use a bit more "native" way, ie. Visual Studio C compiler for that. However this is not very straighforward.
First, compiling openssl (valid for VS 2015 Community Edition, but I believe any 2015 will do):
- download openssl sources, unzip to some folder
- download PERL for windows (either ActivePerl or Straberry Perl - this one is free) and install
- open "Open Visual Studio 2015 Tools Command Prompt" from menu start
- cd to openssl uncompressed source folder
Run following commands there (this set is using version w/o assembbler):
perl Configure VC-WIN32 no-asm --prefix=c:\some\openssl\dir
ms\do_ms
nmake -f ms\ntdll.mak
nmake -f ms\ntdll.mak test - optional step
nmake -f ms\ntdll.mak install
Afterwards, you get your openssl products installed in c:\some\openssl\dir
Next, to compile gSoap based application with SSL support, you have to add following settings (All settings are done from "Project->Properties" in Visual Studio):
- C/C++ --> General, In Additional Include Directories, add "c:\some\openssl\dir\include" folder to the list
- C/C++ --> Command Line, in the box "Additional Options", type: /DWITH_OPENSSL
- Linker --> Input, Additional Dependencies: add "c:\some\openssl\dir\lib\libeay32.lib" and "c:\some\openssl\dir\lib\sskeay32.lib" to the list
If you have generated your classes using wsdl2h.exe and soapcpp2.exe tools, you are almost done.
Verify, that your stdsoap2.cpp file has those lines:
#include <openssl\ssl.h>
#include <openssl\rsa.h>
If not, you can add them just after first #ifdef WITH_OPENSSL
That was all for mine project. I could compile with VC2015 and run/debug like any other app.
Good luck.
Ok I finally made it, here are the different steps I used :
First, I had to rebuild openssl with mingw since the static libraries are not shipped with the binaries shipped by Shining Light Production. I put the openssl folder in c:/openssl/
Then, in stdsoap2.h, I changed line 2247 to :
#if defined(WIN32) && !defined(__MINGW32__)
#define soap_strtoll _strtoi64
#else
# define soap_strtoll strtoll
#endif
#if defined(WIN32) && !defined(__MINGW32__)
# define soap_strtoull _strtoui64
#else
# define soap_strtoull strtoull
#endif
In the configure file:
- I removed all occurence of -DWITH_GZIP and -lz.
I added the -lws2_32 linker option (support for winsocket I think)
Those changes in the configure file are in lines 7338-7347 :
WSDL2H_EXTRA_FLAGS="-DWITH_GNUTLS"
WSDL2H_EXTRA_LIBS="-lgnutls -lgcrypt -lgpg-error"
SAMPLE_SSL_LIBS="-lgnutls -lgcrypt -lgpg-error"
WSDL2H_SOAP_CPP_LIB="libgsoapssl++.a"
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
WSDL2H_EXTRA_FLAGS="-DWITH_OPENSSL"
WSDL2H_EXTRA_LIBS="-lssl -lcrypto -lws2_32"
SAMPLE_SSL_LIBS="-lssl -lcrypto -lws2_32"
I ran configure in mingw adding the proper LDFLAGS and CXXFLAGS, namely :
LDFLAGS+=" -L/c/openssl/ -L/c/MinGW/lib/" CXXFLAGS+=" -I/c/openssl/include/" ./configure
- I ran make and crossed my finger!