Bug 37619 - [patch] many xerces-c port problems, builds unlinkable .so file
Summary: [patch] many xerces-c port problems, builds unlinkable .so file
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: bill fumerola
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-05-01 07:10 UTC by Gregory Bond
Modified: 2002-06-03 21:46 UTC (History)
1 user (show)

See Also:


Attachments
file.diff (901 bytes, patch)
2002-05-01 07:10 UTC, Gregory Bond
no flags Details | Diff
file.diff (415 bytes, patch)
2002-05-01 07:10 UTC, Gregory Bond
no flags Details | Diff
file.diff (713 bytes, patch)
2002-05-01 07:10 UTC, Gregory Bond
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gregory Bond 2002-05-01 07:10:01 UTC
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.

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:

[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:

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):
 
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):
 


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?--VqTNWxLcFwu0nUAcDm06sZKpH4TwTUkDWePeaNkuVsrdw5N4
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

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
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.
Comment 1 bill fumerola freebsd_committer freebsd_triage 2002-06-01 03:37:23 UTC
Responsible Changed
From-To: freebsd-ports->billf

i'm updating the xerces_c port
Comment 2 bill fumerola freebsd_committer freebsd_triage 2002-06-01 03:37:23 UTC
Responsible Changed
From-To: freebsd-ports->billf

i'm updating the xerces_c port
Comment 3 bill fumerola freebsd_committer freebsd_triage 2002-06-01 03:37:23 UTC
Responsible Changed
From-To: freebsd-ports->billf

i'm updating the xerces_c port
Comment 4 bill fumerola freebsd_committer freebsd_triage 2002-06-03 21:45:05 UTC
State Changed
From-To: open->closed

port updated, please update your ports tree and submit 
diffs relative to the new port if i missed any of your 
changes.
Comment 5 bill fumerola freebsd_committer freebsd_triage 2002-06-03 21:45:05 UTC
State Changed
From-To: open->closed

port updated, please update your ports tree and submit 
diffs relative to the new port if i missed any of your 
changes.
Comment 6 bill fumerola freebsd_committer freebsd_triage 2002-06-03 21:45:05 UTC
State Changed
From-To: open->closed

port updated, please update your ports tree and submit 
diffs relative to the new port if i missed any of your 
changes.