logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wilfong, Paul" <paul.wilf...@ngc.com>
Subject RE: Log4cxx - Illegal argument exception from charsetencoder.cpp:74
Date Tue, 19 Feb 2008 19:53:40 GMT
Ok - We finally found out that the problem with this was our Sun setup.

At some point in the distant past, someone installed Subversion on this
Sun, either as part of the Eclipse/Subclipse installation, or an aborted
attempt to do a direct Subversion install.

Part of this resulted in the population of "usr/local/*" folders with a
bunch of GNU stuff.

For instance, an "iconv.h" file is in our "/usr/local/include" folder,
and there is another one in our "/usr/include" folder, and they are not
the same.  The former has "lib" in front of a lot of things that the
latter does not, for example.

When a program is built it seems to look at "/usr/local/*" first, so
that the iconv.h from "/usr/local/include" was being used for our
builds.  In particular, the ./configure for APR-UTIL was using this
iconv.h file, then failing on an iconv test, leading to "apu.h" setting
APR_HAS_XLATE to 0, with the final result of our log4cxx build getting
the "APRCharsetDecoder has not been declared" message.

Our solution is to do "export CFLAGS=-isystem/usr/include" and "export
CPPFLAGS=-isystem/usr/include" which forces the builds to ignore the
"/usr/local" path.  Then we do ./configure and make for APR-UTIL, and
the subsequent log4cxx build, and the problem goes away.

- Paul W

-----Original Message-----
From: Wilfong, Paul [mailto:paul.wilfong@ngc.com] 
Sent: Monday, January 28, 2008 10:16 AM
To: Log4CXX User
Subject: RE: Log4cxx - Illegal argument exception from


I obtained the latest log4cxx.tar.gz from
http://littletux.homelinux.org/log4cxx/ and also the latest versions of
apr and apr-util (1.2.12).  I rebuilt apr and apr-util using the normal
"configure-make-make install" cycle.

Now when I do ./configure and make for log4cxx I see the following
output at the point where charsetdecoder.cpp is being compiled:  "error:
"APRCharsetDecoder" has not been declared".

I plan to next try the "configure-make-make install" cycle for apr-util,
this time defining --with-iconv, where I hope to find an iconv library
for the "xxx" on the Sun I am using for this work.

Any ideas would be greatly appreciated.

- Paul W

-----Original Message-----
From: Curt Arnold [mailto:carnold@apache.org]
Sent: Thursday, January 10, 2008 2:52 PM
To: Log4CXX User
Subject: Re: Log4cxx - Illegal argument exception from

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?

View raw message