usr local | 1 Sep 2004 08:26
Picon
Favicon

BUG: log4cxx-0.9.7 static lib compile error on MSVC 6

I'm getting the following compile error with version
log4cxx-0.9.7 when attempting to build static lib
using MSVC 6.0:

c:\log4cxx-0.9.7\src\condition.cpp(73) : error C2664:
'InterlockedCompareExchange' : cannot convert
parameter 1 from 'void ** ' to 'volatile long *'
        Types pointed to are unrelated; conversion
requires reinterpret_cast, C-style cast or
function-style cast

Any ideas?

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Anatoly Kournik | 1 Sep 2004 15:46
Favicon

RE: Solaris compilation problem...

library must be compiled with -D__PRAGMA_REDEFINE_EXTNAME to override
 
#define bind    __xnet_bind
 
definition in sys/socket.h
 
--
Toly Kournik

-----Original Message-----
From: Surekha Guntur [mailto:guntur_surekha <at> yahoo.com]
Sent: Tuesday, August 31, 2004 8:43 PM
To: log4cxx-user <at> logging.apache.org
Subject: Solaris compilation problem...

Hi,
 
I am trying to build log4cxx on Sun solaris and I am getting following problems. I have used following following flags for configure script.
 
./configure CC=CC CXX=CC CXXFLAGS="-g -mt -KPIC -xarch=v8plus"
 
Following are the errors I get while doing 'make'. There are many undefined symbols similar to these. Can somebody please help me on this.
 
ild: (undefined symbol) log4cxx::helpers::ObjectPtrT<log4cxx::spi::RepositorySel
ector>&log4cxx::helpers::ObjectPtrT<log4cxx::spi::RepositorySelector>::operator=
<log4cxx::spi::DefaultRepositorySelector*>(const __type_1&) -- referenced in ../
src/.libs/liblog4cxx.so
ild: (undefined symbol) void log4cxx::helpers::ObjectPtrT<log4cxx::helpers::Obje
ct>::cast<log4cxx::net::SocketAppender*>(const __type_1&) -- referenced in ../sr
c/.libs/liblog4cxx.so
ild: (undefined symbol) log4cxx::helpers::ObjectPtrT<log4cxx::helpers::PatternCo
nverter>&log4cxx::helpers::ObjectPtrT<log4cxx::helpers::PatternConverter>::opera
tor=<log4cxx::helpers::PatternParser::LiteralPatternConverter*>(const __type_1&)
 -- referenced in ../src/.libs/liblog4cxx.so
*** Error code 5
make: Fatal error: Command failed for target `simplesocketserver'
Current working directory /csf/csf/w951bdz/log4cxx/log4cxx-0.9.7/src
*** Error code 1
make: Fatal error: Command failed for target `all-recursive'
 
Thanks a lot,
 
Surekha.

Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!

--------------------------------------------------------------------------------------------------------------------------------------------------------------
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom
they are addressed. If you have received this email in error please notify the originator of the message.
Scanning of this message is performed by SurfControl E-mail Filter software in conjunction with virus detection software.
Surekha Guntur | 1 Sep 2004 18:10
Picon
Favicon

Re: Solaris compilation problem...

Thank you very much for your suggestions. Now I could build log4cxx on solaris successfully. But when I try to run a sample example 'trivial' (in src/exapmles) I get the following error. It just has BasicConfigurator.
--------
You have tried to set a null level to root.
Segmentation Fault (core dumped)
--------
 
Any ideas please... I am using log4cxx-0.9.7 version. Do I need to supply any configuration file or set any environment variables. I tried to set log4j.configuration environment variable. But it does not take this as it has '.' (dot) in it. Has anyone come across this problem?
 
Thanks,
Surekha.

"Sven A.Schmidt" <sas <at> abstracture.de> wrote:
This might be unrelated, but I've had loads of trouble with linking
STL/template code on Solaris. Using the compiler switch
"-instances=static" fixed all my problems. Found here:



HTH,
Sven


On 31.08.2004, at 19:42, Surekha Guntur wrote:

