Opened 10 years ago

Last modified 10 years ago

#8256 new Bugs

Wave tests fail to build on OSX+GCC

Reported by: chris0@… Owned by: Hartmut Kaiser
Milestone: To Be Determined Component: wave
Version: Boost 1.53.0 Severity: Problem
Keywords: Cc:

Description

When attempting to build & run the Boost (1.53.0) wave tests on OSX 10.8.2 with GCC 4.2.1 the build fails at the link stage.

I built with:

cd boost_1_53_0/libs/wave/test/build
b2 variant=debug

The invocation:

g++-4.2 -o "../../../../../build/libs/wave/test/build/test_re2c_lexer.test/gcc-4.2/debug/link-static/runtime-link-static/threading-multi/test_re2c_lexer"  "../../../../../build/libs/wave/test/build/test_re2c_lexer.test/gcc-4.2/debug/link-static/runtime-link-static/threading-multi/test_re2c_lexer.o" "../../../../../build/libs/date_time/build/gcc-4.2/debug/link-static/runtime-link-static/threading-multi/libboost_date_time.a" "../../../../../build/libs/thread/build/gcc-4.2/debug/link-static/runtime-link-static/threading-multi/libboost_thread.a" "../../../../../build/libs/filesystem/build/gcc-4.2/debug/link-static/runtime-link-static/threading-multi/libboost_filesystem.a" "../../../../../build/libs/system/build/gcc-4.2/debug/link-static/runtime-link-static/threading-multi/libboost_system.a" "../../../../../build/libs/program_options/build/gcc-4.2/debug/link-static/runtime-link-static/threading-multi/libboost_program_options.a" "../../../../../build/libs/wave/build/gcc-4.2/debug/link-static/runtime-link-static/threading-multi/libboost_wave.a" "../../../../../build/libs/chrono/build/gcc-4.2/debug/link-static/runtime-link-static/threading-multi/libboost_chrono.a" "../../../../../build/libs/date_time/build/gcc-4.2/debug/link-static/runtime-link-static/threading-multi/libboost_date_time.a" "../../../../../build/libs/thread/build/gcc-4.2/debug/link-static/runtime-link-static/threading-multi/libboost_thread.a" "../../../../../build/libs/filesystem/build/gcc-4.2/debug/link-static/runtime-link-static/threading-multi/libboost_filesystem.a" "../../../../../build/libs/system/build/gcc-4.2/debug/link-static/runtime-link-static/threading-multi/libboost_system.a" -g -static -isysroot /Developer/SDKs/MacOSX10.5.sdk

produces the message:

ld_classic: can't locate file for: -lcrt0.o
collect2: ld returned 1 exit status

However, removing the '-static' flag fixes the problem.
(On OSX 'man ld' reports "-static Produces a mach-o file that does not use the dyld. Only used building the kernel.".)

The problem appears to be in boost_1_53_0/tools/build/v2/tools/gcc.jam. Due to these lines (767):

if [ os.name ] != HPUX
{
    toolset.flags gcc.link OPTIONS <runtime-link>static : -static ;
}

I was forced to change this, like so, to work around the problem:

#if [ os.name ] != HPUX && [ os.name ] != darwin # Doesn't work
#if [ os.name ] != HPUX && [ os.name ] != posix # Doesn't work
if [ os.name ] != HPUX
{
#    toolset.flags gcc.link OPTIONS <runtime-link>static : -static ;
# Had to comment out above line for OSX/darwin
}

Once built the tests all run successfully.

Change History (2)

comment:1 by Hartmut Kaiser, 10 years ago

Could you attach a patch fixing the problem, please. I'd gladly apply it to SVN.

in reply to:  1 comment:2 by chris0@…, 10 years ago

Replying to hkaiser:

Could you attach a patch fixing the problem, please. I'd gladly apply it to SVN.

Sorry, I don’t have one.

Neither of the following worked for me:

if [ os.name ] != HPUX && [ os.name ] != darwin
if [ os.name ] != HPUX && [ os.name ] != posix

Which was why I ended up simply commenting out the line.

If I understand the ECHO command then os.name appears to be empty on OSX.
In python 2.7.2 (the default on OSX 10.8.2) os.name returns 'posix' (not very helpful) but os.getenv("OSTYPE") returns 'darwin'.

However, I don’t understand boost.build well enough to know how to make use of that info.
[And I’d rather eat sand then waste more time trying to understand it.]

Note: See TracTickets for help on using tickets.