Re: [xml] MSYS and MINGW: undefined reference to _imp__xmlFree

Martin Schlemmer wrote:
On 11/8/2009 at 8:08 PM, Roumen Petrov <bugtrack roumenpetrov info> wrote:
Roumen Petrov wrote:
Martin Schlemmer wrote:

It seems to me Martin is right but proposed patch is not correct to me. I think that code has to set LIBXML_STATIC internally when is compiled for static library. As libxml build is libtool based we may use PIC definition. libtool when compile source for shared always set -DPIC .

Idea was sort of to remove the need for that.  I will respond to Igor's mail about that.

Now with reverted commit 629f7cc9b
, i.e. restored "...defined(IN_LIBXML)..." plus following patch
diff --git a/libxml.h b/libxml.h
index 3c44c83..1656ac2 100644
--- a/libxml.h
+++ b/libxml.h
@@ -90,4 +90,7 @@ void __xmlGlobalInitMutexDestroy(void);
+#ifndef PIC
+#  define LIBXML_STATIC
  #endif /* ! __XML_LIBXML_H__ */

This probably will break MSVC and Borland.  Also non-libtool-enabled builds might also break,
as "-fPIC -DPIC" is added by libtool, but ignored by gcc on win32 as all code on x86-win32 is already
position independent.

No ! -fPIC is not set for gcc mingw target by libtool !

For mingw target it is another definition that you already use in the
patch proposed by you : #if defined(DLL_EXPORT) .... i.e. libtool for
mingw target set -DDLL_EXPORT -DPIC. For gcc on linux it is -fPIC -DPIC
. For other compilers as example -kPIC -DPIC.
In brief one is compiler flag and another is common for all platforms -
it is C preprocessor flag -DPIC.

Not sure what to suggest with this, but to check that with reverted commit that xmlsec is indeed
built with -DLIBXML_STATIC if linking to the static version of the library.

Don't mix preprocessor flags set by other projects when static linking
with libxml is required.




Quote "...(you might have conditional code inside ‘#ifdef PIC’ for
example), ...". As in libxml exist another preprocessor directive
-DLIBXML_STATIC my suggestion is based on libtool documentation.
If modification to libxml.h is acceptable then Borland and MSVC
makefiles can set either -DPIC or -DLIBXML_STATIC. Both will work only
if first case build system will be more consistent.


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