> Hi,
>  
> I am trying to build log4cxx on Sun solaris and I am getting following
> problems. I have used following following flags for configure script.
>  
> ./configure CC=CC CXX=CC CXXFLAGS="-g -mt -KPIC -xarch=v8plus"
>  
> Following are the errors I get while doing 'make'. There are many
> undefined symbols similar to these. Can somebody please help me on
> this.
>  
> ild: (undefined symbol)
> log4cxx::helpers::ObjectPtrT> ector>&log4cxx::helpers::ObjectPtrT> RepositorySelector>::operator=
> (const __type_1&) --
> referenced in ../
> src/.libs/liblog4cxx.so
> ild: (undefined symbol) void
> log4cxx::helpers::ObjectPtrT> ct>::cast(const __type_1&) --
> referenced in ../sr
> c/.libs/liblog4cxx.so
> ild: (undefined symbol)
> log4cxx::helpers::ObjectPtrT> nverter>&log4cxx::helpers::ObjectPtrT> PatternConverter>::opera
> tor=(const
> __type_1&)
>  -- referenced in ../src/.libs/liblog4cxx.so
> *** Error code 5
> make: Fatal error: Command failed for target `simplesocketserver'
> Current working directory /csf/csf/w951bdz/log4cxx/log4cxx-0.9.7/src
> *** Error code 1
> make: Fatal error: Command failed for target `all-recursive'
>  
> Thanks a lot,
>  
> Surekha.
>
> Do you Yahoo!?
> New and Improved Yahoo! Mail - Send 10MB messages!

*>
*>
*>

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

renny.koshy | 1 Sep 2004 18:40

Log4cxx obliterates the TZ setting...


We have some code which started behaving strange after going to log4cxx for logging... I've isolated it down to the fact that log4cxx obliterates the TZ settings in timezone.cpp and dailyrollingfileappender.cpp

Questions:
        Instead of changing to GMT to calculate the diff, why not use gmtime() or gmtime_r()?
                - I've done this in our code that had to calculate this difference for a LogFile class that dates back almost 8 years...
                - This way there is not "side-effect"...
        *IF* I change the code to work that way, any chance of having it included in the 'official' package?

I also noticed that on Solaris using CC, if I compile the whole thing after a "make clean", it works.  But then if I go change a file & recompile... it doesn't work.  Looks like the problem is in the 'cache' files that Sun's CC uses for templates.... somehow during the build process, those files are either deleted or overwritten... and the next time, when you change a single file & compile... the linker cannot file a bunch of templates...

Regards

Renny Koshy
President & CEO

--------------------------------------------
RUBIX Information Technologies, Inc.
www.rubixinfotech.com
Curt Arnold | 1 Sep 2004 19:39
Picon
Favicon

Re: BUG: log4cxx-0.9.7 static lib compile error on MSVC 6

It is a known issue which has been resolved in the CVS version, see 
http://nagoya.apache.org/jira/browse/LOGCXX-8.

Basically the signatures for the InterlockedMethods changed in the 
Platform SDK sometime between VC6 and VC7.  If you are getting this 
error, you are most likely using VC6 with a later Platform SDK.  In 
0.9.7, the value of _MSC_VER was used to determine whether the old 
style or new style signatures were used.  However, this assumes that if 
you are using VC6, you are also using the header files included with 
VC6.  In the current CVS, there is a preprocessor macro which allows 
you to explicitly specify whether the old style interlocks are used.

The simplest way to get 0.9.7 to compile is to remove the later 
Platform SDK from your include path.

On Sep 1, 2004, at 1:26 AM, usr local wrote:

> I'm getting the following compile error with version
> log4cxx-0.9.7 when attempting to build static lib
> using MSVC 6.0:
>
> c:\log4cxx-0.9.7\src\condition.cpp(73) : error C2664:
> 'InterlockedCompareExchange' : cannot convert
> parameter 1 from 'void ** ' to 'volatile long *'
>         Types pointed to are unrelated; conversion
> requires reinterpret_cast, C-style cast or
> function-style cast
>
> Any ideas?
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>

Curt Arnold | 1 Sep 2004 19:56
Picon
Favicon

Re: Log4cxx obliterates the TZ setting...

I had noticed the potential for the problem and logged it as 
http://nagoya.apache.org/jira/browse/LOGCXX-11.  Thanks for confirming 
that is actually a problem.  My suspicion is that gmtime or gmtime_r is 
not adequate since log4cxx may need to format times to a time-zone 
other than the current time zone.  However, it might be an optimization 
if the timezone for the layout and the current timezone are the same.  
I guess the first thing is to at least reset the value of TZ to the 
initial value after collecting time zone offsets.

On Sep 1, 2004, at 11:40 AM, renny.koshy <at> rubixinfotech.com wrote:

>
> We have some code which started behaving strange after going to 
> log4cxx for logging... I've isolated it down to the fact that log4cxx 
> obliterates the TZ settings in timezone.cpp and 
> dailyrollingfileappender.cpp
>
> Questions:
>         Instead of changing to GMT to calculate the diff, why not use 
> gmtime() or gmtime_r()?
>                 - I've done this in our code that had to calculate 
> this difference for a LogFile class that dates back almost 8 years...
>                 - This way there is not "side-effect"...
>         *IF* I change the code to work that way, any chance of having 
> it included in the 'official' package?

