You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by "Wilfong, Paul" <pa...@ngc.com> on 2008/01/10 23:13:48 UTC

Log4cxx - Illegal argument exception from charsetencoder.cpp:74

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.

RE: Proposed date for 0.10.0 release?

Posted by Stephen Bartnikowski <sb...@barkinglizards.com>.
Btw Curt,

I've got my server product on Mac OS X Server with a log4cxx snapshot
(thanks again for the XCode project generation guide). I'm at the point now
where I could use a number of automated clients to produce some profiling
data for log4cxx performance testing if you needed it.

Just give me a few days' notice since I've got a full plate right now.

Thanks,
Stephen

-----Original Message-----
From: Curt Arnold [mailto:carnold@apache.org] 
Sent: Monday, January 28, 2008 3:48 PM
To: Log4CXX User
Subject: Re: Proposed date for 0.10.0 release?


On Jan 28, 2008, at 1:31 PM, Vlietstra, Joe wrote:

> Hi all,
> We've been successfully building log4cxx from the SVN repository but a 
> FUD (fear, uncertainty, doubt) issue has cropped up during operations 
> -- our procedures require us to identify the exact version of any 
> software item running on any of our operational computers.
> I worked around this issue during an August 2007 audit by identifying 
> log4cxx version as 0.10.0 (beta).  Need a proposed release date for 
> 0.10.0 to survive the February 2008 audit.
> Joe Vlietstra

I'm working on breaking the dependency on LGPL'd CPPUNIT (bug
LOGCXX-225) at the moment.  That is the last significant blocker that  
I know of that would prevent preparing a release candidate.   The plan  
after that would be:

Remove @author tags (now considered bad form and many are carried over from
log4j and list authors that have never touched the C++ code) Remove @since
tags (a mismatch of log4j and log4cxx versions) Align Ant build options with
the ./configure options Improve generated MSVC and other IDE projects
Prepare release candidate for testing.

Once a release candidate is out, moving to a release would require having
enough list participants test and report on the build to motivate other
Logging Services PMC members to review and vote on the release.  At least 3
1+ votes from PMC members are required for a release.  Since I'm the only
currently active PMC member contributing to log4cxx, I'm going to have to
plead with PMC members from log4net and Chainsaw developers to vet the
release.

I've said it so many times that it is bound to eventually be right, but I
hope to have a release candidate out for review in the next two weeks.


Re: Proposed date for 0.10.0 release?

Posted by Curt Arnold <ca...@apache.org>.
On Jan 28, 2008, at 1:31 PM, Vlietstra, Joe wrote:

> Hi all,
> We've been successfully building log4cxx from the SVN repository
> but a FUD (fear, uncertainty, doubt) issue has cropped up during
> operations -- our procedures require us to identify the exact version
> of any software item running on any of our operational computers.
> I worked around this issue during an August 2007 audit by identifying
> log4cxx version as 0.10.0 (beta).  Need a proposed release date for
> 0.10.0 to survive the February 2008 audit.
> Joe Vlietstra

I'm working on breaking the dependency on LGPL'd CPPUNIT (bug  
LOGCXX-225) at the moment.  That is the last significant blocker that  
I know of that would prevent preparing a release candidate.   The plan  
after that would be:

Remove @author tags (now considered bad form and many are carried over  
from log4j and list authors that have never touched the C++ code)
Remove @since tags (a mismatch of log4j and log4cxx versions)
Align Ant build options with the ./configure options
Improve generated MSVC and other IDE projects
Prepare release candidate for testing.

Once a release candidate is out, moving to a release would require  
having enough list participants test and report on the build to  
motivate other Logging Services PMC members to review and vote on the  
release.  At least 3 1+ votes from PMC members are required for a  
release.  Since I'm the only currently active PMC member contributing  
to log4cxx, I'm going to have to plead with PMC members from log4net  
and Chainsaw developers to vet the release.

I've said it so many times that it is bound to eventually be right,  
but I hope to have a release candidate out for review in the next two  
weeks.

Proposed date for 0.10.0 release?

Posted by "Vlietstra, Joe" <Jo...@ngc.com>.
Hi all,
We've been successfully building log4cxx from the SVN repository
but a FUD (fear, uncertainty, doubt) issue has cropped up during
operations -- our procedures require us to identify the exact version
of any software item running on any of our operational computers.
I worked around this issue during an August 2007 audit by identifying
log4cxx version as 0.10.0 (beta).  Need a proposed release date for
0.10.0 to survive the February 2008 audit.
Joe Vlietstra

