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/12 08:53:37 UTC

ant build problem.

Hi
I'm trying to build log4cxx on Mac version 10.4.7 but get the following
error:

ant -Dhas.wchar_t=0

.....
.....
.....


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





Re: ant build problem.

Posted by Derek Baum <de...@paremus.com>.
See if you have compiled any objects that reference these symbols:

$ nm -o build/debug/static/log4cxx_obj/*.o | grep 
__ZN7log4cxx7helpers13UnicodeHelper10encodeWideEjPw

If you see any matches, then -Dhas.wchar_t=0 may not have been set when 
log4cxx.h was generated.

Try:

$ grep LOG4CXX_HAS_WCHAR_T include/log4cxx/log4cxx.h
#define LOG4CXX_HAS_WCHAR_T 0

If you see:

#define LOG4CXX_HAS_WCHAR_T 1

then log4cxx.h was generated without -Dhas.wchar_t=0 being set.

Try 'ant clean' and remove include/log4cxx/log4cxx.h

Derek


shai@rexee.com wrote:
> Hi Derek,
> Thanks for the help but when i try your patch compilation also uses g++
> and fails however :
>
> ant -v -Dhas.wchar_t=0
> ......
> ......
> ......
>        [cc] gcc -g -prebind -dynamiclib -o liblog4cxx.dylib
> log4cxx_obj/socket.o log4cxx_obj/transcoder.o
> log4cxx_obj/patternconverter.o log4cxx_obj/optionconverter.o
> log4cxx_obj/rootcategory.o log4cxx_obj/objectptr.o
> log4cxx_obj/basicconfigurator.o
> log4cxx_obj/integerpatternconverter.o
> log4cxx_obj/loggingeventpatternconverter.o
> log4cxx_obj/filelocationpatternconverter.o
> log4cxx_obj/fileinputstream.o log4cxx_obj/configurator.o
> log4cxx_obj/sockethubappender.o log4cxx_obj/bytebuffer.o
> log4cxx_obj/cyclicbuffer.o log4cxx_obj/triggeringpolicy.o
> log4cxx_obj/fulllocationpatternconverter.o log4cxx_obj/datelayout.o
> log4cxx_obj/formattinginfo.o log4cxx_obj/nameabbreviator.o
> log4cxx_obj/logmanager.o log4cxx_obj/datepatternconverter.o
> log4cxx_obj/ttcclayout.o log4cxx_obj/writer.o
> log4cxx_obj/propertyconfigurator.o log4cxx_obj/charsetdecoder.o
> log4cxx_obj/htmllayout.o log4cxx_obj/dateformat.o
> log4cxx_obj/loggingevent.o log4cxx_obj/datagramsocket.o
> log4cxx_obj/fileappender.o log4cxx_obj/transform.o
> log4cxx_obj/action.o log4cxx_obj/xmlsocketappender.o
> log4cxx_obj/cacheddateformat.o log4cxx_obj/socketoutputstream.o
> log4cxx_obj/strftimedateformat.o log4cxx_obj/integer.o
> log4cxx_obj/odbcappender.o log4cxx_obj/rollingpolicy.o
> log4cxx_obj/simplelayout.o log4cxx_obj/namepatternconverter.o
> log4cxx_obj/rolloverdescription.o log4cxx_obj/level.o
> log4cxx_obj/socketimpl.o log4cxx_obj/systemoutwriter.o
> log4cxx_obj/writerappender.o log4cxx_obj/loader.o
> log4cxx_obj/filerenameaction.o log4cxx_obj/simpledateformat.o
> log4cxx_obj/throwableinformationpatternconverter.o
> log4cxx_obj/condition.o log4cxx_obj/loggerpatternconverter.o
> log4cxx_obj/objectimpl.o log4cxx_obj/telnetappender.o
> log4cxx_obj/filewatchdog.o log4cxx_obj/propertyresourcebundle.o
> log4cxx_obj/linelocationpatternconverter.o log4cxx_obj/system.o
> log4cxx_obj/systemerrwriter.o log4cxx_obj/inetaddress.o
> log4cxx_obj/locationinfo.o log4cxx_obj/onlyonceerrorhandler.o
> log4cxx_obj/stringmatchfilter.o log4cxx_obj/propertysetter.o
> log4cxx_obj/mdc.o log4cxx_obj/filedatepatternconverter.o
> log4cxx_obj/nteventlogappender.o log4cxx_obj/stringhelper.o
> log4cxx_obj/dailyrollingfileappender.o
> log4cxx_obj/bytearrayinputstream.o
> log4cxx_obj/obsoleterollingfileappender.o
> log4cxx_obj/patternlayout.o log4cxx_obj/file.o
> log4cxx_obj/timebasedrollingpolicy.o log4cxx_obj/charsetencoder.o
> log4cxx_obj/levelpatternconverter.o log4cxx_obj/thread.o
> log4cxx_obj/serversocket.o log4cxx_obj/locale.o
> log4cxx_obj/rollingpolicybase.o
> log4cxx_obj/lineseparatorpatternconverter.o
> log4cxx_obj/datagrampacket.o log4cxx_obj/fileoutputstream.o
> log4cxx_obj/propertiespatternconverter.o log4cxx_obj/exception.o
> log4cxx_obj/xmllayout.o log4cxx_obj/syslogwriter.o
> log4cxx_obj/relativetimedateformat.o
> log4cxx_obj/threadspecificdata.o log4cxx_obj/levelmatchfilter.o
> log4cxx_obj/date.o log4cxx_obj/patternparser.o
> log4cxx_obj/consoleappender.o log4cxx_obj/socketappenderskeleton.o
> log4cxx_obj/aprinitializer.o log4cxx_obj/layout.o
> log4cxx_obj/levelrangefilter.o
> log4cxx_obj/messagepatternconverter.o
> log4cxx_obj/fallbackerrorhandler.o log4cxx_obj/domconfigurator.o
> log4cxx_obj/unicodehelper.o log4cxx_obj/mutex.o
> log4cxx_obj/syslogappender.o
> log4cxx_obj/classnamepatternconverter.o
> log4cxx_obj/rollingfileappender.o log4cxx_obj/socketnode.o
> log4cxx_obj/resourcebundle.o log4cxx_obj/synchronized.o
> log4cxx_obj/timezone.o log4cxx_obj/pool.o log4cxx_obj/reader.o
> log4cxx_obj/smtpappender.o
> log4cxx_obj/filterbasedtriggeringpolicy.o
> log4cxx_obj/fixedwindowrollingpolicy.o
> log4cxx_obj/literalpatternconverter.o
> log4cxx_obj/defaultcategoryfactory.o log4cxx_obj/appenderskeleton.o
> log4cxx_obj/relativetimepatternconverter.o
> log4cxx_obj/inputstreamreader.o log4cxx_obj/stringtokenizer.o
> log4cxx_obj/threadpatternconverter.o log4cxx_obj/properties.o
> log4cxx_obj/sizebasedtriggeringpolicy.o
> log4cxx_obj/ndcpatternconverter.o log4cxx_obj/inputstream.o
> log4cxx_obj/outputstream.o log4cxx_obj/logger.o
> log4cxx_obj/hierarchy.o log4cxx_obj/ndc.o
> log4cxx_obj/classregistration.o log4cxx_obj/loglog.o
> log4cxx_obj/socketinputstream.o log4cxx_obj/class.o
> log4cxx_obj/asyncappender.o
> log4cxx_obj/methodlocationpatternconverter.o
> log4cxx_obj/socketappender.o
> log4cxx_obj/outputdebugstringappender.o
> log4cxx_obj/appenderattachableimpl.o
> log4cxx_obj/manualtriggeringpolicy.o log4cxx_obj/bufferedwriter.o
> log4cxx_obj/outputstreamwriter.o log4cxx_obj/logstream.o
> log4cxx_obj/defaultconfigurator.o
> -L/Users/shaideljo/repos/src/users/shai-sand/logging-log4cxx/build/debug/static
> -laprutil-1
> -L/Users/shaideljo/repos/src/users/shai-sand/logging-log4cxx/build/debug/static
> -lapr-1 -liconv -lpthread -lstdc++
>        [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
>
>
> when i manually try to link using g++:
>
> 156:~/repos/src/users/shai-sand/logging-log4cxx/build/debug/shared
> shaideljo$ g++ -g -prebind -dynamiclib -o liblog4cxx.dylib
> log4cxx_obj/socket.o log4cxx_obj/transcoder.o
> log4cxx_obj/patternconverter.o log4cxx_obj/optionconverter.o
> log4cxx_obj/rootcategory.o log4cxx_obj/objectptr.o
> log4cxx_obj/basicconfigurator.o log4cxx_obj/integerpatternconverter.o
> log4cxx_obj/loggingeventpatternconverter.o
> log4cxx_obj/filelocationpatternconverter.o log4cxx_obj/fileinputstream.o
> log4cxx_obj/configurator.o log4cxx_obj/sockethubappender.o
> log4cxx_obj/bytebuffer.o log4cxx_obj/cyclicbuffer.o
> log4cxx_obj/triggeringpolicy.o log4cxx_obj/fulllocationpatternconverter.o
> log4cxx_obj/datelayout.o log4cxx_obj/formattinginfo.o
> log4cxx_obj/nameabbreviator.o log4cxx_obj/logmanager.o
> log4cxx_obj/datepatternconverter.o log4cxx_obj/ttcclayout.o
> log4cxx_obj/writer.o log4cxx_obj/propertyconfigurator.o
> log4cxx_obj/charsetdecoder.o log4cxx_obj/htmllayout.o
> log4cxx_obj/dateformat.o log4cxx_obj/loggingevent.o
> log4cxx_obj/datagramsocket.o log4cxx_obj/fileappender.o
> log4cxx_obj/transform.o log4cxx_obj/action.o
> log4cxx_obj/xmlsocketappender.o log4cxx_obj/cacheddateformat.o
> log4cxx_obj/socketoutputstream.o log4cxx_obj/strftimedateformat.o
> log4cxx_obj/integer.o log4cxx_obj/odbcappender.o
> log4cxx_obj/rollingpolicy.o log4cxx_obj/simplelayout.o
> log4cxx_obj/namepatternconverter.o log4cxx_obj/rolloverdescription.o
> log4cxx_obj/level.o log4cxx_obj/socketimpl.o log4cxx_obj/systemoutwriter.o
> log4cxx_obj/writerappender.o log4cxx_obj/loader.o
> log4cxx_obj/filerenameaction.o log4cxx_obj/simpledateformat.o
> log4cxx_obj/throwableinformationpatternconverter.o log4cxx_obj/condition.o
> log4cxx_obj/loggerpatternconverter.o log4cxx_obj/objectimpl.o
> log4cxx_obj/telnetappender.o log4cxx_obj/filewatchdog.o
> log4cxx_obj/propertyresourcebundle.o
> log4cxx_obj/linelocationpatternconverter.o log4cxx_obj/system.o
> log4cxx_obj/systemerrwriter.o log4cxx_obj/inetaddress.o
> log4cxx_obj/locationinfo.o log4cxx_obj/onlyonceerrorhandler.o
> log4cxx_obj/stringmatchfilter.o log4cxx_obj/propertysetter.o
> log4cxx_obj/mdc.o log4cxx_obj/filedatepatternconverter.o
> log4cxx_obj/nteventlogappender.o log4cxx_obj/stringhelper.o
> log4cxx_obj/dailyrollingfileappender.o log4cxx_obj/bytearrayinputstream.o
> log4cxx_obj/obsoleterollingfileappender.o log4cxx_obj/patternlayout.o
> log4cxx_obj/file.o log4cxx_obj/timebasedrollingpolicy.o
> log4cxx_obj/charsetencoder.o log4cxx_obj/levelpatternconverter.o
> log4cxx_obj/thread.o log4cxx_obj/serversocket.o log4cxx_obj/locale.o
> log4cxx_obj/rollingpolicybase.o
> log4cxx_obj/lineseparatorpatternconverter.o log4cxx_obj/datagrampacket.o
> log4cxx_obj/fileoutputstream.o log4cxx_obj/propertiespatternconverter.o
> log4cxx_obj/exception.o log4cxx_obj/xmllayout.o log4cxx_obj/syslogwriter.o
> log4cxx_obj/relativetimedateformat.o log4cxx_obj/threadspecificdata.o
> log4cxx_obj/levelmatchfilter.o log4cxx_obj/date.o
> log4cxx_obj/patternparser.o log4cxx_obj/consoleappender.o
> log4cxx_obj/socketappenderskeleton.o log4cxx_obj/aprinitializer.o
> log4cxx_obj/layout.o log4cxx_obj/levelrangefilter.o
> log4cxx_obj/messagepatternconverter.o log4cxx_obj/fallbackerrorhandler.o
> log4cxx_obj/domconfigurator.o log4cxx_obj/unicodehelper.o
> log4cxx_obj/mutex.o log4cxx_obj/syslogappender.o
> log4cxx_obj/classnamepatternconverter.o log4cxx_obj/rollingfileappender.o
> log4cxx_obj/socketnode.o log4cxx_obj/resourcebundle.o
> log4cxx_obj/synchronized.o log4cxx_obj/timezone.o log4cxx_obj/pool.o
> log4cxx_obj/reader.o log4cxx_obj/smtpappender.o
> log4cxx_obj/filterbasedtriggeringpolicy.o
> log4cxx_obj/fixedwindowrollingpolicy.o
> log4cxx_obj/literalpatternconverter.o log4cxx_obj/defaultcategoryfactory.o
> log4cxx_obj/appenderskeleton.o log4cxx_obj/relativetimepatternconverter.o
> log4cxx_obj/inputstreamreader.o log4cxx_obj/stringtokenizer.o
> log4cxx_obj/threadpatternconverter.o log4cxx_obj/properties.o
> log4cxx_obj/sizebasedtriggeringpolicy.o log4cxx_obj/ndcpatternconverter.o
> log4cxx_obj/inputstream.o log4cxx_obj/outputstream.o log4cxx_obj/logger.o
> log4cxx_obj/hierarchy.o log4cxx_obj/ndc.o log4cxx_obj/classregistration.o
> log4cxx_obj/loglog.o log4cxx_obj/socketinputstream.o log4cxx_obj/class.o
> log4cxx_obj/asyncappender.o log4cxx_obj/methodlocationpatternconverter.o
> log4cxx_obj/socketappender.o log4cxx_obj/outputdebugstringappender.o
> log4cxx_obj/appenderattachableimpl.o log4cxx_obj/manualtriggeringpolicy.o
> log4cxx_obj/bufferedwriter.o log4cxx_obj/outputstreamwriter.o
> log4cxx_obj/logstream.o log4cxx_obj/defaultconfigurator.o
> -L/Users/shaideljo/repos/src/users/shai-sand/logging-log4cxx/build/debug/static
> -laprutil-1
> -L/Users/shaideljo/repos/src/users/shai-sand/logging-log4cxx/build/debug/static
> -lapr-1 -liconv -lpthread -lstdc++
> ld: warning prebinding disabled because of undefined symbols
> ld: Undefined symbols:
> __ZN7log4cxx7helpers13UnicodeHelper10decodeWideERPKwS3_
> __ZN7log4cxx7helpers13UnicodeHelper10encodeWideEjPw
> __ZN7log4cxx7helpers13UnicodeHelper10lengthUTF8Ew
> /usr/bin/libtool: internal link edit command failed
>
>
> i still get the problems with the UnicodeHelper so it seems like the
> source of my problems is with the UnicodeHelper and not the linker.
>
> I have xcode 2.4 installed if it matters.
>
> any ideas ?
>
> thx
> Shai
>
>
>
> -----Original Message-----
> From: "Derek Baum" <de...@paremus.com>
> Sent: Thu, October 12, 2006 3:25 am
> To: "Log4CXX User" <lo...@logging.apache.org>
> Subject: Re: ant build problem.
>
> This error is because gcc rather than g++ is being used for the link.
>
> This is because the compiler setting on line 229 of build.xml takes
> precedence over the one on line 235:
>   
>>     227 <target name="unix-init" depends="mac-init" if="is-unix">
>>     228
>>     229     <property name="compiler" value="gcc"/>
>>     230
>>     231     <property name="lib.prefix" value="lib"/>
>>     232     <property name="lib.extension" value=".a"/>
>>     233     <property name="project.type" value="cbuilderx"/>
>>     234     <property name="project.dir" value="cbx"/>
>>     235     <property name="compiler" value="g++"/>
>>     236     <property name="lib-suffix" value=""/>
>>     
> However, simply removing the offending compiler setting on line 229,
> does not fix the problem.
> "ant -v" shows why - cpptasks is still using gcc to link!
>   
>>        [cc] Starting link
>>        [cc] gcc -g -prebind -dynamiclib -o liblog4cxx.dylib
>> log4cxx_obj/socket.o ...
>>  -laprutil-1 -L/Users/derek/src/svn-log4cxx/build/debug/static -lapr-1
>> -liconv -lpthread -lstdc++
>>        [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] /usr/bin/libtool: internal link edit command failed
>>     
> I think this is a bug in cpptasks-1.04b which the following changes
> appear to fix:
>   
>> --- src/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java
>> 2006-05-19 13:48:38.000000000 +0100
>> +++
>> /Users/derek/src/cpptasks-1.0b4/src/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java
>> 2006-10-12 10:19:06.000000000 +0100
>> @@ -234,6 +234,10 @@
>>          return identifier;
>>      }
>>      public Linker getLinker(LinkType linkType) {
>> +       // derek.baum@paremus.com - return gpp linker
>> +       if (getCommand().equals("g++")) {
>> +           return GppLinker.getInstance().getLinker(linkType);
>> +       }
>>          return GccLinker.getInstance().getLinker(linkType);
>>      }
>>      public int getMaximumCommandLength() {
>>     
>
>   
>> --- src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java   2006-05-19
>> 13:48:38.000000000 +0100
>> +++
>> /Users/derek/src/cpptasks-1.0b4/src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java
>> 2006-10-12 10:21:10.000000000 +0100
>> @@ -29,12 +29,13 @@
>>   *
>>   * @author Stephen M. Webb <st...@bregmasoft.com>
>>   */
>> +// derek.baum@paremus.com - use use "g++" for GppLinker
>>  public class GppLinker extends AbstractLdLinker {
>>      protected static final String[] discardFiles = new String[0];
>>      protected static final String[] objFiles = new String[]{".o",
>> ".a", ".lib",             ".dll", ".so", ".sl"};
>> -    private static final GppLinker dllLinker = new GppLinker("gcc",
>> objFiles,
>> -            discardFiles, "lib", ".so", false, new GppLinker("gcc",
>> objFiles,
>> +    private static final GppLinker dllLinker = new GppLinker("g++",
>> objFiles,
>> +            discardFiles, "lib", ".so", false, new GppLinker("g++",
>> objFiles,
>>                      discardFiles, "lib", ".so", true, null));
>>      private final static String libPrefix = "libraries: =";
>>      protected static final String[] libtoolObjFiles = new
>> String[]{".fo", ".a",@@ -42,11 +43,11 @@
>>      private static String[] linkerOptions = new String[]{"-bundle",
>> "-dylib",
>>              "-dynamic", "-dynamiclib", "-nostartfiles", "-nostdlib",
>>              "-prebind", "-s", "-static", "-shared", "-symbolic",
>> "-Xlinker"};
>> -    private static final GppLinker instance = new GppLinker("gcc",
>> objFiles,
>> +    private static final GppLinker instance = new GppLinker("g++",
>> objFiles,
>>              discardFiles, "", "", false, null);
>> -    private static final GppLinker machDllLinker = new GppLinker("gcc",
>> +    private static final GppLinker machDllLinker = new GppLinker("g++",
>>              objFiles, discardFiles, "lib", ".dylib", false, null);
>> -    private static final GppLinker machPluginLinker = new
>> GppLinker("gcc",
>> +    private static final GppLinker machPluginLinker = new
>> GppLinker("g++",
>>              objFiles, discardFiles, "lib", ".bundle", false, null);
>>      public static GppLinker getInstance() {
>>          return instance;
>>     
>
> The next problem you'll encounter is:
>
>   
>> build-shortsocketserver:
>>        [cc] Starting dependency analysis for 1 files.
>>        [cc] 1 files are up to date.
>>        [cc] 0 files to be recompiled from dependency analysis.
>>        [cc] 0 total files to be compiled.
>>        [cc] Starting link
>>        [cc] /usr/bin/ld: can't locate file for: -llog4cxx
>>        [cc] collect2: ld returned 1 exit status
>>     
>
> This is because the log4cxx shared library was built with a .so
> extension, rather than .dylib.
> I build log4cxx static, so I haven't fixed this yet (you can always
> manually rename it).
>
> The build and all unit tests then complete successfully, however you're
> not quite done, because a clean build will now fail to compile apr:
>
>   
>> BUILD FAILED
>> /Users/derek/src/svn-log4cxx/build.xml:553: The following error
>> occurred while executing this line:
>> /Users/derek/src/svn-log4cxx/apr-build.xml:166: g++ failed with return
>> code 1
>>     
> This is because the changes made to use the g++ linker, also cause g++
> to be used to compile apr.
> So I added an apr-compiler property into build.xml:
>
>   
>> --- build.xml   (revision 463159)
>> +++ build.xml   (working copy)
>> @@ -62,7 +62,7 @@
>>  <property name="version" value="0.10.0"/>
>>  <property name="rtti" value="false"/>
>>  <property name="optimize" value="none"/>
>> -<property name="lib.type" value="shared"/>
>> +<property name="lib.type" value="static"/>
>>  <property name="has.wchar_t" value="1"/>
>>
>>  <property name="apache.mirror" value="http://archive.apache.org/dist"/>
>> @@ -226,8 +226,9 @@
>>
>>  <target name="unix-init" depends="mac-init" if="is-unix">
>>
>> -    <property name="compiler" value="gcc"/>
>> +    <!-- <property name="compiler" value="gcc"/> -->
>>
>> +    <property name="apr-compiler" value="gcc"/>
>>      <property name="lib.prefix" value="lib"/>
>>      <property name="lib.extension" value=".a"/>
>>      <property name="project.type" value="cbuilderx"/>
>> @@ -542,6 +543,7 @@
>>  </target>
>>
>>  <target name="build-apr" depends="init" unless="apr-available">
>> +    <property name="apr-compiler" value="${compiler}" />
>>      <antcall target="untar-apr-src"/>
>>
>>      <property name="apr.dir" location="${lib.dir}/apr-${apr.version}"/>
>> @@ -552,7 +554,7 @@
>>          <property name="version" value="${apr.version}"/>
>>          <property name="debug" value="${debug}"/>
>>          <property name="lib-suffix" value="${lib-suffix}"/>
>> -        <property name="compiler" value="${compiler}"/>
>> +        <property name="compiler" value="${apr-compiler}"/>
>>          <property name="apr.dir" value="${apr.dir}"/>
>>          <property name="apr.lib.dir" value="${apr.lib.dir}"/>
>>          <property name="apr.lib.type" value="${apr.lib.type}"/>
>> @@ -602,7 +604,7 @@
>>          <property name="aprutil.dir" value="${aprutil.dir}"/>
>>          <property name="debug" value="${debug}"/>
>>          <property name="lib-suffix" value="${lib-suffix}"/>
>> -        <property name="compiler" value="${compiler}"/>
>> +        <property name="compiler" value="${apr-compiler}"/>
>>          <property name="apr.include.dir" value="${apr.include.dir}"/>
>>          <property name="apr.lib.dir" value="${apr.lib.dir}"/>
>>          <property name="aprutil.lib.dir" value="${aprutil.lib.dir}"/>
>>     
>
> If I'm missing an easier way to get this to compile on OSX I'd love to
> hear it
>
> Derek
>
>
> shai@rexee.com wrote:
>   
>> Hi
>> I'm trying to build log4cxx on Mac version 10.4.7 but get the following
>> error:
>>
>> ant -Dhas.wchar_t=0
>>
>> .....
>> .....
>> .....
>>
>>
>> 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
>>
>>     
>
> ________________________________________________________________________
> The information transmitted is intended only for the person(s) or entity
> to which it is addressed and may contain confidential and/or privileged
> material. Any review, retransmission, dissemination or other use of, or
> taking of any action in reliance upon, this information by persons or
> entities other than the intended recipient is prohibited. If you
> received this in error, please contact the sender and delete the
> material from any computer.
>
> Paremus Limited.
> 107-111 Fleet Street, London EC4A 2AB.  Phone number +44 20 7936 9098
> ________________________________________________________________________
>
>
>
> ________________________________________________________________________
> This email has been scanned by both Message Labs and Paremus internal 
> systems for viruses and inappropriate attachments.  Email suspected of 
> carrying a virus payload or inappropriate attachment will not be 
> delivered to you, and the sender will receive an appropriate warning notice.
>
> Paremus Limited.
> 107-111 Fleet Street, London EC4A 2AB.  Phone number +44 20 7936 9098
> ________________________________________________________________________
>   

________________________________________________________________________
The information transmitted is intended only for the person(s) or entity
to which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you
received this in error, please contact the sender and delete the
material from any computer. 

Paremus Limited.
107-111 Fleet Street, London EC4A 2AB.  Phone number +44 20 7936 9098
________________________________________________________________________

Re: ant build problem.

Posted by sh...@rexee.com.
Hi Derek,
Thanks for the help but when i try your patch compilation also uses g++
and fails however :

ant -v -Dhas.wchar_t=0
......
......
......
       [cc] gcc -g -prebind -dynamiclib -o liblog4cxx.dylib
log4cxx_obj/socket.o log4cxx_obj/transcoder.o
log4cxx_obj/patternconverter.o log4cxx_obj/optionconverter.o
log4cxx_obj/rootcategory.o log4cxx_obj/objectptr.o
log4cxx_obj/basicconfigurator.o
log4cxx_obj/integerpatternconverter.o
log4cxx_obj/loggingeventpatternconverter.o
log4cxx_obj/filelocationpatternconverter.o
log4cxx_obj/fileinputstream.o log4cxx_obj/configurator.o
log4cxx_obj/sockethubappender.o log4cxx_obj/bytebuffer.o
log4cxx_obj/cyclicbuffer.o log4cxx_obj/triggeringpolicy.o
log4cxx_obj/fulllocationpatternconverter.o log4cxx_obj/datelayout.o
log4cxx_obj/formattinginfo.o log4cxx_obj/nameabbreviator.o
log4cxx_obj/logmanager.o log4cxx_obj/datepatternconverter.o
log4cxx_obj/ttcclayout.o log4cxx_obj/writer.o
log4cxx_obj/propertyconfigurator.o log4cxx_obj/charsetdecoder.o
log4cxx_obj/htmllayout.o log4cxx_obj/dateformat.o
log4cxx_obj/loggingevent.o log4cxx_obj/datagramsocket.o
log4cxx_obj/fileappender.o log4cxx_obj/transform.o
log4cxx_obj/action.o log4cxx_obj/xmlsocketappender.o
log4cxx_obj/cacheddateformat.o log4cxx_obj/socketoutputstream.o
log4cxx_obj/strftimedateformat.o log4cxx_obj/integer.o
log4cxx_obj/odbcappender.o log4cxx_obj/rollingpolicy.o
log4cxx_obj/simplelayout.o log4cxx_obj/namepatternconverter.o
log4cxx_obj/rolloverdescription.o log4cxx_obj/level.o
log4cxx_obj/socketimpl.o log4cxx_obj/systemoutwriter.o
log4cxx_obj/writerappender.o log4cxx_obj/loader.o
log4cxx_obj/filerenameaction.o log4cxx_obj/simpledateformat.o
log4cxx_obj/throwableinformationpatternconverter.o
log4cxx_obj/condition.o log4cxx_obj/loggerpatternconverter.o
log4cxx_obj/objectimpl.o log4cxx_obj/telnetappender.o
log4cxx_obj/filewatchdog.o log4cxx_obj/propertyresourcebundle.o
log4cxx_obj/linelocationpatternconverter.o log4cxx_obj/system.o
log4cxx_obj/systemerrwriter.o log4cxx_obj/inetaddress.o
log4cxx_obj/locationinfo.o log4cxx_obj/onlyonceerrorhandler.o
log4cxx_obj/stringmatchfilter.o log4cxx_obj/propertysetter.o
log4cxx_obj/mdc.o log4cxx_obj/filedatepatternconverter.o
log4cxx_obj/nteventlogappender.o log4cxx_obj/stringhelper.o
log4cxx_obj/dailyrollingfileappender.o
log4cxx_obj/bytearrayinputstream.o
log4cxx_obj/obsoleterollingfileappender.o
log4cxx_obj/patternlayout.o log4cxx_obj/file.o
log4cxx_obj/timebasedrollingpolicy.o log4cxx_obj/charsetencoder.o
log4cxx_obj/levelpatternconverter.o log4cxx_obj/thread.o
log4cxx_obj/serversocket.o log4cxx_obj/locale.o
log4cxx_obj/rollingpolicybase.o
log4cxx_obj/lineseparatorpatternconverter.o
log4cxx_obj/datagrampacket.o log4cxx_obj/fileoutputstream.o
log4cxx_obj/propertiespatternconverter.o log4cxx_obj/exception.o
log4cxx_obj/xmllayout.o log4cxx_obj/syslogwriter.o
log4cxx_obj/relativetimedateformat.o
log4cxx_obj/threadspecificdata.o log4cxx_obj/levelmatchfilter.o
log4cxx_obj/date.o log4cxx_obj/patternparser.o
log4cxx_obj/consoleappender.o log4cxx_obj/socketappenderskeleton.o
log4cxx_obj/aprinitializer.o log4cxx_obj/layout.o
log4cxx_obj/levelrangefilter.o
log4cxx_obj/messagepatternconverter.o
log4cxx_obj/fallbackerrorhandler.o log4cxx_obj/domconfigurator.o
log4cxx_obj/unicodehelper.o log4cxx_obj/mutex.o
log4cxx_obj/syslogappender.o
log4cxx_obj/classnamepatternconverter.o
log4cxx_obj/rollingfileappender.o log4cxx_obj/socketnode.o
log4cxx_obj/resourcebundle.o log4cxx_obj/synchronized.o
log4cxx_obj/timezone.o log4cxx_obj/pool.o log4cxx_obj/reader.o
log4cxx_obj/smtpappender.o
log4cxx_obj/filterbasedtriggeringpolicy.o
log4cxx_obj/fixedwindowrollingpolicy.o
log4cxx_obj/literalpatternconverter.o
log4cxx_obj/defaultcategoryfactory.o log4cxx_obj/appenderskeleton.o
log4cxx_obj/relativetimepatternconverter.o
log4cxx_obj/inputstreamreader.o log4cxx_obj/stringtokenizer.o
log4cxx_obj/threadpatternconverter.o log4cxx_obj/properties.o
log4cxx_obj/sizebasedtriggeringpolicy.o
log4cxx_obj/ndcpatternconverter.o log4cxx_obj/inputstream.o
log4cxx_obj/outputstream.o log4cxx_obj/logger.o
log4cxx_obj/hierarchy.o log4cxx_obj/ndc.o
log4cxx_obj/classregistration.o log4cxx_obj/loglog.o
log4cxx_obj/socketinputstream.o log4cxx_obj/class.o
log4cxx_obj/asyncappender.o
log4cxx_obj/methodlocationpatternconverter.o
log4cxx_obj/socketappender.o
log4cxx_obj/outputdebugstringappender.o
log4cxx_obj/appenderattachableimpl.o
log4cxx_obj/manualtriggeringpolicy.o log4cxx_obj/bufferedwriter.o
log4cxx_obj/outputstreamwriter.o log4cxx_obj/logstream.o
log4cxx_obj/defaultconfigurator.o
-L/Users/shaideljo/repos/src/users/shai-sand/logging-log4cxx/build/debug/static
-laprutil-1
-L/Users/shaideljo/repos/src/users/shai-sand/logging-log4cxx/build/debug/static
-lapr-1 -liconv -lpthread -lstdc++
       [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


when i manually try to link using g++:

156:~/repos/src/users/shai-sand/logging-log4cxx/build/debug/shared
shaideljo$ g++ -g -prebind -dynamiclib -o liblog4cxx.dylib
log4cxx_obj/socket.o log4cxx_obj/transcoder.o
log4cxx_obj/patternconverter.o log4cxx_obj/optionconverter.o
log4cxx_obj/rootcategory.o log4cxx_obj/objectptr.o
log4cxx_obj/basicconfigurator.o log4cxx_obj/integerpatternconverter.o
log4cxx_obj/loggingeventpatternconverter.o
log4cxx_obj/filelocationpatternconverter.o log4cxx_obj/fileinputstream.o
log4cxx_obj/configurator.o log4cxx_obj/sockethubappender.o
log4cxx_obj/bytebuffer.o log4cxx_obj/cyclicbuffer.o
log4cxx_obj/triggeringpolicy.o log4cxx_obj/fulllocationpatternconverter.o
log4cxx_obj/datelayout.o log4cxx_obj/formattinginfo.o
log4cxx_obj/nameabbreviator.o log4cxx_obj/logmanager.o
log4cxx_obj/datepatternconverter.o log4cxx_obj/ttcclayout.o
log4cxx_obj/writer.o log4cxx_obj/propertyconfigurator.o
log4cxx_obj/charsetdecoder.o log4cxx_obj/htmllayout.o
log4cxx_obj/dateformat.o log4cxx_obj/loggingevent.o
log4cxx_obj/datagramsocket.o log4cxx_obj/fileappender.o
log4cxx_obj/transform.o log4cxx_obj/action.o
log4cxx_obj/xmlsocketappender.o log4cxx_obj/cacheddateformat.o
log4cxx_obj/socketoutputstream.o log4cxx_obj/strftimedateformat.o
log4cxx_obj/integer.o log4cxx_obj/odbcappender.o
log4cxx_obj/rollingpolicy.o log4cxx_obj/simplelayout.o
log4cxx_obj/namepatternconverter.o log4cxx_obj/rolloverdescription.o
log4cxx_obj/level.o log4cxx_obj/socketimpl.o log4cxx_obj/systemoutwriter.o
log4cxx_obj/writerappender.o log4cxx_obj/loader.o
log4cxx_obj/filerenameaction.o log4cxx_obj/simpledateformat.o
log4cxx_obj/throwableinformationpatternconverter.o log4cxx_obj/condition.o
log4cxx_obj/loggerpatternconverter.o log4cxx_obj/objectimpl.o
log4cxx_obj/telnetappender.o log4cxx_obj/filewatchdog.o
log4cxx_obj/propertyresourcebundle.o
log4cxx_obj/linelocationpatternconverter.o log4cxx_obj/system.o
log4cxx_obj/systemerrwriter.o log4cxx_obj/inetaddress.o
log4cxx_obj/locationinfo.o log4cxx_obj/onlyonceerrorhandler.o
log4cxx_obj/stringmatchfilter.o log4cxx_obj/propertysetter.o
log4cxx_obj/mdc.o log4cxx_obj/filedatepatternconverter.o
log4cxx_obj/nteventlogappender.o log4cxx_obj/stringhelper.o
log4cxx_obj/dailyrollingfileappender.o log4cxx_obj/bytearrayinputstream.o
log4cxx_obj/obsoleterollingfileappender.o log4cxx_obj/patternlayout.o
log4cxx_obj/file.o log4cxx_obj/timebasedrollingpolicy.o
log4cxx_obj/charsetencoder.o log4cxx_obj/levelpatternconverter.o
log4cxx_obj/thread.o log4cxx_obj/serversocket.o log4cxx_obj/locale.o
log4cxx_obj/rollingpolicybase.o
log4cxx_obj/lineseparatorpatternconverter.o log4cxx_obj/datagrampacket.o
log4cxx_obj/fileoutputstream.o log4cxx_obj/propertiespatternconverter.o
log4cxx_obj/exception.o log4cxx_obj/xmllayout.o log4cxx_obj/syslogwriter.o
log4cxx_obj/relativetimedateformat.o log4cxx_obj/threadspecificdata.o
log4cxx_obj/levelmatchfilter.o log4cxx_obj/date.o
log4cxx_obj/patternparser.o log4cxx_obj/consoleappender.o
log4cxx_obj/socketappenderskeleton.o log4cxx_obj/aprinitializer.o
log4cxx_obj/layout.o log4cxx_obj/levelrangefilter.o
log4cxx_obj/messagepatternconverter.o log4cxx_obj/fallbackerrorhandler.o
log4cxx_obj/domconfigurator.o log4cxx_obj/unicodehelper.o
log4cxx_obj/mutex.o log4cxx_obj/syslogappender.o
log4cxx_obj/classnamepatternconverter.o log4cxx_obj/rollingfileappender.o
log4cxx_obj/socketnode.o log4cxx_obj/resourcebundle.o
log4cxx_obj/synchronized.o log4cxx_obj/timezone.o log4cxx_obj/pool.o
log4cxx_obj/reader.o log4cxx_obj/smtpappender.o
log4cxx_obj/filterbasedtriggeringpolicy.o
log4cxx_obj/fixedwindowrollingpolicy.o
log4cxx_obj/literalpatternconverter.o log4cxx_obj/defaultcategoryfactory.o
log4cxx_obj/appenderskeleton.o log4cxx_obj/relativetimepatternconverter.o
log4cxx_obj/inputstreamreader.o log4cxx_obj/stringtokenizer.o
log4cxx_obj/threadpatternconverter.o log4cxx_obj/properties.o
log4cxx_obj/sizebasedtriggeringpolicy.o log4cxx_obj/ndcpatternconverter.o
log4cxx_obj/inputstream.o log4cxx_obj/outputstream.o log4cxx_obj/logger.o
log4cxx_obj/hierarchy.o log4cxx_obj/ndc.o log4cxx_obj/classregistration.o
log4cxx_obj/loglog.o log4cxx_obj/socketinputstream.o log4cxx_obj/class.o
log4cxx_obj/asyncappender.o log4cxx_obj/methodlocationpatternconverter.o
log4cxx_obj/socketappender.o log4cxx_obj/outputdebugstringappender.o
log4cxx_obj/appenderattachableimpl.o log4cxx_obj/manualtriggeringpolicy.o
log4cxx_obj/bufferedwriter.o log4cxx_obj/outputstreamwriter.o
log4cxx_obj/logstream.o log4cxx_obj/defaultconfigurator.o
-L/Users/shaideljo/repos/src/users/shai-sand/logging-log4cxx/build/debug/static
-laprutil-1
-L/Users/shaideljo/repos/src/users/shai-sand/logging-log4cxx/build/debug/static
-lapr-1 -liconv -lpthread -lstdc++
ld: warning prebinding disabled because of undefined symbols
ld: Undefined symbols:
__ZN7log4cxx7helpers13UnicodeHelper10decodeWideERPKwS3_
__ZN7log4cxx7helpers13UnicodeHelper10encodeWideEjPw
__ZN7log4cxx7helpers13UnicodeHelper10lengthUTF8Ew
/usr/bin/libtool: internal link edit command failed


i still get the problems with the UnicodeHelper so it seems like the
source of my problems is with the UnicodeHelper and not the linker.

I have xcode 2.4 installed if it matters.

any ideas ?

thx
Shai



-----Original Message-----
From: "Derek Baum" <de...@paremus.com>
Sent: Thu, October 12, 2006 3:25 am
To: "Log4CXX User" <lo...@logging.apache.org>
Subject: Re: ant build problem.

This error is because gcc rather than g++ is being used for the link.

This is because the compiler setting on line 229 of build.xml takes
precedence over the one on line 235:
>     227 <target name="unix-init" depends="mac-init" if="is-unix">
>     228
>     229     <property name="compiler" value="gcc"/>
>     230
>     231     <property name="lib.prefix" value="lib"/>
>     232     <property name="lib.extension" value=".a"/>
>     233     <property name="project.type" value="cbuilderx"/>
>     234     <property name="project.dir" value="cbx"/>
>     235     <property name="compiler" value="g++"/>
>     236     <property name="lib-suffix" value=""/>
However, simply removing the offending compiler setting on line 229,
does not fix the problem.
"ant -v" shows why - cpptasks is still using gcc to link!
>        [cc] Starting link
>        [cc] gcc -g -prebind -dynamiclib -o liblog4cxx.dylib
> log4cxx_obj/socket.o ...
>  -laprutil-1 -L/Users/derek/src/svn-log4cxx/build/debug/static -lapr-1
> -liconv -lpthread -lstdc++
>        [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] /usr/bin/libtool: internal link edit command failed
I think this is a bug in cpptasks-1.04b which the following changes
appear to fix:
> --- src/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java
> 2006-05-19 13:48:38.000000000 +0100
> +++
> /Users/derek/src/cpptasks-1.0b4/src/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java
> 2006-10-12 10:19:06.000000000 +0100
> @@ -234,6 +234,10 @@
>          return identifier;
>      }
>      public Linker getLinker(LinkType linkType) {
> +       // derek.baum@paremus.com - return gpp linker
> +       if (getCommand().equals("g++")) {
> +           return GppLinker.getInstance().getLinker(linkType);
> +       }
>          return GccLinker.getInstance().getLinker(linkType);
>      }
>      public int getMaximumCommandLength() {

> --- src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java   2006-05-19
> 13:48:38.000000000 +0100
> +++
> /Users/derek/src/cpptasks-1.0b4/src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java
> 2006-10-12 10:21:10.000000000 +0100
> @@ -29,12 +29,13 @@
>   *
>   * @author Stephen M. Webb <st...@bregmasoft.com>
>   */
> +// derek.baum@paremus.com - use use "g++" for GppLinker
>  public class GppLinker extends AbstractLdLinker {
>      protected static final String[] discardFiles = new String[0];
>      protected static final String[] objFiles = new String[]{".o",
> ".a", ".lib",             ".dll", ".so", ".sl"};
> -    private static final GppLinker dllLinker = new GppLinker("gcc",
> objFiles,
> -            discardFiles, "lib", ".so", false, new GppLinker("gcc",
> objFiles,
> +    private static final GppLinker dllLinker = new GppLinker("g++",
> objFiles,
> +            discardFiles, "lib", ".so", false, new GppLinker("g++",
> objFiles,
>                      discardFiles, "lib", ".so", true, null));
>      private final static String libPrefix = "libraries: =";
>      protected static final String[] libtoolObjFiles = new
> String[]{".fo", ".a",@@ -42,11 +43,11 @@
>      private static String[] linkerOptions = new String[]{"-bundle",
> "-dylib",
>              "-dynamic", "-dynamiclib", "-nostartfiles", "-nostdlib",
>              "-prebind", "-s", "-static", "-shared", "-symbolic",
> "-Xlinker"};
> -    private static final GppLinker instance = new GppLinker("gcc",
> objFiles,
> +    private static final GppLinker instance = new GppLinker("g++",
> objFiles,
>              discardFiles, "", "", false, null);
> -    private static final GppLinker machDllLinker = new GppLinker("gcc",
> +    private static final GppLinker machDllLinker = new GppLinker("g++",
>              objFiles, discardFiles, "lib", ".dylib", false, null);
> -    private static final GppLinker machPluginLinker = new
> GppLinker("gcc",
> +    private static final GppLinker machPluginLinker = new
> GppLinker("g++",
>              objFiles, discardFiles, "lib", ".bundle", false, null);
>      public static GppLinker getInstance() {
>          return instance;

The next problem you'll encounter is:

> build-shortsocketserver:
>        [cc] Starting dependency analysis for 1 files.
>        [cc] 1 files are up to date.
>        [cc] 0 files to be recompiled from dependency analysis.
>        [cc] 0 total files to be compiled.
>        [cc] Starting link
>        [cc] /usr/bin/ld: can't locate file for: -llog4cxx
>        [cc] collect2: ld returned 1 exit status

This is because the log4cxx shared library was built with a .so
extension, rather than .dylib.
I build log4cxx static, so I haven't fixed this yet (you can always
manually rename it).

The build and all unit tests then complete successfully, however you're
not quite done, because a clean build will now fail to compile apr:

> BUILD FAILED
> /Users/derek/src/svn-log4cxx/build.xml:553: The following error
> occurred while executing this line:
> /Users/derek/src/svn-log4cxx/apr-build.xml:166: g++ failed with return
> code 1
This is because the changes made to use the g++ linker, also cause g++
to be used to compile apr.
So I added an apr-compiler property into build.xml:

> --- build.xml   (revision 463159)
> +++ build.xml   (working copy)
> @@ -62,7 +62,7 @@
>  <property name="version" value="0.10.0"/>
>  <property name="rtti" value="false"/>
>  <property name="optimize" value="none"/>
> -<property name="lib.type" value="shared"/>
> +<property name="lib.type" value="static"/>
>  <property name="has.wchar_t" value="1"/>
>
>  <property name="apache.mirror" value="http://archive.apache.org/dist"/>
> @@ -226,8 +226,9 @@
>
>  <target name="unix-init" depends="mac-init" if="is-unix">
>
> -    <property name="compiler" value="gcc"/>
> +    <!-- <property name="compiler" value="gcc"/> -->
>
> +    <property name="apr-compiler" value="gcc"/>
>      <property name="lib.prefix" value="lib"/>
>      <property name="lib.extension" value=".a"/>
>      <property name="project.type" value="cbuilderx"/>
> @@ -542,6 +543,7 @@
>  </target>
>
>  <target name="build-apr" depends="init" unless="apr-available">
> +    <property name="apr-compiler" value="${compiler}" />
>      <antcall target="untar-apr-src"/>
>
>      <property name="apr.dir" location="${lib.dir}/apr-${apr.version}"/>
> @@ -552,7 +554,7 @@
>          <property name="version" value="${apr.version}"/>
>          <property name="debug" value="${debug}"/>
>          <property name="lib-suffix" value="${lib-suffix}"/>
> -        <property name="compiler" value="${compiler}"/>
> +        <property name="compiler" value="${apr-compiler}"/>
>          <property name="apr.dir" value="${apr.dir}"/>
>          <property name="apr.lib.dir" value="${apr.lib.dir}"/>
>          <property name="apr.lib.type" value="${apr.lib.type}"/>
> @@ -602,7 +604,7 @@
>          <property name="aprutil.dir" value="${aprutil.dir}"/>
>          <property name="debug" value="${debug}"/>
>          <property name="lib-suffix" value="${lib-suffix}"/>
> -        <property name="compiler" value="${compiler}"/>
> +        <property name="compiler" value="${apr-compiler}"/>
>          <property name="apr.include.dir" value="${apr.include.dir}"/>
>          <property name="apr.lib.dir" value="${apr.lib.dir}"/>
>          <property name="aprutil.lib.dir" value="${aprutil.lib.dir}"/>

If I'm missing an easier way to get this to compile on OSX I'd love to
hear it

Derek


shai@rexee.com wrote:
> Hi
> I'm trying to build log4cxx on Mac version 10.4.7 but get the following
> error:
>
> ant -Dhas.wchar_t=0
>
> .....
> .....
> .....
>
>
> 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
>

________________________________________________________________________
The information transmitted is intended only for the person(s) or entity
to which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you
received this in error, please contact the sender and delete the
material from any computer.

Paremus Limited.
107-111 Fleet Street, London EC4A 2AB.  Phone number +44 20 7936 9098
________________________________________________________________________



Re: ant OSX build problem.

Posted by Derek Baum <de...@paremus.com>.
Hi,

I'm glad you've fixed your problem.

You still another cpptasks patch to make it use g++ as the linker:

<https://sourceforge.net/tracker/index.php?func=detail&aid=1576291&group_id=36177&atid=416920>

Derek

shai@rexee.com wrote:
> Hi Derek,
> This solution didn't work for me (it still used gcc to limk) however it
> sent me on the right trail:
>
> ./autogen.sh
> ./configure
> vi include/log4cxx/log4cxx.h
>
> *********
> change :
> #define LOG4CXX_HAS_WCHAR_T 1
> to:
> #define LOG4CXX_HAS_WCHAR_T 0
> *********
>
> make
> make install
>
>
> and it worked :).
>
> Thx for the help !!!
>
> Shai
>
>
>
> -----Original Message-----
> From: "Derek Baum" <de...@paremus.com>
> Sent: Thu, October 12, 2006 5:40 pm
> To: "Log4CXX User" <lo...@logging.apache.org>
> Subject: Re: ant OSX build problem.
>
> There are two problems here:
>
>    1. unwanted references to UnicodeHelper::encodeWide() etc
>    2. reference to _Unwind_Resume
>
> The first should be fixed with a clean build using -Dhas.wchar_t=0 that
> re-runs configure.
>
> The second is because we need to use the g++ linker.
>
> I have re-investigated my previous post, and offer the following simpler
> solution:
>
> I have modified build.xml to add <linker name="g++" /> where it matters,
> and I can then build from clean on my MacBook Pro, with only one manual
> interaction:
>   
>> build-shortsocketserver:
>>        [cc] Starting dependency analysis for 1 files.
>>        [cc] 1 files are up to date.
>>        [cc] 0 files to be recompiled from dependency analysis.
>>        [cc] 0 total files to be compiled.
>>        [cc] Starting link
>>        [cc] /usr/bin/ld: can't locate file for: -llog4cxx
>>        [cc] collect2: ld returned 1 exit status
>>     
>
> This is because the log4cxx shared library was incorrectly built with a
> .so extension, rather than .dylib.
> Simply rename it and re-invoke ant; alternatively apply this cpptasks patch
> <https://sourceforge.net/tracker/?func=detail&atid=416920&aid=1576280&group_id=36177>
>
> Here's the context diff for my build.xml:
>
> --- build.xml   (revision 463159)
> +++ build.xml   (working copy)
> @@ -187,6 +187,7 @@
>      <property name="project.type" value="msvc6"/>
>      <property name="project.dir" value="msvc"/>
>      <property name="compiler" value="msvc"/>
> +    <linker id="project.linker" name="${compiler}" />
>
>      <!-- Default value for logchar on windows -->
>      <property name="logchar" value="wchar_t"/>
> @@ -227,6 +228,7 @@
>  <target name="unix-init" depends="mac-init" if="is-unix">
>
>      <property name="compiler" value="gcc"/>
> +    <linker id="project.linker" name="g++" />
>
>      <property name="lib.prefix" value="lib"/>
>      <property name="lib.extension" value=".a"/>
> @@ -721,6 +723,7 @@
>                  objdir="${log4cxx.lib.dir}/log4cxx_obj"
>                  debug="${debug}"
>                  projectsOnly="${projectsOnly}">
> +       <linker refid="project.linker" />
>          <fileset dir="${src.dir}" includes="*.cpp"
> excludes="**/iconv_module.cpp"/>
>          <fileset dir="${include.dir}" includes="**/*.h"/>
>          <includepath path="${include.dir}"/>
> @@ -751,6 +754,7 @@
>                  objdir="${log4cxx.lib.dir}/${example.name}_obj"
>                  debug="${debug}"
>                  projectsOnly="${projectsOnly}">
> +       <linker refid="project.linker" />
>          <fileset dir="${example.src.dir}" includes="${example.includes}"/>
>          <includepath path="${include.dir}"/>
>          <includepath path="${apr.include.dir}"/>
> @@ -854,6 +858,7 @@
>                  objdir="${log4cxx.lib.dir}/shortsocketserver_obj"
>                  debug="${debug}"
>                  projectsOnly="${projectsOnly}">
> +       <linker refid="project.linker" />
>          <fileset dir="${tests.dir}/src">
>             <include name="shortsocketserver.cpp"/>
>             <include name="net/socketservertestcase.h"/>
> @@ -883,6 +888,7 @@
>                  objdir="${log4cxx.lib.dir}/log4cxx-test_obj"
>                  debug="${debug}"
>                  projectsOnly="${projectsOnly}">
> +       <linker refid="project.linker" />
>          <fileset dir="${tests.dir}/src" includes="**/*.cpp **/*.h">
>               <exclude name="shortsocketserver.cpp"/>
>          </fileset>
> @@ -921,6 +927,7 @@
>                  objdir="${log4cxx.lib.dir}/log4cxx-test_obj"
>                  debug="${debug}"
>                  projectsOnly="${projectsOnly}">
> +       <linker refid="project.linker" />
>          <fileset dir="${tests.dir}/src" includes="defaultinit/*.cpp
> main.cpp">
>               <exclude name="shortsocketserver.cpp"/>
>          </fileset>
>
> Derek
>
>   
>>
>> shai@rexee.com wrote:
>>     
>>> Hi
>>> I'm trying to build log4cxx on Mac version 10.4.7 but get the following
>>> error:
>>>
>>> ant -Dhas.wchar_t=0
>>>
>>> .....
>>> .....
>>> .....
>>>
>>>
>>> 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
>>>
>>>       
>
> ________________________________________________________________________
> The information transmitted is intended only for the person(s) or entity
> to which it is addressed and may contain confidential and/or privileged
> material. Any review, retransmission, dissemination or other use of, or
> taking of any action in reliance upon, this information by persons or
> entities other than the intended recipient is prohibited. If you
> received this in error, please contact the sender and delete the
> material from any computer.
>
> Paremus Limited.
> 107-111 Fleet Street, London EC4A 2AB.  Phone number +44 20 7936 9098
> ________________________________________________________________________
>
>
>
> ________________________________________________________________________
> This email has been scanned by both Message Labs and Paremus internal 
> systems for viruses and inappropriate attachments.  Email suspected of 
> carrying a virus payload or inappropriate attachment will not be 
> delivered to you, and the sender will receive an appropriate warning notice.
>
> Paremus Limited.
> 107-111 Fleet Street, London EC4A 2AB.  Phone number +44 20 7936 9098
> ________________________________________________________________________
>   

________________________________________________________________________
The information transmitted is intended only for the person(s) or entity
to which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you
received this in error, please contact the sender and delete the
material from any computer. 

Paremus Limited.
107-111 Fleet Street, London EC4A 2AB.  Phone number +44 20 7936 9098
________________________________________________________________________

Re: ant OSX build problem.

Posted by sh...@rexee.com.
Hi Derek,
This solution didn't work for me (it still used gcc to limk) however it
sent me on the right trail:

./autogen.sh
./configure
vi include/log4cxx/log4cxx.h

*********
change :
#define LOG4CXX_HAS_WCHAR_T 1
to:
#define LOG4CXX_HAS_WCHAR_T 0
*********

make
make install


and it worked :).

Thx for the help !!!

Shai



-----Original Message-----
From: "Derek Baum" <de...@paremus.com>
Sent: Thu, October 12, 2006 5:40 pm
To: "Log4CXX User" <lo...@logging.apache.org>
Subject: Re: ant OSX build problem.

There are two problems here:

   1. unwanted references to UnicodeHelper::encodeWide() etc
   2. reference to _Unwind_Resume

The first should be fixed with a clean build using -Dhas.wchar_t=0 that
re-runs configure.

The second is because we need to use the g++ linker.

I have re-investigated my previous post, and offer the following simpler
solution:

I have modified build.xml to add <linker name="g++" /> where it matters,
and I can then build from clean on my MacBook Pro, with only one manual
interaction:
> build-shortsocketserver:
>        [cc] Starting dependency analysis for 1 files.
>        [cc] 1 files are up to date.
>        [cc] 0 files to be recompiled from dependency analysis.
>        [cc] 0 total files to be compiled.
>        [cc] Starting link
>        [cc] /usr/bin/ld: can't locate file for: -llog4cxx
>        [cc] collect2: ld returned 1 exit status

This is because the log4cxx shared library was incorrectly built with a
.so extension, rather than .dylib.
Simply rename it and re-invoke ant; alternatively apply this cpptasks patch
<https://sourceforge.net/tracker/?func=detail&atid=416920&aid=1576280&group_id=36177>

Here's the context diff for my build.xml:

--- build.xml   (revision 463159)
+++ build.xml   (working copy)
@@ -187,6 +187,7 @@
     <property name="project.type" value="msvc6"/>
     <property name="project.dir" value="msvc"/>
     <property name="compiler" value="msvc"/>
+    <linker id="project.linker" name="${compiler}" />

     <!-- Default value for logchar on windows -->
     <property name="logchar" value="wchar_t"/>
@@ -227,6 +228,7 @@
 <target name="unix-init" depends="mac-init" if="is-unix">

     <property name="compiler" value="gcc"/>
+    <linker id="project.linker" name="g++" />

     <property name="lib.prefix" value="lib"/>
     <property name="lib.extension" value=".a"/>
@@ -721,6 +723,7 @@
                 objdir="${log4cxx.lib.dir}/log4cxx_obj"
                 debug="${debug}"
                 projectsOnly="${projectsOnly}">
+       <linker refid="project.linker" />
         <fileset dir="${src.dir}" includes="*.cpp"
excludes="**/iconv_module.cpp"/>
         <fileset dir="${include.dir}" includes="**/*.h"/>
         <includepath path="${include.dir}"/>
@@ -751,6 +754,7 @@
                 objdir="${log4cxx.lib.dir}/${example.name}_obj"
                 debug="${debug}"
                 projectsOnly="${projectsOnly}">
+       <linker refid="project.linker" />
         <fileset dir="${example.src.dir}" includes="${example.includes}"/>
         <includepath path="${include.dir}"/>
         <includepath path="${apr.include.dir}"/>
@@ -854,6 +858,7 @@
                 objdir="${log4cxx.lib.dir}/shortsocketserver_obj"
                 debug="${debug}"
                 projectsOnly="${projectsOnly}">
+       <linker refid="project.linker" />
         <fileset dir="${tests.dir}/src">
            <include name="shortsocketserver.cpp"/>
            <include name="net/socketservertestcase.h"/>
@@ -883,6 +888,7 @@
                 objdir="${log4cxx.lib.dir}/log4cxx-test_obj"
                 debug="${debug}"
                 projectsOnly="${projectsOnly}">
+       <linker refid="project.linker" />
         <fileset dir="${tests.dir}/src" includes="**/*.cpp **/*.h">
              <exclude name="shortsocketserver.cpp"/>
         </fileset>
@@ -921,6 +927,7 @@
                 objdir="${log4cxx.lib.dir}/log4cxx-test_obj"
                 debug="${debug}"
                 projectsOnly="${projectsOnly}">
+       <linker refid="project.linker" />
         <fileset dir="${tests.dir}/src" includes="defaultinit/*.cpp
main.cpp">
              <exclude name="shortsocketserver.cpp"/>
         </fileset>

Derek

>
>
>
> shai@rexee.com wrote:
>> Hi
>> I'm trying to build log4cxx on Mac version 10.4.7 but get the following
>> error:
>>
>> ant -Dhas.wchar_t=0
>>
>> .....
>> .....
>> .....
>>
>>
>> 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
>>

________________________________________________________________________
The information transmitted is intended only for the person(s) or entity
to which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you
received this in error, please contact the sender and delete the
material from any computer.

Paremus Limited.
107-111 Fleet Street, London EC4A 2AB.  Phone number +44 20 7936 9098
________________________________________________________________________



Re: ant OSX build problem.

Posted by Derek Baum <de...@paremus.com>.
There are two problems here:

   1. unwanted references to UnicodeHelper::encodeWide() etc
   2. reference to _Unwind_Resume

The first should be fixed with a clean build using -Dhas.wchar_t=0 that 
re-runs configure.

The second is because we need to use the g++ linker.

I have re-investigated my previous post, and offer the following simpler 
solution:

I have modified build.xml to add <linker name="g++" /> where it matters, 
and I can then build from clean on my MacBook Pro, with only one manual 
interaction:
> build-shortsocketserver:
>        [cc] Starting dependency analysis for 1 files.
>        [cc] 1 files are up to date.
>        [cc] 0 files to be recompiled from dependency analysis.
>        [cc] 0 total files to be compiled.
>        [cc] Starting link
>        [cc] /usr/bin/ld: can't locate file for: -llog4cxx
>        [cc] collect2: ld returned 1 exit status

This is because the log4cxx shared library was incorrectly built with a 
.so extension, rather than .dylib.
Simply rename it and re-invoke ant; alternatively apply this cpptasks patch
<https://sourceforge.net/tracker/?func=detail&atid=416920&aid=1576280&group_id=36177>

Here's the context diff for my build.xml:

--- build.xml   (revision 463159)
+++ build.xml   (working copy)
@@ -187,6 +187,7 @@
     <property name="project.type" value="msvc6"/>
     <property name="project.dir" value="msvc"/>
     <property name="compiler" value="msvc"/>
+    <linker id="project.linker" name="${compiler}" />
 
     <!-- Default value for logchar on windows -->
     <property name="logchar" value="wchar_t"/>
@@ -227,6 +228,7 @@
 <target name="unix-init" depends="mac-init" if="is-unix">
 
     <property name="compiler" value="gcc"/>
+    <linker id="project.linker" name="g++" />
 
     <property name="lib.prefix" value="lib"/>
     <property name="lib.extension" value=".a"/>
@@ -721,6 +723,7 @@
                 objdir="${log4cxx.lib.dir}/log4cxx_obj"
                 debug="${debug}"
                 projectsOnly="${projectsOnly}">
+       <linker refid="project.linker" />
         <fileset dir="${src.dir}" includes="*.cpp" 
excludes="**/iconv_module.cpp"/>
         <fileset dir="${include.dir}" includes="**/*.h"/>
         <includepath path="${include.dir}"/>
@@ -751,6 +754,7 @@
                 objdir="${log4cxx.lib.dir}/${example.name}_obj"
                 debug="${debug}"
                 projectsOnly="${projectsOnly}">
+       <linker refid="project.linker" />
         <fileset dir="${example.src.dir}" includes="${example.includes}"/>
         <includepath path="${include.dir}"/>
         <includepath path="${apr.include.dir}"/>
@@ -854,6 +858,7 @@
                 objdir="${log4cxx.lib.dir}/shortsocketserver_obj"
                 debug="${debug}"
                 projectsOnly="${projectsOnly}">
+       <linker refid="project.linker" />
         <fileset dir="${tests.dir}/src">
            <include name="shortsocketserver.cpp"/>
            <include name="net/socketservertestcase.h"/>
@@ -883,6 +888,7 @@
                 objdir="${log4cxx.lib.dir}/log4cxx-test_obj"
                 debug="${debug}"
                 projectsOnly="${projectsOnly}">
+       <linker refid="project.linker" />
         <fileset dir="${tests.dir}/src" includes="**/*.cpp **/*.h">
              <exclude name="shortsocketserver.cpp"/>
         </fileset>
@@ -921,6 +927,7 @@
                 objdir="${log4cxx.lib.dir}/log4cxx-test_obj"
                 debug="${debug}"
                 projectsOnly="${projectsOnly}">
+       <linker refid="project.linker" />
         <fileset dir="${tests.dir}/src" includes="defaultinit/*.cpp 
main.cpp">
              <exclude name="shortsocketserver.cpp"/>
         </fileset>

Derek

>
>
>
> shai@rexee.com wrote:
>> Hi
>> I'm trying to build log4cxx on Mac version 10.4.7 but get the following
>> error:
>>
>> ant -Dhas.wchar_t=0
>>
>> .....
>> .....
>> .....
>>
>>
>> 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
>>   

________________________________________________________________________
The information transmitted is intended only for the person(s) or entity
to which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you
received this in error, please contact the sender and delete the
material from any computer. 

Paremus Limited.
107-111 Fleet Street, London EC4A 2AB.  Phone number +44 20 7936 9098
________________________________________________________________________

Re: ant build problem.

Posted by Derek Baum <de...@paremus.com>.
This error is because gcc rather than g++ is being used for the link.

This is because the compiler setting on line 229 of build.xml takes 
precedence over the one on line 235:
>     227 <target name="unix-init" depends="mac-init" if="is-unix">
>     228
>     229     <property name="compiler" value="gcc"/>
>     230
>     231     <property name="lib.prefix" value="lib"/>
>     232     <property name="lib.extension" value=".a"/>
>     233     <property name="project.type" value="cbuilderx"/>
>     234     <property name="project.dir" value="cbx"/>
>     235     <property name="compiler" value="g++"/>
>     236     <property name="lib-suffix" value=""/>
However, simply removing the offending compiler setting on line 229, 
does not fix the problem.
"ant -v" shows why - cpptasks is still using gcc to link!
>        [cc] Starting link
>        [cc] gcc -g -prebind -dynamiclib -o liblog4cxx.dylib 
> log4cxx_obj/socket.o ...
>  -laprutil-1 -L/Users/derek/src/svn-log4cxx/build/debug/static -lapr-1 
> -liconv -lpthread -lstdc++
>        [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] /usr/bin/libtool: internal link edit command failed
I think this is a bug in cpptasks-1.04b which the following changes 
appear to fix:
> --- src/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java        
> 2006-05-19 13:48:38.000000000 +0100
> +++ 
> /Users/derek/src/cpptasks-1.0b4/src/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java        
> 2006-10-12 10:19:06.000000000 +0100
> @@ -234,6 +234,10 @@
>          return identifier;
>      }
>      public Linker getLinker(LinkType linkType) {
> +       // derek.baum@paremus.com - return gpp linker
> +       if (getCommand().equals("g++")) {
> +           return GppLinker.getInstance().getLinker(linkType);
> +       }
>          return GccLinker.getInstance().getLinker(linkType);
>      }
>      public int getMaximumCommandLength() {

> --- src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java   2006-05-19 
> 13:48:38.000000000 +0100
> +++ 
> /Users/derek/src/cpptasks-1.0b4/src/net/sf/antcontrib/cpptasks/gcc/GppLinker.java   
> 2006-10-12 10:21:10.000000000 +0100
> @@ -29,12 +29,13 @@
>   *
>   * @author Stephen M. Webb <st...@bregmasoft.com>
>   */
> +// derek.baum@paremus.com - use use "g++" for GppLinker
>  public class GppLinker extends AbstractLdLinker {
>      protected static final String[] discardFiles = new String[0];
>      protected static final String[] objFiles = new String[]{".o", 
> ".a", ".lib",             ".dll", ".so", ".sl"};
> -    private static final GppLinker dllLinker = new GppLinker("gcc", 
> objFiles,
> -            discardFiles, "lib", ".so", false, new GppLinker("gcc", 
> objFiles,
> +    private static final GppLinker dllLinker = new GppLinker("g++", 
> objFiles,
> +            discardFiles, "lib", ".so", false, new GppLinker("g++", 
> objFiles,
>                      discardFiles, "lib", ".so", true, null));
>      private final static String libPrefix = "libraries: =";
>      protected static final String[] libtoolObjFiles = new 
> String[]{".fo", ".a",@@ -42,11 +43,11 @@
>      private static String[] linkerOptions = new String[]{"-bundle", 
> "-dylib",
>              "-dynamic", "-dynamiclib", "-nostartfiles", "-nostdlib",
>              "-prebind", "-s", "-static", "-shared", "-symbolic", 
> "-Xlinker"};
> -    private static final GppLinker instance = new GppLinker("gcc", 
> objFiles,
> +    private static final GppLinker instance = new GppLinker("g++", 
> objFiles,
>              discardFiles, "", "", false, null);
> -    private static final GppLinker machDllLinker = new GppLinker("gcc",
> +    private static final GppLinker machDllLinker = new GppLinker("g++",
>              objFiles, discardFiles, "lib", ".dylib", false, null);
> -    private static final GppLinker machPluginLinker = new 
> GppLinker("gcc",
> +    private static final GppLinker machPluginLinker = new 
> GppLinker("g++",
>              objFiles, discardFiles, "lib", ".bundle", false, null);
>      public static GppLinker getInstance() {
>          return instance;

The next problem you'll encounter is:

> build-shortsocketserver:
>        [cc] Starting dependency analysis for 1 files.
>        [cc] 1 files are up to date.
>        [cc] 0 files to be recompiled from dependency analysis.
>        [cc] 0 total files to be compiled.
>        [cc] Starting link
>        [cc] /usr/bin/ld: can't locate file for: -llog4cxx
>        [cc] collect2: ld returned 1 exit status

This is because the log4cxx shared library was built with a .so 
extension, rather than .dylib.
I build log4cxx static, so I haven't fixed this yet (you can always 
manually rename it).

The build and all unit tests then complete successfully, however you're 
not quite done, because a clean build will now fail to compile apr:

> BUILD FAILED
> /Users/derek/src/svn-log4cxx/build.xml:553: The following error 
> occurred while executing this line:
> /Users/derek/src/svn-log4cxx/apr-build.xml:166: g++ failed with return 
> code 1
This is because the changes made to use the g++ linker, also cause g++ 
to be used to compile apr.
So I added an apr-compiler property into build.xml:

> --- build.xml   (revision 463159)
> +++ build.xml   (working copy)
> @@ -62,7 +62,7 @@
>  <property name="version" value="0.10.0"/>
>  <property name="rtti" value="false"/>
>  <property name="optimize" value="none"/>
> -<property name="lib.type" value="shared"/>
> +<property name="lib.type" value="static"/>
>  <property name="has.wchar_t" value="1"/>
>  
>  <property name="apache.mirror" value="http://archive.apache.org/dist"/>
> @@ -226,8 +226,9 @@
>  
>  <target name="unix-init" depends="mac-init" if="is-unix">
>  
> -    <property name="compiler" value="gcc"/>
> +    <!-- <property name="compiler" value="gcc"/> -->
>  
> +    <property name="apr-compiler" value="gcc"/>
>      <property name="lib.prefix" value="lib"/>
>      <property name="lib.extension" value=".a"/>
>      <property name="project.type" value="cbuilderx"/>
> @@ -542,6 +543,7 @@
>  </target>
>  
>  <target name="build-apr" depends="init" unless="apr-available">
> +    <property name="apr-compiler" value="${compiler}" />
>      <antcall target="untar-apr-src"/>
>  
>      <property name="apr.dir" location="${lib.dir}/apr-${apr.version}"/>
> @@ -552,7 +554,7 @@
>          <property name="version" value="${apr.version}"/>
>          <property name="debug" value="${debug}"/>
>          <property name="lib-suffix" value="${lib-suffix}"/>
> -        <property name="compiler" value="${compiler}"/>
> +        <property name="compiler" value="${apr-compiler}"/>
>          <property name="apr.dir" value="${apr.dir}"/>
>          <property name="apr.lib.dir" value="${apr.lib.dir}"/>
>          <property name="apr.lib.type" value="${apr.lib.type}"/>
> @@ -602,7 +604,7 @@
>          <property name="aprutil.dir" value="${aprutil.dir}"/>
>          <property name="debug" value="${debug}"/>
>          <property name="lib-suffix" value="${lib-suffix}"/>
> -        <property name="compiler" value="${compiler}"/>
> +        <property name="compiler" value="${apr-compiler}"/>
>          <property name="apr.include.dir" value="${apr.include.dir}"/>
>          <property name="apr.lib.dir" value="${apr.lib.dir}"/>
>          <property name="aprutil.lib.dir" value="${aprutil.lib.dir}"/>

If I'm missing an easier way to get this to compile on OSX I'd love to 
hear it

Derek


shai@rexee.com wrote:
> Hi
> I'm trying to build log4cxx on Mac version 10.4.7 but get the following
> error:
>
> ant -Dhas.wchar_t=0
>
> .....
> .....
> .....
>
>
> 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
>   

________________________________________________________________________
The information transmitted is intended only for the person(s) or entity
to which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you
received this in error, please contact the sender and delete the
material from any computer. 

Paremus Limited.
107-111 Fleet Street, London EC4A 2AB.  Phone number +44 20 7936 9098
________________________________________________________________________