You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-dev@logging.apache.org by Bob Rossi <bo...@cox.net> on 2006/12/15 15:33:12 UTC

syslogappender patch for mingw

Hi,

Here is a patch to get log4cxx to compile with mingw, using g++-4.1. Can
someone please apply this for me?

Thanks,
Bob Rossi

Re: syslogappender patch for mingw

Posted by Bob Rossi <bo...@cox.net>.
On Sat, Dec 30, 2006 at 07:34:03AM -0500, Bob Rossi wrote:
> On Fri, Dec 29, 2006 at 11:18:28PM -0600, Curt Arnold wrote:
> > 
> > On Dec 29, 2006, at 6:10 PM, Bob Rossi wrote:
> > 
> > >On Mon, Dec 25, 2006 at 11:08:09PM -0500, Bob Rossi wrote:
> > >>On Fri, Dec 15, 2006 at 09:33:12AM -0500, Bob Rossi wrote:
> > >>>Hi,
> > >>>
> > >>>Here is a patch to get log4cxx to compile with mingw, using g+ 
> > >>>+-4.1. Can
> > >>>someone please apply this for me?
> > >
> > >This is a very simple patch. Can someone please review it?
> > >
> > >I recently switched from log4cpp to log4cxx because I thought log4cpp
> > >was sort of a dead project. Anyone activily working on this project?
> > >Anyone responsible for patch review?
> > >
> > >Thanks in advance!
> > >Bob Rossi
> > >
> > 
> > I committed a slightly different change in rev 491169.  I had spent  
> > several hours today trying to get a working MinGW build going and  
> > passing the unit tests so I wasn't applying a change in the dark.  I  
> > did find a solution for LOGCXX-166, but it seems that that problem  
> > must not occur with the 4.1 gcc you are using versus the 3.4.2 I'm  
> > using.
> 
> You should use gcc 4.1. Apr, apr-util and expat build out-of-the-box
> if you use svn trunk for apr and apr-util and expat official release
> 2.0.0. gcc 4.1 supports wchar_t and makes building log4cxx easy.

I just built log4cxx cleanly from trunk with,

$ ./configure CC=gcc-4.1 CXX=g++-4.1 \
LDFLAGS="-L/pathto/expat/expat-2.0.0/lib:$LDFLAGS" \
--prefix=$PWD/../prefix \
--with-apr=/pathto/apr/apr-1.3.0-cvs/bin/apr-1-config \
--with-apr-util=/pathto/apr-util/apr-util-2006-12-14-cvs/bin/apu-1-config \
--with-thread=Microsoft        
$ make

Thanks,
Bob Rossi

Re: syslogappender patch for mingw

Posted by Bob Rossi <bo...@cox.net>.
On Fri, Dec 29, 2006 at 11:18:28PM -0600, Curt Arnold wrote:
> 
> On Dec 29, 2006, at 6:10 PM, Bob Rossi wrote:
> 
> >On Mon, Dec 25, 2006 at 11:08:09PM -0500, Bob Rossi wrote:
> >>On Fri, Dec 15, 2006 at 09:33:12AM -0500, Bob Rossi wrote:
> >>>Hi,
> >>>
> >>>Here is a patch to get log4cxx to compile with mingw, using g+ 
> >>>+-4.1. Can
> >>>someone please apply this for me?
> >
> >This is a very simple patch. Can someone please review it?
> >
> >I recently switched from log4cpp to log4cxx because I thought log4cpp
> >was sort of a dead project. Anyone activily working on this project?
> >Anyone responsible for patch review?
> >
> >Thanks in advance!
> >Bob Rossi
> >
> 
> I committed a slightly different change in rev 491169.  I had spent  
> several hours today trying to get a working MinGW build going and  
> passing the unit tests so I wasn't applying a change in the dark.  I  
> did find a solution for LOGCXX-166, but it seems that that problem  
> must not occur with the 4.1 gcc you are using versus the 3.4.2 I'm  
> using.

You should use gcc 4.1. Apr, apr-util and expat build out-of-the-box
if you use svn trunk for apr and apr-util and expat official release
2.0.0. gcc 4.1 supports wchar_t and makes building log4cxx easy.

