Date: Wed, 1 May 2002 16:06:27 +1000 (EST) From: Gregory Bond <gnb@itga.com.au> To: FreeBSD-gnats-submit@FreeBSD.org Cc: geh@itga.com.au Subject: ports/37619: [patch] many xerces-c port problems, builds unlinkable .so file Message-ID: <200205010606.g4166RP45826@hellcat.itga.com.au>
next in thread | raw e-mail | index | archive | help
>Number: 37619 >Category: ports >Synopsis: [patch] many xerces-c port problems, builds unlinkable .so file >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Apr 30 23:10:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Gregory Bond >Release: FreeBSD 4.5-STABLE i386 >Organization: ITG Australia Limited >Environment: System: FreeBSD hellcat.itga.com.au 4.5-STABLE FreeBSD 4.5-STABLE #0: Wed Mar 27 11:09:35 EST 2002 toor@hellcat-new.itga.com.au:/usr/obj/usr/src/sys/HELLCAT i386 FreeBSD 4.5-Stable, xerces-c port version 1.6.0, port framework from 29/12/01 >Description: Building the xerces-c port gets a compiler error in the file src/util/Platforms/FreeBSD/FreeBSDPlatformUtils.cpp Yet the port build continues, and creates a .so file that can't be used because of missing symbols (from this and other porting problems). See also PRs ports/36248 and ports/37016 which update xerces to 1.7. >How-To-Repeat: $ cd /usr/ports/textproc/xerces-c && make >& errs $ grep FreeBSDPlatformUtils errs c++ -fPIC -DFREEBSD -c -O -pipe -D_GNU_SOURCE -D__USE_GNU -I/usr/ports/textproc/xerces-c/work/xerces-c-src1_6_0/include -o /usr/ports/textproc/xerces-c/work/xerces-c-src1_6_0/obj/FREEBSD/FreeBSDPlatformUtils.o FreeBSDPlatformUtils.cpp FreeBSDPlatformUtils.cpp:103: util/Transcoders/IconvFBSD/IconvFBSDTransService.hpp: No such file or directory FreeBSDPlatformUtils.cpp: In function `static class XMLTransService * XMLPlatformUtils::makeTransService()': FreeBSDPlatformUtils.cpp:320: syntax error before `;' FreeBSDPlatformUtils.cpp: In function `static void XMLPlatformUtils::closeMutex(void *)': FreeBSDPlatformUtils.cpp:558: warning: `void *const' is not a pointer-to-object type gmake[3]: *** [FreeBSDPlatformUtils.o] Error 1 $ [Note that the port build succeeds dispite this error] And when linking against the built .so file, notice error msgs like: /usr/local/lib/libxerces-c1_6_0.so: undefined reference to `XMLPlatformUtils::ma keTransService(void)' /usr/local/lib/libxerces-c1_6_0.so: undefined reference to `XMLPlatformUtils::re adFileBuffer(void *, unsigned int, unsigned char *)' and about 50 others, most defined in the FreeBSDPlatformUtils.cpp file. >Fix: There are several problems here. Why does the port build succeeds in the face of compile errors? The culprit is in src/Makefile.in, where there are a bunch of lines like Util:: @echo Building "util" ${CD} $(UTIL_DIR) ; $(MAKE) $(MAKE_FLAGS) ; ${CD} .. If the make fails, this is never reported back to the parent makefile because of the "; cd .." at the end (which succeeds). This should be converted to something like: Util:: @echo Building "util" ${CD} $(UTIL_DIR) && $(MAKE) $(MAKE_FLAGS) or even (given that it insists on gmake anyway...) Util:: @echo Building "util" $(MAKE) -C $(UTIL_DIR) $(MAKE_FLAGS) The same problem is in most of the other Makefile.in files in xerces. This has been reported to apache's bugzilla (Bug #8690), but a fix could be added to the port. The failed compilation is because the IconvFBSDTransService.h file is not being installed, which I think is because the Transcoder is set to native, when it should be set to IconvFBSD. The following patch to xercesc/Makefile fixes this: diff -u Makefile.orig Makefile --- Makefile.orig Wed May 1 12:30:09 2002 +++ Makefile Wed May 1 12:30:37 2002 @@ -24,6 +24,8 @@ # Set this to where the source lives MAKE_ENV+= XERCESCROOT=${WRKSRC} +CONFIGURE_ENV+= ${MAKE_ENV} TRANSCODER="IconvFBSD" + # If configure fails, try this: #CONFIGURE_SCRIPT= runConfigure -pfreebsd [As an aside, uncommenting CONFIGURE_SCRIPT as specified actually fails because XERCESCROOT is not set, because MAKE_ENV is not passed to the configure stage, only the build/install stage. You need to set CONFIGURE_ENV to ${MAKE_ENV} in order to use runConfigure] This done, the pkg list is wrong because it still refers to the native transcoder, so "make package" fails, as does uninstalling the port. The following patch fixes that: --- pkg-plist.orig Wed May 1 12:33:50 2002 +++ pkg-plist Wed May 1 12:34:43 2002 @@ -96,7 +96,7 @@ include/xercesc/util/AutoSense.hpp include/xercesc/util/XMLDeleterFor.c include/xercesc/util/Platforms/FreeBSD/FreeBSDDefs.hpp -include/xercesc/util/Transcoders/Iconv/IconvTransService.hpp +include/xercesc/util/Transcoders/IconvFBSD/IconvFBSDTransService.hpp include/xercesc/util/MsgLoaders/InMemory/InMemMsgLoader.hpp include/xercesc/util/MsgLoaders/InMemory/CppErrMsgs_EN_US.hpp include/xercesc/util/Compilers/BorlandCDefs.hpp @@ -348,7 +348,7 @@ lib/libxerces-c1_6_0.so @dirrm include/xercesc/util/Platforms/FreeBSD @dirrm include/xercesc/util/Platforms -@dirrm include/xercesc/util/Transcoders/Iconv +@dirrm include/xercesc/util/Transcoders/IconvFBSD @dirrm include/xercesc/util/Transcoders @dirrm include/xercesc/util/MsgLoaders/InMemory @dirrm include/xercesc/util/MsgLoaders Still not there yet. xercex by default builds as a threaded library, so I've added a knob to build it unthreaded (apply this patch after the previous one - note it forces use of runConfigure as it seems setting the THREADS=none environment variable doesn't cut it for plain configure): --- Makefile.thread Wed May 1 14:30:42 2002 +++ Makefile Wed May 1 14:55:57 2002 @@ -29,6 +29,13 @@ # If configure fails, try this: #CONFIGURE_SCRIPT= runConfigure -pfreebsd -tIconvFBSD +.if defined(NO_THREADS) +.if !defined(CONFIGURE_SCRIPT) +CONFIGURE_SCRIPT= runConfigure -pfreebsd -tIconvFBSD +.endif +CONFIGURE_SCRIPT += -rnone +.endif + USE_GMAKE= yes HAS_CONFIGURE= yes GNU_CONFIGURE= yes One last problem: xerces calls stricmp() and strnicmp() which are not in the C library. They're called strcasecmp() and strncasecmp() instead. Fix it by adding a patch file to the port like so (I call it files/patch-XMLstring): --- src/util/XMLString.cpp.orig Fri Dec 7 20:45:26 2001 +++ src/util/XMLString.cpp Wed May 1 15:57:46 2002 @@ -254,7 +254,7 @@ int XMLString::compareIString(const char* const str1, const char* const str2) { - return stricmp(str1, str2); + return strcasecmp(str1, str2); } @@ -277,7 +277,7 @@ if (!count) return 0; - return strnicmp(str1, str2, count); + return strncasecmp(str1, str2, count); } @@ -514,7 +514,7 @@ bool XMLString::startsWithI(const char* const toTest , const char* const prefix) { - return (strnicmp(toTest, prefix, strlen(prefix)) == 0); + return (strncasecmp(toTest, prefix, strlen(prefix)) == 0); } And at last we have a linkable .so file. As an editorial comment, this is a pretty shoddy piece of port construction. Yes it compiles, but it doesn't work (and never could have worked). Didn't anyone test it? >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200205010606.g4166RP45826>