<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:1586449852;
mso-list-type:hybrid;
mso-list-template-ids:-214420772 -1813460614 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
{mso-level-start-at:0;
mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:Symbol;
mso-fareast-font-family:Calibri;
mso-bidi-font-family:"Times New Roman";}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:"Courier New";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:Symbol;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:"Courier New";}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:Symbol;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:"Courier New";}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;
font-family:Wingdings;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hello all.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I am trying to cross-compile strongSwan for Windows using MinGW64 on Ubuntu 16.04 (64-bit). The problem I am having at the moment is OpenSSL.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">My steps were:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Install MinGW64<o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> sudo apt-get install mingw-w64<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Build OpenSSL<o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> git clone https://github.com/openssl/openssl.git OpenSSL_1_1_0-stable<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> cd OpenSSL_1_1_0-stable<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> git checkout OpenSSL_1_1_0-stable<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> ./Configure --prefix=$PWD/build --cross-compile-prefix=x86_64-w64-mingw32- mingw64 no-asm no-deprecated mingw64<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> make<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> make install<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Grab strongSwan 5.6.0<o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> git clone git://git.strongswan.org/strongswan.git<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> cd strongswan<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> git checkout 5.6.0<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Now, at this point I hit a problem. If I just run autogen.sh, it would produce a configure file that has ‘openssl_lib=eay32’, but OpenSSL no longer builds libraries with that name. So I changed that line to be ‘openssl_lib=crypto’.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Issue the configure command<o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> ./autogen.sh<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> ./configure --prefix=$PWD/build --disable-defaults --enable-monolithic --enable-static --enable-svc \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> --enable-ikev2 --enable-ikev1 --enable-nonce --enable-pem --enable-pkcs1 --enable-x509 \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> --enable-openssl --enable-socket-win --enable-kernel-wfp --enable-kernel-iph --enable-pubkey \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> --enable-swanctl --with-swanctldir=swanctl --with-strongswan-conf=strongswan.conf --host=x86_64-w64-mingw32 \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> CFLAGS="-g -O2 -Wall -Wno-pointer-sign -Wno-format-security -Wno-format -mno-ms-bitfields -I/home/kevin/OpenSSL_1_1_0-stable/build/include" \<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> LDFLAGS="-L/home/kevin/OpenSSL_1_1_0-stable/build/lib"<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The configure works, but there is one item of note in the output:<o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> checking for EVP_CIPHER_CTX_new in -lcrypto... yes<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> checking openssl/evp.h usability... yes<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> checking openssl/evp.h presence... no<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> configure: WARNING: openssl/evp.h: accepted by the compiler, rejected by the preprocessor!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> configure: WARNING: openssl/evp.h: proceeding with the compiler's result<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> checking for openssl/evp.h... yes<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Run the make<o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> make<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">This is my point of failure. The build fails when compiling the openssl plugin:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">Making all in plugins/openssl<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">make[5]: Entering directory `/home/kevin/strongswan-5.6.0/src/libstrongswan/plugins/openssl'<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">depbase=`echo openssl_rsa_private_key.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> /bin/bash ../../../../libtool --tag=CC --mode=compile x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I../../../.. -I../../../../src/libstrongswan -DFIPS_MODE=0 -I/usr/local/include -g -O2
-Wall -Wno-pointer-sign -Wno-format-security -Wno-format -mno-ms-bitfields -I/home/kevin/openssl-master/build/include -include /home/kevin/strongswan-5.6.0/config.h -MT openssl_rsa_private_key.lo -MD -MP -MF $depbase.Tpo -c -o openssl_rsa_private_key.lo openssl_rsa_private_key.c
&&\<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> mv -f $depbase.Tpo $depbase.Plo<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">libtool: compile: x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I../../../.. -I../../../../src/libstrongswan -DFIPS_MODE=0 -I/usr/local/include -g -O2 -Wall -Wno-pointer-sign -Wno-format-security -Wno-format
-mno-ms-bitfields -I/home/kevin/openssl-master/build/include -include /home/kevin/strongswan-5.6.0/config.h -MT openssl_rsa_private_key.lo -MD -MP -MF .deps/openssl_rsa_private_key.Tpo -c openssl_rsa_private_key.c -DDLL_EXPORT -DPIC -o .libs/openssl_rsa_private_key.o<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">In file included from /usr/share/mingw-w64/include/windows.h:95:0,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> from /usr/share/mingw-w64/include/winsock2.h:23,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> from ../../../../src/libstrongswan/utils/compat/windows.h:24,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> from ../../../../src/libstrongswan/utils/utils.h:38,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> from ../../../../src/libstrongswan/library.h:101,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> from ../../../../src/libstrongswan/credentials/builder.h:41,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> from openssl_rsa_private_key.h:26,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> from openssl_rsa_private_key.c:25:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">/home/kevin/openssl-master/build/include/openssl/x509.h:84:34: error: expected ')' before numeric constant<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">typedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> ^<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I originally tried using a pre-built OpenSSL from <a href="https://slproweb.com/products/Win32OpenSSL.html">
https://slproweb.com/products/Win32OpenSSL.html</a>, but the strongSwan build failed the same way. That’s why I built OpenSSL myself, hoping it would fix the problem. However, since it appears to be a problem with the headers, it’s not too surprising that both
builds failed.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">So, can anyone tell me what I am doing wrong?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,<o:p></o:p></p>
<p class="MsoNormal">Kevin<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>