> I have run into several problems in APR on MinGW that I'm surprised  
> that you have not run into.  Again maybe it is due to the difference  
> in MinGW environments that we are using or changes between APR-1.2.7  
> and whatever source drop you are using.

Yes, it's not easy to build apr-1.2.7 with mingw 3.x series. Using svn
trunk and gcc 4.x is much easier.

> I had to remove a duplicate declaration of apr_wchar_t in include/ 
> arch/win32/apr_arch_file_io.h, add an include of "dce.h" to misc/ 
> win32/rand.c and tweak apr.hw.  I'll try to get those clean and  
> submit them as bug reports to APR.

Well, that's up to you, none of it is necessary if you use trunk and gcc
4.x.

> Even after that I'm still getting unresolved references when trying  
> to link either log4cxx.dll or the APR unit tests.  I can successfully  
> link tiny hello world programs that call the functions, so I know the  
> symbols are in the correct libraries, but I'm at a loss why they not  
> found when it counts.

I'm my own program just fine. However, what's the command to run the
unit tests for apr? I'll try that out.

> I tried reordering the -l options on the gcc command, but did not  
> seem to have any effect.
> 
> I guess I should see if the problem goes away with the version of  
> MinGW that you are using.

Yes, but it took hours for me to compile gcc 4.x. If you are going to
try it, let me know, I'll send you the configure && make options I used.
I can even upload the binary I have, it may work for you.

It would be possible for me to do builds of log4cxx with mingw every now
and then, especially before official releases. Is there a place where
beta's are announced, so that this can be done before official releases?

Bob Rossi

Re: syslogappender patch for mingw

Posted by Curt Arnold <ca...@apache.org>.
On Dec 29, 2006, at 6:10 PM, Bob Rossi wrote:

> On Mon, Dec 25, 2006 at 11:08:09PM -0500, Bob Rossi wrote:
>> On Fri, Dec 15, 2006 at 09:33:12AM -0500, Bob Rossi wrote:
>>> Hi,
>>>
>>> Here is a patch to get log4cxx to compile with mingw, using g+ 
>>> +-4.1. Can
>>> someone please apply this for me?
>
> This is a very simple patch. Can someone please review it?
>
> I recently switched from log4cpp to log4cxx because I thought log4cpp
> was sort of a dead project. Anyone activily working on this project?
> Anyone responsible for patch review?
>
> Thanks in advance!
> Bob Rossi
>

I committed a slightly different change in rev 491169.  I had spent  
several hours today trying to get a working MinGW build going and  
passing the unit tests so I wasn't applying a change in the dark.  I  
did find a solution for LOGCXX-166, but it seems that that problem  
must not occur with the 4.1 gcc you are using versus the 3.4.2 I'm  
using.

I have run into several problems in APR on MinGW that I'm surprised  
that you have not run into.  Again maybe it is due to the difference  
in MinGW environments that we are using or changes between APR-1.2.7  
and whatever source drop you are using.

I had to remove a duplicate declaration of apr_wchar_t in include/ 
arch/win32/apr_arch_file_io.h, add an include of "dce.h" to misc/ 
win32/rand.c and tweak apr.hw.  I'll try to get those clean and  
submit them as bug reports to APR.

Even after that I'm still getting unresolved references when trying  
to link either log4cxx.dll or the APR unit tests.  I can successfully  
link tiny hello world programs that call the functions, so I know the  
symbols are in the correct libraries, but I'm at a loss why they not  
found when it counts.


        [cc] C:\ls-svn\log4cxx\build\debug\static/libapr-1d.a 
(filestat.o)(.text+0x467): In function `resolve_prot':
        [cc] C:/ls-svn/log4cxx/lib/apr-1.2.7/file_io/win32/filestat.c: 
114: undefined reference to `GetEffectiveRightsFromAclW'
        [cc] C:\ls-svn\log4cxx\build\debug\static/libapr-1d.a 
(filestat.o)(.text+0x4e1):C:/ls-svn/log4cxx/lib/apr-1.2.7/file_io/ 
win32/filestat.c:127: undefined reference to  
`GetEffectiveRightsFromAclW'
        [cc] C:\ls-svn\log4cxx\build\debug\static/libapr-1d.a 
(filestat.o)(.text+0x553):C:/ls-svn/log4cxx/lib/apr-1.2.7/file_io/ 
win32/filestat.c:135: undefined reference to  
`GetEffectiveRightsFromAclW'
        [cc] C:\ls-svn\log4cxx\build\debug\static/libapr-1d.a 