Surekha Guntur | 1 Sep 2004 22:34
Picon
Favicon

Error: You have tried to set a null level to root

Hi,
 
I am trying to run a sample example 'trivial' (in src/exapmles) I get the following error on Solaris. It just has BasicConfigurator.
--------
You have tried to set a null level to root.
Segmentation Fault (core dumped)
--------
 
Any ideas please... I am using log4cxx-0.9.7 version. Do I need to supply any configuration file or set any environment variables. I tried to set log4j.configuration environment variable. But it does not take it as it has '.' (dot) in it. Has anyone come across this problem?
 
Thanks,
Surekha.

Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
renny.koshy | 1 Sep 2004 22:56

Re: Log4cxx obliterates the TZ setting...


Curt:

Added the changes to do this... (save/restore the TZ back)... HOWEVER... I'm seeing that there is some sort of static initialization that's resetting the TZ?

The following two files have my save & restore code added around the tzset().... these files have the tcout being used to display when I save / restore them... they should be commented out I guess...



However, I still see the following when executing my code.  Notice how it goes from US/Eastern to '' ... and then to US/Eastern... and then to GMT... and the "SmartACD.cpp:174" is the first print statement from MY code.. so I assume a static initializer or two is being kicked in... but where?? I don't use any static log4cxx stuff...

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TimeZone::TimeZone() - Old timezone being saved as 'US/Eastern' and setting to 'TZ=GMT'
TimeZone::TimeZone() - Restored timezone to TZ=US/Eastern
TimeZone::TimeZone() - Old timezone being saved as '' and setting to 'TZ='
TimeZone::TimeZone() - Restored timezone to TZ=
SmartACD.cpp:174 -> TZ = 'US/Eastern' -> TZName[0] = 'EST', TZName[1] = 'EDT'
SmartACD.cpp:181 -> TZ = 'US/Eastern' -> TZName[0] = 'EST', TZName[1] = 'EDT'
TimeZone::TimeZone() - Old timezone being saved as 'US/Eastern' and setting to 'TZ='
TimeZone::TimeZone() - Restored timezone to TZ=US/Eastern
TimeZone::TimeZone() - Old timezone being saved as 'GMT' and setting to 'TZ='
TimeZone::TimeZone() - Restored timezone to TZ=GMT
Could not connect to remote log4cxx server at [ultra60]. We will try again later.
Connection refused
TimeZone::TimeZone() - Old timezone being saved as '' and setting to 'TZ='
TimeZone::TimeZone() - Restored timezone to TZ=
Could not find value for key log4j.appender.sapp2
Could not instantiate appender named "sapp2".
SmartACD.cpp:191 -> TZ = 'GMT' -> TZName[0] = 'GMT', TZName[1] = '   '
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

