Subject: Re: Xerces C++ support in cygwin
From: "Gerrit P. Haase" <[email-masked]>
To: "Abraham Backus" <[email-masked]>
Cc: [email-masked]
Date: Sun, 25 Aug 2002 16:55:10 +0200

Hallo Abraham,

Am Sonntag, 25. August 2002 um 06:47 schriebst du:

> Awesome!  I'm kinda new about what's expected of cygwin software with regard
> to what files are needed where.  I discovered though that after everything
> is built, if I put libxerces.dll into /usr/local/bin and then put a symlink
> to it in /usr/local/lib that everything builds ok.  That seems odd and it
> "worked" for my one test app that I've been working on, but it just didn't
> seem right because any other dll that my apps link to seemed to have a
> .dll.a file in the lib directory.

This part is wrong:

ifeq (${PLATFORM}, CYGWIN)
        -mkdir -p ${PREFIX}/bin
        $(CP) ${FQ_LINK_NAME} ${PREFIX}/bin
        rm -rf ${PREFIX}/lib/${LINK_NAME} && \
        ln -s ${PREFIX}/bin/${LINK_NAME} ${PREFIX}/lib/${LINK_NAME}
else

You cannot 'ln -s' a DLL on windows.
Also the DLL's don't need to be renamed.
Just put the created DLL (libxerces-c2_1_0.dll) into ${PREFIX}/bin.
And then put the import library (libxerces-c2_1_0.dll.a) into
${PREFIX}/lib, you can 'ln -s' now the import library:
ln -s ${PREFIX}/lib/libxerces-c2_1_0.dll.a ${PREFIX}/lib/libxerces-c.dll.a
ln -s ${PREFIX}/lib/libxerces-c2_1_0.dll.a ${PREFIX}/lib/libxerces.dll.a

The patch looks like this then:
===============================
--- Xerces/c/obj/Makefile.in~   2002-08-25 16:34:12.000000000 +0200
+++ Xerces/c/obj/Makefile.in    2002-08-25 16:52:11.000000000 +0200
@@ -92,6 +92,10 @@
 else
 LIBNAME=libxercesc
 endif
+ifeq (${PLATFORM}, CYGWIN)
+LIBNAME=libxerces-c
+IMPORTLIB=libxerces-c
+endif
 
 ALL_OBJECTS=$(wildcard $(PLATFORM)/*.o)
 
@@ -145,6 +149,7 @@
 # link your application.                               #
 ########################################################
 
+ifneq (${PLATFORM}, CYGWIN)
 ${FQ_REAL_NAME}:       $(ALL_OBJECTS)
        @echo Building ${FQ_REAL_NAME}
        ${MAKE_SHARED} ${LD_SONAME} -o ${@} ${^} $(TEMPLATESOBJS) $(PLATFORM_LIBRARIES) $(EXTRA_LINK_OPTIONS) $(ALLLIBS)
@@ -152,6 +157,11 @@
        rm -rf ${FQ_SO_NAME}   && ln -s ${FQ_REAL_NAME} ${FQ_SO_NAME}
        @echo symlink ${FQ_LINK_NAME}
        rm -rf ${FQ_LINK_NAME} && ln -s ${FQ_SO_NAME} ${FQ_LINK_NAME}
+else
+${FQ_REAL_NAME}:       $(ALL_OBJECTS)
+       @echo Building ${FQ_REAL_NAME}
+       ${MAKE_SHARED} ${LD_SONAME} -o ${@} ${^} $(TEMPLATESOBJS) $(PLATFORM_LIBRARIES) $(EXTRA_LINK_OPTIONS) $(ALLLIBS)
+endif
 
 ## Start OS390 ##
 ifeq (${PLATFORM},OS390)
@@ -194,9 +204,11 @@
        -mkdir -p ${PREFIX}/lib
 ifeq (${PLATFORM}, CYGWIN)
        -mkdir -p ${PREFIX}/bin
-       $(CP) ${FQ_LINK_NAME} ${PREFIX}/bin
-       rm -rf ${PREFIX}/lib/${LINK_NAME} && \
-       ln -s ${PREFIX}/bin/${LINK_NAME} ${PREFIX}/lib/${LINK_NAME}
+       $(CP) ${FQ_REAL_NAME} $(PREFIX)/bin
+       $(CP) ${XML_LIB_DIR}/${IMPORTLIB}${VER}.dll.a $(PREFIX)/lib
+       rm -rf ${PREFIX}/lib/${IMPORTLIB}.dll.a ${PREFIX}/lib/libxerces.dll.a
+       ln -s ${PREFIX}/lib/${IMPORTLIB}${VER}.dll.a ${PREFIX}/lib/${IMPORTLIB}.dll.a
+       ln -s ${PREFIX}/lib/${IMPORTLIB}${VER}.dll.a ${PREFIX}/lib/libxerces.dll.a
 else
        $(CP) ${FQ_REAL_NAME} $(PREFIX)/lib
 endif

# END PATCH

If you link your app with -lxerces, the linker will pick up
${PREFIX}/lib/libxerces.dll.a automatically then.

Do you want to test it and commit it to the Xerces developers?

Gerrit
-- 
perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/