Boost logo

Boost :

Subject: [boost] My non-system GCC doesn't link programs under b2
From: Daryle Walker (darylew_at_[hidden])
Date: 2012-01-25 18:09:33

I'm still using my 2002 PowerPC/G4 Mac with Mac OS X 10.4 (Tiger).  I loaded GCC 4.6 (with multiprocessor options) onto it with MacPorts.  I have a "user-config.jam" in my home folder like:
//===using xsltproc        : /opt/local/bin/xsltproc        ;
using boostbook        : /opt/local/share/xsl/docbook-xsl/        : /opt/local/share/xml/docbook/4.2        ;
using doxygen ;
using darwin ;using gcc : 4.6 : g++-mp-4.6 : <cxxflags>-std=c++0x <cxxflags>-pthread ;//===
I've tested GCC-4.6 (with C++11 active) with a "Hello World!" program, so I know it works with single-file programs.  I wanted to test "base_from_member" (part of Boost.Utility) and it worked with the default "darwin" target.  (I ran "b2" in "BOOST_ROOT/libs/utility/test".)  However, running "b2 toolset=gcc-4.6" ended in errors like:
//===common.mkdir ../../../bin.v2/libs/utility/test/base_from_member_test.test/gcc-4.6common.mkdir ../../../bin.v2/libs/utility/test/base_from_member_test.test/gcc-4.6/debuggcc.compile.c++ ../../../bin.v2/libs/utility/test/base_from_member_test.test/gcc-4.6/debug/base_from_member_test.o../base_from_member_test.cpp: In constructor 'bad_class::bad_class()':../base_from_member_test.cpp:129:21: warning: 'bad_class::x_' will be initialized after [-Wreorder]../base_from_member_test.cpp:510:39: warning:   base 'base_class' [-Wreorder]../base_from_member_test.cpp:507:1: warning:   when initialized here [-Wreorder] ../../../bin.v2/libs/utility/test/base_from_member_test.test/gcc-4.6/debug/base_from_member_test/usr/bin/ld: unknown flag: --start-groupcollect2: ld returned 1 exit status
    "g++-mp-4.6"    -o "../../../bin.v2/libs/utility/test/base_from_member_test.test/gcc-4.6/debug/base_from_member_test" -Wl,--start-group "../../../bin.v2/libs/utility/test/base_from_member_test.test/gcc-4.6/debug/base_from_member_test.o"  -Wl,-Bstatic  -Wl,-Bdynamic  -Wl,--end-group -g 

...failed ../../../bin.v2/libs/utility/test/base_from_member_test.test/gcc-4.6/debug/base_from_member_test......skipped <p../../../bin.v2/libs/utility/test/base_from_member_test.test/gcc-4.6/debug> for lack of <p../../../bin.v2/libs/utility/test/base_from_member_test.test/gcc-4.6/debug>base_from_member_test......failed updating 20 targets......skipped 40 targets......updated 126 targets...//===
GCC-4.6 compiles each C++ file into an object file just fine.  The problem happens when linking various object and library files into an executable; whichever linker gets called (the system linker?) chokes on a  "--start-group" flag.  When I first started writing this message, I thought the problem was GCC-4.6 being too new for the linker, but maybe we have to tweak something in our Jam files instead.  (Could it be the fact I downloaded the multiprocessor variant of GCC-4.6?)
BTW, how do I specify that I only want to try out the base_from_member test without trying to build all other tests in the directory?
Daryle W.

Boost list run by bdawes at, gregod at, cpdaniel at, john at