On Jan 10, 2008, at 4:13 PM, Wilfong, Paul wrote:
Hi,
I have tried to build log4cxx as an "so" library on a Sun computer
(Sun OS 5.10). Everyting seems to build Ok (as described below).
This computer is a standalone - my company won't let it be connected
to the internet.
Now I have written a program that builds, but when run, a
log4cxx::helpers::IllegalArgumentException is thrown from
charsetencoder.cpp:74. The constructor of APRCharsetEncoder uses
apr_xlate_open() with arguments of frompage="UTF-8" and
topage=APR_LOCALE_CHARSET. The latter is a specially handled value
(defined to be 0x01), meant to return the system's locale charset.
This call to apr_xlate_open() is failing. The exact output is:
terminate called after throwing an instance of
'log4cxx::helpers::IllegalArgumentException'
what(): APR_LOCALE_CHARSET
Here are the build details (some "--with" paths are not shown):
1. Build apr:
extract apr-1.2.9.tar
configure
make (actually, use gmake not make!)
2. Build apr-iconv:
extract apr-iconv-1.2.1.tar
configure --with-apr
make
3. Build apr-util:
extract apr-util-1.2.8.tar
configure --with apr -- with-iconv
make
4. Build log4cxx:
extract log4cxx.0.10.tar
configure --with-apr --with-apr-util
edit log4cxx.10.10.0/libtool
< postdeps="-lstdc++ -lm -R/usr/sfw/lib -lgcc_s -R/usr/sfw/
lib -lgcc_s"
< posteps="-lm -R/usr/sfw/lib -lgcc_s -R/usr/sfw/lib -lgcc_s"
make LDFLAGS=/path/to/libapriconv-1.so
5. Build the application and try to execute it. At this point the
failure described above occurs.
When apr-util (1.2.8) is not configured to use apr-iconv (1.2.1)
then CharsetDecoder::createDefaultDecoder() #errors out during
compilation, complaining that no charset decoder is available.
When apr-util is configured to use apr-iconv, APRCharsetDecoder
throws a log4cxx::helpers::IllegalArgumentException at runtime (from
charsetencoder.cpp:74). This happens because apr_xlate_open() calls
apr_iconv_open(), which returns an error value of 22. A comment on
APR_CharsetDecoder says it "requires real iconv implementation, apr-
iconv will crash in use." Maybe that's what's happening.
Any assistance would be greatly appreciated.
APR_LOCALE_CHARSET is not used in the current implementation of
charsetencoder. Also, the #error has been removed. Could you update
to the current log4cxx code and see if you still have the same issue?