santuario-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hill, Shane" <>
Subject Compiling xml-security-c with MSYS MinGW gcc. [SEC=UNCLASSIFIED]
Date Thu, 19 Jan 2012 06:45:34 GMT

Hi All,

I use xerces-c to read/with XML DOM structures and compile it using
MinGW gcc without issue. I searched the web for any info on how to get
xml-security-c compiled under MinGW using gcc and could not find
anything useful. So I took a brute force approach and got it compiled
myself. The process for doing so is listed below. If anyone has some
comments on how to do this a better way, that would be good.

I'm happy to add this to the xml-security-c issues tracking, but I could
not see a way to log in to that. Any suggestions?


Shane Hill

Shane D. Hill (B.E. Aero. Hons.)
Science Team Leader: Aircraft Flight Dynamics, Modelling & Simulation
Aircraft Vehicles Division Defence Science & Technology Organisation

Build and install the following packages (I installed under
  * xerces-c (I used 3.1.1)
  * OpenSSL  (I used 1.0.0f)

In an MSYS bash shell type the following:

  $ export CPPFLAGS="-IC:/MinGW/local/include"
  $ export CXXFLAGS="-IC:/MinGW/local/include"
  $ export CPPFLAGS="-IC:/MinGW/local/include"
  $ export LDFLAGS="-LC:/MinGW/local/lib"

Edit the following files and remove and reference to "_DDLL_EXPORT" and
I replaced "-g -O2" with "-O3":

  * configure
  * libtool

Edit the following files and replace any instance of "Unix" with "Win32"
And any instance of "unix" with "win":

  * xsec/
  * xsec/

Edit xsec/utils/winutils/XSECBinHTTPURIInputStream.cpp and:

  a. Add "#include <limits.h>" at the top of the file.
  B. Modify compareAndSway() to use the following (make sure to remove
     the extra "::" on the function:

  return InterlockedCompareExchangePointer(toFill, (void*)newValue,

Edit xsec/framework/XSECW32Config.hpp and comment out "#define

Edit xsec/framework/XSECDefs.hpp and add the following after the


Run the following:

  $ ./configure --prefix=C:/MinGW/local --without-xalan
--disabled-shared --enable-static
  $ make

Now the make process may fail during link due to multiple references to
libstdc++ through the use of libtool. This is fixed by removing any
references to out of the following files:

  * xsec/
  * xsec/.libs/
  * xsec/.libs/libxml-security-c.lai

Run the following:

  $ make
  $ make install

For DLL libraries I cheat. I have my own script that will convert any
library.a into a library.dll.a. Some of you may be able to see issues
with doing this, but it all seems to work okay for me. The script is
below. I used the following command to do this:

  $ ./createdllc++ libxml-security-c.a -LC:/MinGW/local/lib -lxerces-c \
      -lssl -lcrypto -lz


if [ ${#*} -eq 0 ]; then
  echo "Usage: createdllc++ <lib????.a> [extra options]"
  exit 1

shift 1

echo "ar -x ${LIBNAME}.a"
ar -x ${LIBNAME}.a
echo "g++ -shared -o ${LIBNAME}.dll *.o
AME}.dll.a ${*}"
g++ -shared -o ${LIBNAME}.dll *.o
g++ -Wl,--enable-auto-import,--output-def,${LIBNAME}.def,--out-implib,${
g++ LIBNAME}.dll.a ${*}
echo "rm -f *.o"
rm -f *.o

IMPORTANT: This email remains the property of the Department of Defence
and is subject to the jurisdiction of section 70 of the Crimes Act 1914.
If you have received this email in error, you are requested to contact
the sender and delete the email.

View raw message