Re: Building XSLT on Windows using mingw

Roumen Petrov <[email protected]> Sat, 15 Dec 2012 00:44:13 +0200
Newsgroups gmane.comp.gnome.lib.xslt
Message-ID <[email protected]>
Paul Moore wrote:
> I am trying to build libxslt on Windows, using the mingw toolchain.
> Unless I'm mistaken, it doesn't look like this approach is commonly
> used, as there seem to be a number of problems with the mingw makefile
> supplied.
Right. Mingw makefile based build cannot be expected to be widely used.
Autotool based offer common build process. It could be used either for 
native or for cross builds.

[SNIP]
> I am using the latest mingw, with gcc version 4.7.2, on Windows 7.
[SNIP]
> I have built libxml, by means of the documented build process
>
> cscript configure.js compiler=mingw zlib=yes prefix=foo
> mingw32-make install
>
> (There's one easily fixed problem here - the makefile needs a define
> of HAVE_STDINT_H, which I guess is because gcc 4.7.2 is a later
> version than the one the makefile was designed for, so now has the
> header where it didn't before).
No it is header from mingw runtime . It is fine to define it in makefile 
based libxml mingw build.
> This gives me libxml in ...\libxml-2.9.0\win32\foo
>
> Now, I go to libxslt-1.1.28\win32. In order to get a clean build, I
> need to apply the attached patch. (One thing this does is include
> attrvt.c into the build, which suggests to me that the mingw makefile
> has been missed in some previous changes - I've compared with the MSVC
> makefile template, though, and can't see any other obvious problems).
You patch looks good to me.

> The patch adds the aforementioned attrvt.c, changes a few -llibxml2 to
> the correct form for mingw, -lxml2, and reorders the link libraries
> when building xsltproc so that the symbols are all resolved correctly
> (ld only does one pass over the -l options to satisfy symbol
> resolution).
>
> With this patch applied, and with
> ...\libxml-2.9.0\win32\foo\include\libxml2 added to C_INCLUDE_PATH and
> ...\libxml-2.9.0\win32\foo\lib added to LIBRARY_PATH (the include= and
> lib= parameters to configure.js don't seem to make any difference), I
> get the following error on building:
>
> ...
> gcc.exe [SNIP]
> int.xslt.mingw/attrvt.o -lwsock32 -lxml2
Uhh may be one day winsock library will be removed from both builds - 
autotool & makefile based .
> [SNIP]
> int.xslt.mingw/attributes.o:attributes.c:(.text+0x380): undefined
> reference to `_imp__xmlStringTextNoenc'
> int.xslt.mingw/attributes.o:attributes.c:(.text+0x492): undefined
> reference to `_imp__xmlFree'
This is issue with variable export/import. May be makefile libxml build 
use incorrect header or is installed incorrect header

> [SNIP]
> d:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe:
> int.xslt.mingw/attributes.o: bad reloc address 0x20 in section
> `.eh_frame'
No idea.
May be a library or crt file is build with 'old' compiler . 4.7.x is not 
compatible with versions before .

> [SNIP]
>
> Thanks,
> Paul.

Roumen