RE: Log4cxx - Illegal argument exception from charsetencoder.cpp:74

Posted by "Wilfong, Paul" <pa...@ngc.com>.
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
charsetencoder.cpp:74

Hi,

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
charsetencoder.cpp:74


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?


RE: Log4cxx - Illegal argument exception from charsetencoder.cpp:74

Posted by "Wilfong, Paul" <pa...@ngc.com>.
Hi,

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
charsetencoder.cpp:74


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?


Re: Log4cxx - Illegal argument exception from charsetencoder.cpp:74

Posted by Curt Arnold <ca...@apache.org>.
On Jan 15, 2008, at 2:41 AM, Andreas Grob wrote:

> Curt Arnold <carnold <at> apache.org> writes:
>
>>
>>
>> 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).
>>>

...
>
> Maybe my input may help. Since your last big commits I got following  
> errors
> under win2k/vc8:
>

I just want to be clear that you haven't attempted a Solaris build and  
don't know if the changes since since the time of the snapshot Paul  
Wilfong have fixed the build on Solaris, you just have a report of  
compilation failure on win2K/vc8 with the same classes.



>       [cc] charsetencoder.cpp
>       [cc] C:\work\log4cxx\log4cxx-trunk\src\main\cpp 
> \charsetencoder.cpp(198) :
> error C2665: 'log4cxx::helpers::Transcoder::decode' : none of the 4  
> overloads
> could convert all the argument types

...
>
> BUILD FAILED
> C:\work\log4cxx\log4cxx-trunk\build.xml:643: cl failed with return  
> code 2
>

I've been working for the last day or so with Visual Studio 2008 (aka  
VC9) on Vista and haven't encountered those issues.   Could you try  
running "ant clean" and rebuilding and if that fails rebuild from a  
fresh checkout.  The recent changes affected log4cxx.h and  
log4cxx_private.h which are "configured" from log4cxx*.h.in or  
log4cxx*.hw during the build process.  If you have updated a working  
copy from prior to those changes, you would likely have an older  
log4cxx.h file which Ant would not overwrite and could result in  
unexpected combinations.  If the problems still occur, please forward  
your log4cxx.h file.



Re: Log4cxx - Illegal argument exception from charsetencoder.cpp:74

Posted by Andreas Grob <an...@bergauer.ch>.
Curt Arnold <carnold <at> apache.org> writes:

> 
> 
> 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?
> 
> 


Maybe my input may help. Since your last big commits I got following errors
under win2k/vc8:

       [cc] charsetencoder.cpp
       [cc] C:\work\log4cxx\log4cxx-trunk\src\main\cpp\charsetencoder.cpp(198) :
error C2665: 'log4cxx::helpers::Transcoder::decode' : none of the 4 overloads
could convert all the argument types
       [cc]        
C:\work\log4cxx\log4cxx-trunk\src\main\include\log4cxx/helpers/transcoder.h(67):
could be 'unsigned int log4cxx::helpers::Transcoder::decode(const std::string
&,std::_String_const_iterator<_Elem,_Traits,_Alloc> &)'
       [cc]         with
       [cc]         [
       [cc]             _Elem=char,
       [cc]             _Traits=std::char_traits<char>,
       [cc]             _Alloc=std::allocator<char>
       [cc]         ]
       [cc]        
C:\work\log4cxx\log4cxx-trunk\src\main\include\log4cxx/helpers/transcoder.h(81):
or 'void log4cxx::helpers::Transcoder::decode(const std::string
&,log4cxx::LogString &)'
       [cc]         while trying to match the argument list '(const
log4cxx::LogString, std::_String_const_iterator<_Elem,_Traits,_Alloc>)'
       [cc]         with
       [cc]         [
       [cc]             _Elem=wchar_t,
       [cc]             _Traits=std::char_traits<wchar_t>,
       [cc]             _Alloc=std::allocator<wchar_t>
       [cc]         ]

       [cc] C:\work\log4cxx\log4cxx-trunk\src\main\cpp\charsetencoder.cpp(232) :
error C2665: 'log4cxx::helpers::Transcoder::decode' : none of the 4 overloads
could convert all the argument types
--- 8< ---
       [cc] C:\work\log4cxx\log4cxx-trunk\src\main\cpp\charsetencoder.cpp(232) :