My source code that created the above log entries...

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int main(int argc, char *argv[])
{
  putenv("TZ=US/Eastern");

  printf("%s:%d -> TZ = '%s' -> TZName[0] = '%s', TZName[1] = '%s'\n",
                        __FILE__, __LINE__,
                        getenv("TZ") ? getenv("TZ") : "<>",
                        tzname[0], tzname[1]);

  openlog("SmartACD", LOG_PID, LOG_USER);

  printf("%s:%d -> TZ = '%s' -> TZName[0] = '%s', TZName[1] = '%s'\n",
                        __FILE__, __LINE__,
                        getenv("TZ") ? getenv("TZ") : "<>",
                        tzname[0], tzname[1]);

  sigset(SIGHUP,sig_hdlr);
  sigset(SIGUSR2,sig_hdlr);

  log4cxx::PropertyConfigurator::configureAndWatch("SmartACD.ini");

  printf("%s:%d -> TZ = '%s' -> TZName[0] = '%s', TZName[1] = '%s'\n",
                        __FILE__, __LINE__,
                        getenv("TZ") ? getenv("TZ") : "<>",
                        tzname[0], tzname[1]);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Renny Koshy
President & CEO

--------------------------------------------
RUBIX Information Technologies, Inc.
www.rubixinfotech.com


Curt Arnold <carnold <at> apache.org>

09/01/2004 01:56 PM
Please respond to "Log4CXX User"

       
        To:        Log4CXX User <log4cxx-user <at> logging.apache.org>
        cc:        
        Subject:        Re: Log4cxx obliterates the TZ setting...



I had noticed the potential for the problem and logged it as
http://nagoya.apache.org/jira/browse/LOGCXX-11.  Thanks for confirming
that is actually a problem.  My suspicion is that gmtime or gmtime_r is
not adequate since log4cxx may need to format times to a time-zone
other than the current time zone.  However, it might be an optimization
if the timezone for the layout and the current timezone are the same.  
I guess the first thing is to at least reset the value of TZ to the
initial value after collecting time zone offsets.


On Sep 1, 2004, at 11:40 AM, renny.koshy <at> rubixinfotech.com wrote:

>
> We have some code which started behaving strange after going to
> log4cxx for logging... I've isolated it down to the fact that log4cxx
> obliterates the TZ settings in timezone.cpp and
> dailyrollingfileappender.cpp
>
> Questions:
>         Instead of changing to GMT to calculate the diff, why not use
> gmtime() or gmtime_r()?
>                 - I've done this in our code that had to calculate
> this difference for a LogFile class that dates back almost 8 years...
>                 - This way there is not "side-effect"...
>         *IF* I change the code to work that way, any chance of having
> it included in the 'official' package?



Attachment (timezone.cpp): application/octet-stream, 4189 bytes
Attachment (dailyrollingfileappender.cpp): application/octet-stream, 7253 bytes
Bristol, Michael | 1 Sep 2004 22:57

RE: Error: You have tried to set a null level to root

Regarding the "null level to root" issue - I found it to be a symptom of the
order of initialization of objects in the library.  I believe it has been
discussed before - the log4cxx-user mailing list archives have some mention
of it under the context of static library problems.

I poked around in a debugger when I was getting it and found that sometimes
the static members on the Level class that define the logging levels (i.e.
Level::OFF, Level::DEBUG, etc) can be requested by the application before
the module that they reside in has been initialized.  So instead of a
pointer to a new Level Object, asking for Level:OFF just gives you null and
that causes the error.

If I re-ordered the link line so that level.o and logmamager.o came first
and it went away.  Additionally if you've got something calling log4cxx
during pre-main initialization in a shared library environment, make sure
the log4cxx library comes first in the link line.

I have not found a good answer to the "single configuration file" question
yet myself.  Maybe it's intended to be left up to the user of log4cxx to
configure.

Later,
   Mike

-----Original Message-----
From: Surekha Guntur [mailto:guntur_surekha <at> yahoo.com]
Sent: Wednesday, September 01, 2004 4:35 PM
To: log4cxx-user <at> logging.apache.org
Subject: Error: You have tried to set a null level to root

Hi,

I am trying to run a sample example 'trivial' (in src/exapmles) I get the
following error on Solaris. It just has BasicConfigurator.
--------
You have tried to set a null level to root.
Segmentation Fault (core dumped)
--------

Any ideas please... I am using log4cxx-0.9.7 version. Do I need to supply
any configuration file or set any environment variables. I tried to set
log4j.configuration environment variable. But it does not take it as it has
'.' (dot) in it. Has anyone come across this problem?

Thanks,
Surekha.

Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!

renny.koshy | 2 Sep 2004 01:57

Log4cxx obliterates the TZ setting...


Ok... I think I found a work-around for my app anyway:

I noticed that this whole thing happens when the property configurator is reading the file & configuring things... so I now set my timezone (which I never had to do before), from an appliction .ini file setting AFTER the propertyconfigurator is initialized.

There has got to be a better way to do this... will let you guys know if we find something.

Renny Koshy
President & CEO

--------------------------------------------
RUBIX Information Technologies, Inc.
www.rubixinfotech.com

__________________

We have some code which started behaving strange after going to log4cxx for logging... I've isolated it down to the fact that log4cxx obliterates the TZ settings in timezone.cpp and dailyrollingfileappender.cpp

Questions:
        Instead of changing to GMT to calculate the diff, why not use gmtime() or gmtime_r()?
                - I've done this in our code that had to calculate this difference for a LogFile class that dates back almost 8 years...
                - This way there is not "side-effect"...
        *IF* I change the code to work that way, any chance of having it included in the 'official' package?

I also noticed that on Solaris using CC, if I compile the whole thing after a "make clean", it works.  But then if I go change a file & recompile... it doesn't work.  Looks like the problem is in the 'cache' files that Sun's CC uses for templates.... somehow during the build process, those files are either deleted or overwritten... and the next time, when you change a single file & compile... the linker cannot file a bunch of templates...

Regards

Renny Koshy
President & CEO

--------------------------------------------
RUBIX Information Technologies, Inc.
www.rubixinfotech.com

Gmane