[C++-sig] RE: building boost.python problems

Rene Rivera grafik.list at redshift-software.com
Thu Mar 4 21:33:24 CET 2004


Sorry for the top post, deleted the original email too fast :-(

...

> Dear boost.pythoneers,
> first of all, sorry for the lengthish post (and more so, for the
> confidential blabla my employer attaches to all my outgoing mails).
> 
> I�m having a little trouble building even the simplest tutorial example,
> running python 2.3.3 on a solaris 2.6 system and boost.python 1.31.0:
> This is what I get when following the tutorial build instructions:
> 
>  hjoukl at dev-b .../boost_1_31_0 $ cd libs/python/example/tutorial/
> 0 hjoukl at dev-b .../tutorial $ export PYTHON_ROOT=/opt/tools
> 0 hjoukl at dev-b .../tutorial $ export PYTHON_VERSION=2.3
> 0 hjoukl at dev-b .../tutorial $ which gcc
> /opt/tools/bin/gcc
> 0 hjoukl at dev-b .../tutorial $ ./bjam
> ...found 1972 targets...
> ...updating 24 targets...
> gcc-C++-action
> ../../../../bin/boost/libs/python/build/libboost_python.so/gcc/debug/shared-linkable-true/numeric.o
> In file included from /opt/tools/include/python2.3/Python.h:8,
>                  from
> /data/projects/hjoukl/new_boost/boost_1_31_0/boost/python/detail/wrap_python.hpp:121,
>                  from
> /data/projects/hjoukl/new_boost/boost_1_31_0/boost/python/detail/prefix..hpp:13,
>                  from
> /data/projects/hjoukl/new_boost/boost_1_31_0/boost/python/numeric.hpp:9,
>                  from
> /data/projects/hjoukl/new_boost/boost_1_31_0/libs/python/build/../src/numeric.cpp:7:
> /opt/tools/include/python2.3/pyconfig.h:825: warning: `_FILE_OFFSET_BITS'
> redefined
> /usr/include/sys/feature_tests.h:80: warning: this is the location of the
> previous definition
> /opt/tools/bin/objcopy: unrecognized section flag `debug'
> /opt/tools/bin/objcopy: supported flags: alloc, load, readonly, code, data,
> rom, contents

I think all your problems stems from the objcopy not working. This prevents 
the linking from continuing and basically nothing getting produced. Two 
options to fix this are to: disable objcopy on Solaris, or figure out which 
section flag to use instead of "debug". But some explanation first... The 
objcopy is a workaround for the n^2 linking problems of GCC, it has the effect 
of disabling the problematic symbol reduction algorithm in the linker. For BPL 
this is important because of the large number of _debug_ symbols generated by 
the templates.

OK, so to the first option disabling the objcopy. Try this change...

Index: gcc-tools.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v1/gcc-tools.jam,v
retrieving revision 1.86
diff -u -2 -r1.86 gcc-tools.jam
--- gcc-tools.jam       26 Jan 2004 20:21:22 -0000      1.86
+++ gcc-tools.jam       4 Mar 2004 20:12:57 -0000
@@ -160,4 +160,5 @@
          {
          NO_GNU_LN = true ; # sun seems not to use the GNU linker with gcc
+        NO_OBJCOPY = true ;
          }
      case Linux :
@@ -350,6 +351,10 @@
  # used to manipulate the object files produced by GCC to
  # prevent the merging of debug symbols (which happens to be n^2 slow)
-flags gcc .OBJCOPY : [ GLOB $(GCC_BIN_DIRECTORY) $(PATH) : objcopy ] ;
-flags gcc OBJCOPY_FLAGS <debug-symbols>on : "--set-section-flags 
.debug_str=contents,debug" ;
+if ! $(NO_OBJCOPY)
+{
+    flags gcc .OBJCOPY : [ GLOB $(GCC_BIN_DIRECTORY) $(PATH) : objcopy ] ;
+    flags gcc OBJCOPY_FLAGS <debug-symbols>on : "--set-section-flags 
.debug_str=contents,debug" ;
+}
+
  if ! $(on-windows)
  {

For the second option, you could try using "--set-section-flags 
.debug_str=contents" (that is removing the ",debug"). Which this patch does...

Index: gcc-tools.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v1/gcc-tools.jam,v
retrieving revision 1.86
diff -u -1 -r1.86 gcc-tools.jam
--- gcc-tools.jam       26 Jan 2004 20:21:22 -0000      1.86
+++ gcc-tools.jam       4 Mar 2004 20:23:30 -0000
@@ -161,2 +161,3 @@
          NO_GNU_LN = true ; # sun seems not to use the GNU linker with gcc
+        flags gcc OBJCOPY_FLAGS <debug-symbols>on : "--set-section-flags 
.debug_str=contents" ;
          }
@@ -166,2 +167,3 @@
          SONAME = -Wl,-soname, ;
+        flags gcc OBJCOPY_FLAGS <debug-symbols>on : "--set-section-flags 
.debug_str=contents,debug" ;
          }
@@ -352,3 +354,3 @@
  flags gcc .OBJCOPY : [ GLOB $(GCC_BIN_DIRECTORY) $(PATH) : objcopy ] ;
-flags gcc OBJCOPY_FLAGS <debug-symbols>on : "--set-section-flags 
.debug_str=contents,debug" ;
+
  if ! $(on-windows)


And of course I'd like to know which one works so I can apply the change to 
future releases.


...HTH :-)

-- 
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org - grafik/redshift-software.com - 102708583/icq




More information about the Cplusplus-sig mailing list