error C2665: 'log4cxx::helpers::Transcoder::decode' : none of the 4 overloads
could convert all the argument types
--- 8< ---
       [cc] C:\work\log4cxx\log4cxx-trunk\src\main\cpp\charsetencoder.cpp(232) :
error C2665: 'log4cxx::helpers::Transcoder::decode' : none of the 4 overloads
could convert all the argument types
--- 8< ---
       [cc] C:\work\log4cxx\log4cxx-trunk\src\main\cpp\charsetencoder.cpp(351) :
error C2665: 'log4cxx::helpers::Transcoder::decode' : none of the 4 overloads
could convert all the argument types
--- 8< ---
       [cc] charsetdecoder.cpp
       [cc] C:\work\log4cxx\log4cxx-trunk\src\main\cpp\charsetdecoder.cpp(259) :
error C2665: 'log4cxx::helpers::Transcoder::encode' : none of the 2 overloads
could convert all the argument types
       [cc]        
C:\work\log4cxx\log4cxx-trunk\src\main\include\log4cxx/helpers/transcoder.h(75):
could be 'void log4cxx::helpers::Transcoder::encode(unsigned int,std::string &)'
       [cc]        
C:\work\log4cxx\log4cxx-trunk\src\main\include\log4cxx/helpers/transcoder.h(87):
or 'void log4cxx::helpers::Transcoder::encode(const log4cxx::LogString
&,std::string &)'
       [cc]         while trying to match the argument list '(unsigned int,
log4cxx::LogString)'
       [cc] C:\work\log4cxx\log4cxx-trunk\src\main\cpp\charsetdecoder.cpp(295) :
error C2665: 'log4cxx::helpers::Transcoder::encode' : none of the 2 overloads
could convert all the argument types
--- 8< ---
       [cc] C:\work\log4cxx\log4cxx-trunk\src\main\cpp\charsetdecoder.cpp(336) :
error C2665: 'log4cxx::helpers::Transcoder::encode' : none of the 2 overloads
could convert all the argument types
--- 8< ---
       [cc] transcoder.cpp
       [cc] C:\work\log4cxx\log4cxx-trunk\src\main\cpp\transcoder.cpp(47) :
error C2665: 'log4cxx::helpers::Transcoder::encode' : none of the 2 overloads
couldconvert all the argument types
       [cc]        
C:\work\log4cxx\log4cxx-trunk\src\main\include\log4cxx/helpers/transcoder.h(75):
could be 'void log4cxx::helpers::Transcoder::encode(unsigned int,std::string &)'
       [cc]        
C:\work\log4cxx\log4cxx-trunk\src\main\include\log4cxx/helpers/transcoder.h(87):
or 'void log4cxx::helpers::Transcoder::encode(const log4cxx::LogString
&,std::string &)'
       [cc]         while trying to match the argument list '(unsigned int,
log4cxx::LogString)'
       [cc] C:\work\log4cxx\log4cxx-trunk\src\main\cpp\transcoder.cpp(62) :
error C2665: 'log4cxx::helpers::Transcoder::decode' : none of the 4 overloads
couldconvert all the argument types
       [cc]        
C:\work\log4cxx\log4cxx-trunk\src\main\include\log4cxx/helpers/transcoder.h(67):
could be 'unsigned int log4cxx::helpers::Transcoder::decode(const std::string
&,std::_String_const_iterator<_Elem,_Traits,_Alloc> &)'
       [cc]         with
       [cc]         [
       [cc]             _Elem=char,
       [cc]             _Traits=std::char_traits<char>,
       [cc]             _Alloc=std::allocator<char>
       [cc]         ]
       [cc]        
C:\work\log4cxx\log4cxx-trunk\src\main\include\log4cxx/helpers/transcoder.h(81):
or 'void log4cxx::helpers::Transcoder::decode(const std::string
&,log4cxx::LogString &)'
       [cc]         while trying to match the argument list '(const
log4cxx::LogString, std::_String_const_iterator<_Elem,_Traits,_Alloc>)'
       [cc]         with
       [cc]         [
       [cc]             _Elem=wchar_t,
       [cc]             _Traits=std::char_traits<wchar_t>,
       [cc]             _Alloc=std::allocator<wchar_t>
       [cc]         ]
       [cc] Generating Code...

BUILD FAILED
C:\work\log4cxx\log4cxx-trunk\build.xml:643: cl failed with return code 2


Cheers
~ Andreas



Re: Log4cxx - Illegal argument exception from charsetencoder.cpp:74

Posted by Curt Arnold <ca...@apache.org>.
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?