(filestat.o)(.text+0x966): In function `more_finfo':
        [cc] C:/ls-svn/log4cxx/lib/apr-1.2.7/file_io/win32/filestat.c: 
243: undefined reference to `GetNamedSecurityInfoW'
        [cc] C:\ls-svn\log4cxx\build\debug\static/libapr-1d.a 
(filestat.o)(.text+0xa1e):C:/ls-svn/log4cxx/lib/apr-1.2.7/file_io/ 
win32/filestat.c:253: undefined reference to `GetNamedSecurityInfoA'
        [cc] C:\ls-svn\log4cxx\build\debug\static/libapr-1d.a 
(filestat.o)(.text+0xac1):C:/ls-svn/log4cxx/lib/apr-1.2.7/file_io/ 
win32/filestat.c:260: undefined reference to `GetSecurityInfo'
        [cc] C:\ls-svn\log4cxx\build\debug\static/libapr-1d.a(start.o) 
(.text+0x318): In function `apr_app_initialize':
        [cc] C:/ls-svn/log4cxx/lib/apr-1.2.7/misc/win32/start.c:126:  
undefined reference to `CommandLineToArgvW'
        [cc] collect2: ld returned 1 exit status


I tried reordering the -l options on the gcc command, but did not  
seem to have any effect.

I guess I should see if the problem goes away with the version of  
MinGW that you are using.


Re: syslogappender patch for mingw

Posted by Bob Rossi <bo...@cox.net>.
On Fri, Dec 29, 2006 at 10:35:51PM -0500, Ron Hashimshony wrote:
> Hi Bob,
> 
> It seems that this project is in its death bed...
> Did you find any other good logger before you went with log4cxx?

I'm sorry, is this a sarcastic joke? or serious comment?

Bob Rossi

Re: syslogappender patch for mingw

Posted by Ron Hashimshony <ro...@gmail.com>.
Hi Bob,

It seems that this project is in its death bed...
Did you find any other good logger before you went with log4cxx?

Best Regards,
Ron.

