>>> On 2009/11/09 at 10:53 PM, Roumen Petrov <[email protected]> wrote: > Martin Schlemmer wrote: >>>>> On 11/8/2009 at 8:08 PM, Roumen Petrov <[email protected]> wrote: >>> Roumen Petrov wrote: >>>> Martin Schlemmer wrote: >>>>> Hi, >>>>> >>>> [SNIP] >>>> 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 >>> http://git.gnome.org/cgit/libxml2/commit/?id=a194ccb8d19ddde94c2c04ddf197e6a >>> > >>> 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); >>> #endif >>> #endif >>> #endif >>> +#ifndef PIC >>> +# define LIBXML_STATIC >>> +#endif >>> #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. >
Never mind here - I missed that it was in an internal header, and thus would not have effected external projects linking against libxml. > >> 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. > Like Igor pointed out, LIBXML_STATIC needs to be defined if you link against the static version for the current setup. If using pkg-config for a static only build of libxml, this is not an issue, but ... Regards, Martin Vrywaringsklousule / Disclaimer: http://www.nwu.ac.za/it/gov-man/disclaimer.html _______________________________________________ xml mailing list, project page http://xmlsoft.org/ [email protected] http://mail.gnome.org/mailman/listinfo/xml
