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 sh...@rexee.com on 2006/10/11 19:08:04 UTC

Problem with a test program

Hi,
I'm new to log4cxx and very rusty on my c/c++ skills.
I installed log4cxx on my Mac (version 10.4.7, Intel based) and tried to
run a small test program:

#include <log4cxx/logger.h>
#include <log4cxx/xml/domconfigurator.h>

using namespace log4cxx;

int main()
{
        log4cxx::xml::DOMConfigurator::configure("test.xml");
        return 0;
}

Compilation went ok:
g++ -I /usr/local/include/log4cxx/ test.cpp -o test -llog4cxx

but when i tried running it i got this error:

dyld: lazy symbol binding failed: Symbol not found:
__ZN7log4cxx7helpers13UnicodeHelper10decodeWideERPKwS3_
  Referenced from: /usr/local/lib/liblog4cxx.10.dylib
  Expected in: flat namespace

dyld: Symbol not found:
__ZN7log4cxx7helpers13UnicodeHelper10decodeWideERPKwS3_
  Referenced from: /usr/local/lib/liblog4cxx.10.dylib
  Expected in: flat namespace

Trace/BPT trap


>From this i guess i am missing an object that i need to link
(unicodehelper?) so i tried to compile again but got this error:

g++ -I /usr/local/include/log4cxx/ -I /usr/local/include/log4cxx/helpers/
test.cpp -o test -llog4cxx -lunicodehelper

/usr/local/include/log4cxx/helpers/locale.h:26: error: invalid function
declaration
/usr/include/c++/4.0.0/clocale:57: error: '::lconv' has not been declared
/usr/include/c++/4.0.0/clocale:58: error: '::setlocale' has not been declared
/usr/include/c++/4.0.0/clocale:59: error: '::localeconv' has not been
declared
/usr/include/c++/4.0.0/i686-apple-darwin8/bits/c++locale.h: In function
'int std::__convert_from_v(char*, int, const char*, _Tv, int* const&,
int)':
/usr/include/c++/4.0.0/i686-apple-darwin8/bits/c++locale.h:62: error:
'setlocale' is not a member of 'std'
/usr/include/c++/4.0.0/i686-apple-darwin8/bits/c++locale.h:62: error:
'LC_NUMERIC' was not declared in this scope
/usr/include/c++/4.0.0/i686-apple-darwin8/bits/c++locale.h:68: error:
'setlocale' is not a member of 'std'
/usr/include/c++/4.0.0/i686-apple-darwin8/bits/c++locale.h:79: error:
'setlocale' is not a member of 'std'


Any ideas ?

Thx


Re: Problem with a test program

Posted by sh...@rexee.com.
speaking of ant, the ant build failedo my mac:

configure:
     [echo] Configuring with has.wchar_t=0
     [echo] Configuring with logchar_type=utf-8

build:
       [cc] Starting dependency analysis for 144 files.
       [cc] 0 files are up to date.
       [cc] 144 files to be recompiled from dependency analysis.
       [cc] 144 total files to be compiled.
       [cc] Starting link
       [cc] ld: warning -prebind ignored because MACOSX_DEPLOYMENT_TARGET
environment variable greater or equal to 10.4
       [cc] ld: Undefined symbols:
       [cc] __Unwind_Resume
       [cc] __ZN7log4cxx7helpers13UnicodeHelper10decodeWideERPKwS3_
       [cc] __ZN7log4cxx7helpers13UnicodeHelper10encodeWideEjPw
       [cc] __ZN7log4cxx7helpers13UnicodeHelper10lengthUTF8Ew
       [cc] /usr/bin/libtool: internal link edit command failed

BUILD FAILED
/Users/shaideljo/repos/src/users/shai-sand/logging-log4cxx/build.xml:723:
gcc failed with return code 1


i read somewhere i need to link using g++ instead of gcc but failed to
succesfully do so.

any ideas ?





-----Original Message-----
From: "Curt Arnold" <ca...@apache.org>
Sent: Wed, October 11, 2006 3:06 pm
To: "Log4CXX User" <lo...@logging.apache.org>
Subject: Re: Problem with a test program

wchar_t is not sufficiently defined for Mac OS/X to allow
implementation of decodeWide().  That particular unsatisfied link is
the sign that the definition of wchar_t could not be determined.
Same issue occurs on Solaris.   The Ant build will tell you to build
using has.wchar_t=0 to suppress all the wchar_t based methods.  I
believe that --enable-unicode is the corresponding flag for the
autotools build.  CFString is the preferred means to represent
Unicode strings on Mac OS/X, but support for CFString in log4cxx has
not been done.



Re: Problem with a test program

Posted by Curt Arnold <ca...@apache.org>.
wchar_t is not sufficiently defined for Mac OS/X to allow  
implementation of decodeWide().  That particular unsatisfied link is  
the sign that the definition of wchar_t could not be determined.   
Same issue occurs on Solaris.   The Ant build will tell you to build  
using has.wchar_t=0 to suppress all the wchar_t based methods.  I  
believe that --enable-unicode is the corresponding flag for the  
autotools build.  CFString is the preferred means to represent  
Unicode strings on Mac OS/X, but support for CFString in log4cxx has  
not been done.