Re: [xml] HOWTO build libxml2 with minGW & pthreads-win32



Hi Michael,

The binaries on my site are built with thread support disabled.

That should not prevent you to use pthreads in your application. You must however take care about the threads at the application level, should you decide to use the binaries.

I have commited support for pthreads last week. The CVS snapshot of libxml2 now compiles with pthreads-win32. You will have to get the CVS snapshot and compile libxml with threads enabled. Still, pthreads support is in its infancy, because the testThreads executable trashes somewhere in pthreads library, a thing I must investigate.

Libxml has ben compiled using MS compiler. Mingw uses the same runtime and the binary code made by these two should be compatible. However, it tends not to be compatible when any form of exception handling or setjmp/longjmp is used, and pthreads-win32 does exactly that. The best for you would be to compile everything you use with the same compiler.

There is win32/Makefile.mingw. This one should one day become an equivalent for win32/Makefile.msvc for Windows without autoconf and sh. Ideal would be if this file would follow the same road as Makefile.msvc does. You would then be able to use the JScript-based configure, just like MSC users do, and specify say compiler=mingw on the command line. Makefile.mingw is unfortunately still not that far. The best for your environment would be to modify that win32/Makefile.mingw to work just like win32/Makefile.msvc does and that we then integrate it into the JScript configure. See win32/Readme.txt for more about this scheme.

There was some work done to allow mingw with autoconf and sh to work, either as a Unix-based cross-compiler, or as a Windows-based compiler with MSYS. I have dome some modifications to that end, but it is not finished. The users of such environment now must do the rest, or tell me what must be done.

Ciao
Igor


Michel GOUGET wrote:
Hi Igor,

I think this question is for you.
I am porting from Linux to windows a program using libxml2 and pthreads.
I thought that the most straightforward way would be to use minGW (and more
specifically dev-C++ with gcc 2.95.3-6), and pthreads-win32 (snapshot
2002-03-02, the latest version at sources.redhat.com) , I got the libxml and
iconv libraries from your site and compiled the thing, but got segv the
first time I was using xmlMalloc().
I was able to compile and run successfully a small test program (parse an
xml file); so I suspect that the lib has been built for another threads
package and maybe another compiler/runtime.
It looks like I must get the lib from the CVS tree and recompile it if I
want to do serious work.
So my questions are:
- Is it necessary ?
- If yes, could you give me hints or pointers on how to do it for my
environment before I start reinventing the wheel. Mingw has no
autoconf/automake, so what about defines ?, makefile ?, tricks ?, compiler
switches?.

Thanks,

Michel





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]