On 12/29/06, Bob Rossi <bo...@cox.net> wrote:
>
> On Mon, Dec 25, 2006 at 11:08:09PM -0500, Bob Rossi wrote:
> > On Fri, Dec 15, 2006 at 09:33:12AM -0500, Bob Rossi wrote:
> > > Hi,
> > >
> > > Here is a patch to get log4cxx to compile with mingw, using g++-4.1.
> Can
> > > someone please apply this for me?
>
> This is a very simple patch. Can someone please review it?
>
> I recently switched from log4cpp to log4cxx because I thought log4cpp
> was sort of a dead project. Anyone activily working on this project?
> Anyone responsible for patch review?
>
> Thanks in advance!
> Bob Rossi
>
> > > Index: src/syslogappender.cpp
> > > ===================================================================
> > > --- src/syslogappender.cpp  (revision 487559)
> > > +++ src/syslogappender.cpp  (working copy)
> > > @@ -23,7 +23,7 @@
> > >  #include <log4cxx/helpers/transcoder.h>
> > >  #include <log4cxx/private/log4cxx_private.h>
> > >
> > > -#ifdef LOG4CXX_HAVE_SYSLOG
> > > +#if LOG4CXX_HAVE_SYSLOG != 0
> > >  #include <syslog.h>
> > >  #else
> > >          /* facility codes */
> > > @@ -259,7 +259,7 @@
> > >
> > >  // On the local host, we can directly use the system function
> 'syslog'
> > >  // if it is available
> > > -#ifdef LOG4CXX_HAVE_SYSLOG
> > > +#if LOG4CXX_HAVE_SYSLOG != 0
> > >          if (sw == 0)
> > >          {
> > >                  std::string sbuf;
> > > @@ -323,7 +323,7 @@
> > >
> > >  // On the local host, we can directly use the system function
> 'syslog'
> > >  // if it is available (cf. append)
> > > -#ifdef LOG4CXX_HAVE_SYSLOG
> > > +#if LOG4CXX_HAVE_SYSLOG != 0
> > >          if (syslogHost1 != LOG4CXX_STR("localhost") && syslogHost1 !=
> LOG4CXX_STR("127.0.0.1")
> > >          && !syslogHost1.empty())
> > >  #endif
> >
>

Re: syslogappender patch for mingw

Posted by Bob Rossi <bo...@cox.net>.
On Mon, Dec 25, 2006 at 11:08:09PM -0500, Bob Rossi wrote:
> On Fri, Dec 15, 2006 at 09:33:12AM -0500, Bob Rossi wrote:
> > Hi,
> > 
> > Here is a patch to get log4cxx to compile with mingw, using g++-4.1. Can
> > someone please apply this for me?

This is a very simple patch. Can someone please review it?

I recently switched from log4cpp to log4cxx because I thought log4cpp
was sort of a dead project. Anyone activily working on this project?
Anyone responsible for patch review?

Thanks in advance!
Bob Rossi

> > Index: src/syslogappender.cpp
> > ===================================================================
> > --- src/syslogappender.cpp	(revision 487559)
> > +++ src/syslogappender.cpp	(working copy)
> > @@ -23,7 +23,7 @@
> >  #include <log4cxx/helpers/transcoder.h>
> >  #include <log4cxx/private/log4cxx_private.h>
> >  
> > -#ifdef LOG4CXX_HAVE_SYSLOG
> > +#if LOG4CXX_HAVE_SYSLOG != 0
> >  #include <syslog.h>
> >  #else
> >          /* facility codes */
> > @@ -259,7 +259,7 @@
> >  
> >  // On the local host, we can directly use the system function 'syslog'
> >  // if it is available
> > -#ifdef LOG4CXX_HAVE_SYSLOG
> > +#if LOG4CXX_HAVE_SYSLOG != 0
> >          if (sw == 0)
> >          {
> >                  std::string sbuf;
> > @@ -323,7 +323,7 @@
> >  
> >  // On the local host, we can directly use the system function 'syslog'
> >  // if it is available (cf. append)
> > -#ifdef LOG4CXX_HAVE_SYSLOG
> > +#if LOG4CXX_HAVE_SYSLOG != 0
> >          if (syslogHost1 != LOG4CXX_STR("localhost") && syslogHost1 != LOG4CXX_STR("127.0.0.1")
> >          && !syslogHost1.empty())
> >  #endif
> 

Re: syslogappender patch for mingw

Posted by Bob Rossi <bo...@cox.net>.
On Fri, Dec 15, 2006 at 09:33:12AM -0500, Bob Rossi wrote:
> Hi,
> 
> Here is a patch to get log4cxx to compile with mingw, using g++-4.1. Can
> someone please apply this for me?

Ping.
Bob Rossi

> Index: src/syslogappender.cpp
> ===================================================================
> --- src/syslogappender.cpp	(revision 487559)
> +++ src/syslogappender.cpp	(working copy)
> @@ -23,7 +23,7 @@
>  #include <log4cxx/helpers/transcoder.h>
>  #include <log4cxx/private/log4cxx_private.h>
>  
> -#ifdef LOG4CXX_HAVE_SYSLOG
> +#if LOG4CXX_HAVE_SYSLOG != 0
>  #include <syslog.h>
>  #else
>          /* facility codes */
> @@ -259,7 +259,7 @@
>  
>  // On the local host, we can directly use the system function 'syslog'
>  // if it is available
> -#ifdef LOG4CXX_HAVE_SYSLOG
> +#if LOG4CXX_HAVE_SYSLOG != 0
>          if (sw == 0)
>          {
>                  std::string sbuf;
> @@ -323,7 +323,7 @@
>  
>  // On the local host, we can directly use the system function 'syslog'
>  // if it is available (cf. append)
> -#ifdef LOG4CXX_HAVE_SYSLOG
> +#if LOG4CXX_HAVE_SYSLOG != 0
>          if (syslogHost1 != LOG4CXX_STR("localhost") && syslogHost1 != LOG4CXX_STR("127.0.0.1")
>          && !syslogHost1.empty())
>  #endif