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 Derek Baum <de...@paremus.com> on 2006/10/13 02:40:53 UTC

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>.
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
________________________________________________________________________