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 Barak Simon <ba...@db.com> on 2004/08/17 11:19:30 UTC

Re: Trying to Install/Build log4cxx on Solaris


Hi David,

Concerning your Solaris problem with the shared libraries and statics init, we found that this happened to us
due to incomplete statics init (because libraries were not completely loaded into memories). This was caused by the fact that a library using the logging library
had a static logger which init itself in the cpp file using something like LogManager::instance()->getLogger();

That caused a problem between the statics of the two libraries, the calling and the called.

As a result we enforce our users to do lazy init, by first initing the static logger member pointer to 0, and only
when actually logging creating it for the first time (or you can also do it in the ctor, but we wanted to hide all that implementation
details within our own thin layer macros we provide, one for creating a static member and a getLogger() method, one for initing it in the cpp file to zero
, and several logging macros which call getLogger() underneath - the user never uses this logger member directly)
Anyway, see if that approach solves your problem or whether the problem is actually internal order of static init inside log4cxx.

Concerning the asm code, we discovered that the safest way for us on all shared libraries is building them without the -xarch flag at all.
But this meant we had to remove the asm code completely - We now have a working stable (so far) version using DOMConfigurator, though
the PropertyConfigurator crashed on Solaris' AtomicAdd (the one used by "stdmutex.h" file) - that happens when stl string deletes itself by decrementing
its reference count. We are still searching for the reasons for this behaviour.

Lastly, concerning the putenv, I did not know it behaves differently on Solaris and other systems (or does it always expect a dynamically allocated memory?)
Thanks for telling me - I'll probably need to change my testing code.

Cheers,
Barak
________________________
Barak Simon
GED IT Core Platform
190 George St. Sydney, 2000
Phone +61 2 925 85070
Fax      +61 2 925 95050


                                                                                                                                                     
                      dvasco-log4cxx@em                                                                                                              
                      ailias.com               To:       log4cxx-user@logging.apache.org                                                             
                                               cc:                                                                                                   
                      31/07/2004 00:31         Subject:  Re: Trying to Install/Build log4cxx on Solaris                                              
                      Please respond to                                                                                                              
                      log4cxx-user                                                                                                                   
                                                                                                                                                     
                                                                                                                                                     




hi Barak,

I'm using the Sun Workshop compiler and have successfully built log4cxx.

I used the following configure options to build a debug version (You can
just replace "-g" to get optimized build.)

    configure CC=CC CXX=CC CXXFLAGS="-g -mt -KPIC -xarch=v8plusa"


Here is my CC version string:

    CC: Sun C++ 5.5 Patch 113817-07 2004/03/23


To make it link properly, I had to make a small source file change to
thread.cpp:
I made the function asm_code() NOT static. I could not link when this
function was declared static.


I noticed a few problems on Solaris with the CC compiler.

1. Lots of compile warnings. I looked at a few and they seem harmless
and easy to clean up.

2. I think there is a bug in timezone.cpp. The code calls putenv() to
set the TZ environment variable. The code passes an automatic variable
to putenv which gets destroyed. On Sun (and other UNIXes) this is a bad
thing to do. You're not supposed to free the memory you pass to putenv.
The result is a corrupted environment.

3. I have not been able to use shared libraries successfully. I crash,
and I suspect it's due to static initialization problems.

I hope this is helpful,

David Vasconcelos


Barak Simon (barak.simon@db.com)  wrote:

>Thank you for the help Jwahar!
>I did succeed building it using your entire tree.
>
>Alas, I am enforced to link the resulting libraries into CC generated libraries, and since gcc and CC name mangling are incommensurate with one another,
>I really must find a way to build using CC.
>
>I tried doing CXX=CC but got errors - has anyone on the list had success with building the logging
>library using CC (on Solaris)?
>If so, what version of CC and are any special preliminary steps required?
>
>Thanks,
>Barak
>
>________________________
>Barak Simon
>GED IT Core Platform
>190 George St. Sydney, 2000
>Phone +61 2 925 85070
>Fax      +61 2 925 95050
>
>
>
>                      bammi@memento-inc
>                      .com                     To:       log4cxx-user@logging.apache.org
>                                               cc:
>                      28/07/2004 01:01         Subject:  RE: Trying to Install/Build log4cxx on Solaris
>                      Please respond to
>                      log4cxx-user
>
>
>
>
>
>
>
>Barak,
>I put my entire tree, tar'ed and compressed on our ftp server
>Login as user 'anonymous' with any string as passwd
>Set BINARY mode (bin command)
>And download logSolaris.tar.gz
>
>ftp memento-inc.com
>Connected to memento-inc.com.
>220 Microsoft FTP Service
>User (memento-inc.com:(none)): anonymous
>331 Anonymous access allowed, send identity (e-mail name) as password.
>Password:
>230 Anonymous user logged in.
>ftp> dir
>200 PORT command successful.
>150 Opening ASCII mode data connection for /bin/ls.
>-r-xr-xr-x   1 owner    group        13632193 Jul 27 10:52 logSolaris.tar.gz
>226 Transfer complete.
>ftp: 78 bytes received in 0.02Seconds 3.90Kbytes/sec.
>
>Jwahar Bammi
>Memento, Inc.
>bammi@memento-inc.com
>
>-----Original Message-----
>From: Barak Simon [mailto:barak.simon@db.com]
>Sent: Tuesday, July 27, 2004 5:23 AM
>To: log4cxx-user@logging.apache.org
>Cc: Shao Zhang
>Subject: RE: Trying to Install/Build log4cxx on Solaris
>
>
>Hi,
>Tnx for the answer and sorry for not replying sooner, but I only now had
>time to check it.
>
>I tried running the configure file you sent me and I get:
>"config.status: error: cannot find input file:
>include/log4cxx/config_msvc.h.in"
>
>After running make (since makefile was already created at that stage) I get:
>Makefile:429: appenderattachableimpl.Plo: No such file or directory
>Makefile:430: appenderskeleton.Plo: No such file or directory
>Makefile:431: asyncappender.Plo: No such file or directory
>Makefile:432: basicconfigurator.Plo: No such file or directory
>...
>
>and so on for each of the sources.
>
>All this may be related to the fact that the autogen.sh (which also run the
>autoconf)
>only did part of the work required, so some of the files I need (apart from
>configure itself) which it normally generates (e.g. install-sh)
>are corrupted or do not exist...
>
>Do you know by any chance what are the files generated by autogen and can
>maybe send them to me
>(in a structure-preserving tar)?
>
>If not, I do not mind trying an actual generated Makefile (if need be, I can
>try to adapt the flags to my environment).
>Needless to say it is far from ideal, but I have users waiting for it, so
>anything that works will be welcome
>( Even binaries if nothing else succeeds :( )
>
>Thanks again,
>Barak
>
>
>
>
>
>                      bammi@memento-inc
>
>                      .com                     To:
>log4cxx-user@logging.apache.org
>
>                                               cc:       Barak
>Simon/Sydney/DBAustralia/DeuBa@DBAustralia
>
>                      26/07/2004 11:50         Subject:  RE: Trying to
>Install/Build log4cxx on Solaris
>
>                      Please respond to
>
>                      log4cxx-user
>
>
>
>
>
>
>
>
>
>I have been compiling log4cxx for the past few versions on solaris with
>gcc/g++ (don't have sun cc). Attach to this message are my configure,
>config.status and config.log files. If I can help is some other way let me
>know
>
>Jwahar Bammi
>Memento, Inc.
>bammi@memento-inc.com
>
>-----Original Message-----
>From: Barak Simon [mailto:barak.simon@db.com]
>Sent: Sunday, July 25, 2004 7:30 PM
>To: log4cxx-user@logging.apache.org
>Subject: Trying to Install/Build log4cxx on Solaris
>
>Hi,
>I am trying to install log4cxx on Solaris, but get a great number of errors
>while running autogen.sh
>
>The first error I get is:
>ERROR: Reading inserted file: No such file or directory
>autom4te: /usr/local/bin/m4 failed with exit status: 1
>
>and it is being generated while "aclocal" is being invoked.
>
>I have re-installed all the latest versions of autoconf (2.59), automake
>(1.8.5), libtool (1.5.6) & m4 (1.4.1)
>into a local directory and use them (BTW - it seems from the error message
>that m4 is searched in /usr/local/bin, despite the fact that my path is
>explicitly pointed to my local m4 version).
>
>I gather from the release notes that version 0.9.7, though not tested on
>Solaris, can be compiled on it - is this correct?
>If so, what could I be doing wrong?
>PS - I would be happy to use a pre-prepared configure file for Solaris if
>someone has one :)
>
>Many thanks,
>Barak
>
>
>--
>
>This e-mail may contain confidential and/or privileged information. If you
>are not the intended recipient (or have received this e-mail in error)
>please notify the sender immediately and destroy this e-mail. Any
>unauthorized copying, disclosure or distribution of the material in this
>e-mail is strictly forbidden.
>
>
>
>
>
>
>
>The following file(s) have been deleted by: Barak Simon on 27/07/2004
>17:54:21
>
>configure
>config.status
>config.log
>
>
>
>
>
>--
>
>This e-mail may contain confidential and/or privileged information. If you
>are not the intended recipient (or have received this e-mail in error)
>please notify the sender immediately and destroy this e-mail. Any
>unauthorized copying, disclosure or distribution of the material in this
>e-mail is strictly forbidden.
>
>
>
>
>
>
>
>
>
>--
>
>This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
>
>
>






--

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.