3

I am writing C program on Windows with MingW and want to use EXPAT XML library. I want to compile my program statically, so I need static .a library.

Is there any way to compile EXPAT to .a static, independent library on Windows?

skaffman
  • 398,947
  • 96
  • 818
  • 769
innocenat
  • 574
  • 7
  • 21

3 Answers3

2

If you download official releases from Expat Sourceforge project page you won't be able to compile and install the library with MSYS nor MinGW. You will need an installation of CygWin to configure, make and install.

To compile and install native MinGW library you need modified version of configure script and libtool. Just download expat source tarball provided by MinGW instead of main original expat. Also you may want use precompiled binaries instead

sorush-r
  • 10,490
  • 17
  • 89
  • 173
0

You can get dynamic and static version of expat using MinGW package installer:

  1. open a cmd or shell
  2. update the package list: mingw-get update (optional)
  3. install the package(s) you need:
    • dynamic (.dll): mingw-get install expat
    • static (.a and .dll.a): mingw-get install libexpat
  4. depending on what you've chosen, you'll find ...
    • dynamic lib in <your mingw>/bin, file: libexpat-1.dll
    • static lib in <your mingw>/lib, files: libexpat.a, libexpat.dll.a, libexpat.la

Package overview:

  • package expat: Dynamic libexpat-1.dll incl. xmlwf.exe
  • package libexpat: Static libexpat.a, libexpat.dll.a and libexpat.la
ollo
  • 24,797
  • 14
  • 106
  • 155
0

I just downloaded and built the package, it appears to have made a static library by default. What's not working for you?

Carl Norum
  • 219,201
  • 40
  • 422
  • 469
  • 1
    What is your 'build'? Because I have no cygwin so I can't build the linux source, which use autoconf, and no MSVC, so I can't build the windows source. And I need .a, not .lib, .dll or .so. – innocenat Jun 28 '10 at 13:19
  • I'm in the same situation. Despite no error occurs, MinGW's ld refuses to generate any .la nor .dll libraries. – sorush-r Dec 21 '12 at 07:07