Re: [xml] compile libxml2.7.8 under cygwin&Win7 with mingw toolchain



lin hong wrote:

I'm more comfortable with MSYS.

most work we did are under mac/linux, but for windows release, we are
using cygwin. is MSYS better than cygwin? I'm not familiar with windows at
all.


MSYS is a fork of Cygwin at version 1.3.3 and modified to apply some
automagic for POSIX versus Windows paths.  It gives MinGW and build
environment that is identified as mingw32.  It provides a minimal set of
commands to execute configure and make for the MinGW environment.


we got the binary from http://xmlsoft.org/sources/win32/

but it does not work on cygwin + Win7 , just try to run any exe file
under
/bin dir, we got this.

./xsltproc.exe
/usr/i686-pc-mingw32/xslt_xml2/bin/xsltproc.exe: error while loading
shared libraries: ?: cannot open shared object file: No such file or
directory


Where do the .dll live?  In /usr/i686-pc-mingw32/xslt_xml2/bin?  If not,
you'll need to add the path to the dll to PATH or move the dll to this
xslt_xml2/bin directory.

what ".dll" files do we need to move under /bin ?

I believe it works for WinXP because I saw the msg on the website:
"The binaries are supported on an operating system based on the
NT-kernel,
such as Windows NT, Windows 2000 and Windows XP, exclusively"

also it seems require iconv, which we don't really need.


libxslt requires it.

we did compile libxslt later without iconv -- at least I thought it works.
maybe we are missing some part of function.


Iconv is delivered by default with a minimal MinGW environment because
of dependencies on it by gcc so I didn't try not to build without it.


The -mno-cygwin switch is dead.  Cygwin now uses a cross build concept
instead of a bastardized separation of MinGW gcc and Cygwin gcc.  This
is the reason you'll need to specify the --host if you Cygwin to
configure it.


really? we are using cygwin1.7.9(0.237/5/3).  is the "--host" option for
cygwin or just for libxml?
if the "--host" option can take care of MingGW/Cygwin choice problem, it
would be great.


GCC itself no longer knows about -mno-cygwin and will give an error with
a message of "gcc: The -mno-cygwin flag has been removed; use a
mingw-targeted cross-compiler."  The --host is a configure option so
that Cygwin will pick a set of gcc tools that targets a MinGW
environment.  AIUI beginning with 1.7.0 Cygwin decided to start using a
cross compile method for MinGW so the Cygwin MinGW compiler is hosted on
Cygwin but targets MinGW.  They did this so that they do not have to
worry about the fact that a native MinGW compiler doesn't understand the
Cygwin POSIX paths.  It allows for a native executable to be built with
a Cygwin hosted compiler that targets Mingw.  Looking at the package
selection from Cygwin's setup program I think you would want the
gcc-mingw-* set of files.

1.2 Want more output during compiling? add "-v"
! CFLAGS += -v -DWIN32 -D_WINDOWS -D_MBCS -DNOLIBTOOL


I don't know about these defines, I did not have to do that.


"-v" is just verbose option. it's not necessary. other options are default
by the makefile.


I understand what -v does.  -DNOLIBTOOL is likely because you can't
execute libtool script without sh.exe.

1.3 The default gcc linker refuse to look into Mingw directory before
Cygwin directory, I don't know why, so I use flexlink instead, modify
LD:

Again you need to add --host to the configure.

LD = flexlink
also add flags flexlink needs:
+ #flexlink flag
+ FL_LDFLAGS = -chain mingw
+ FL_LDFLAGS += -L $(BINDIR) -L $(LIBPREFIX)


I don't have any idea what flexlink is.

flexlink is linker that manage symbols for windows dll. make lift easier
for windows rookie like me, you can download it from
http://alain.frisch.fr/flexdll.html.


Ok, another dlopen implementation I guess.


1.4 Then call our LD with its flags to make "dll"
# Creates the libxml shared object.
! #XMLSO_LDFLAGS = $(LDFLAGS) -shared -Wl,--dll
-Wl,--out-implib,$(BINDIR)/$(XML_IMP)
  $(BINDIR)/$(XML_SO) : $(BINDIR) $(XML_OBJS)
!  $(LD) $(FL_LDFLAGS) -o $(BINDIR)/$(XML_SO) $(XML_OBJS) $(LIBS)


Configure with --disable-static --enable-shared or vice versa.

I thought we need to set "static=1", so here we should do --enable-static
& --disable-shared?


If you don't want a dll version of libxml2 and libxslt, yes.


1.5 Make ".a" , there is a typo in the original makefile, they mess up
the
"/" with "\" -- you will get a "bin.mingwlibxml2.a" instead of
"bin.mingw/libxml2.a" because of this.
 # Creates the libxml archive.
  $(BINDIR)/$(XML_A) : $(BINDIR) $(XML_OBJS_A)
!  $(AR) $(ARFLAGS) $(BINDIR)/$(XML_A) $(XML_OBJS_A)


The Makefile.mingw is probably constructed to be used with mingw32-make
which can handle the \ in paths but lacks in other things.

where is "mingw32-make"?


It is distributed by the MinGW project on SourceForge.  It is an
implementation of GNU make and the Windows source is a part of the
maintained version of GNU make.

-- 
Earnie
-- https://sites.google.com/site/earnieboyd/



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