Boost C++ Libraries: Ticket #8256: Wave tests fail to build on OSX+GCC https://svn.boost.org/trac10/ticket/8256 <p> When attempting to build &amp; 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. </p> <p> I built with:<br /> </p> <blockquote> <p> cd boost_1_53_0/libs/wave/test/build<br /> b2 variant=debug </p> </blockquote> <p> The invocation: </p> <pre class="wiki">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 </pre><p> produces the message: </p> <pre class="wiki">ld_classic: can't locate file for: -lcrt0.o collect2: ld returned 1 exit status </pre><p> However, removing the '-static' flag fixes the problem.<br /> (On OSX 'man ld' reports "-static Produces a mach-o file that does not use the dyld. Only used building the kernel.".) </p> <p> The problem appears to be in boost_1_53_0/tools/build/v2/tools/gcc.jam. Due to these lines (767): </p> <pre class="wiki">if [ os.name ] != HPUX { toolset.flags gcc.link OPTIONS &lt;runtime-link&gt;static : -static ; } </pre><p> I was forced to change this, like so, to work around the problem: </p> <pre class="wiki">#if [ os.name ] != HPUX &amp;&amp; [ os.name ] != darwin # Doesn't work #if [ os.name ] != HPUX &amp;&amp; [ os.name ] != posix # Doesn't work if [ os.name ] != HPUX { # toolset.flags gcc.link OPTIONS &lt;runtime-link&gt;static : -static ; # Had to comment out above line for OSX/darwin } </pre><p> Once built the tests all run successfully. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8256 Trac 1.4.3 Hartmut Kaiser Thu, 07 Mar 2013 13:24:19 GMT <link>https://svn.boost.org/trac10/ticket/8256#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8256#comment:1</guid> <description> <p> Could you attach a patch fixing the problem, please. I'd gladly apply it to SVN. </p> </description> <category>Ticket</category> </item> <item> <author>chris0@…</author> <pubDate>Thu, 07 Mar 2013 16:21:24 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8256#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8256#comment:2</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/8256#comment:1" title="Comment 1">hkaiser</a>: </p> <blockquote class="citation"> <p> Could you attach a patch fixing the problem, please. I'd gladly apply it to SVN. </p> </blockquote> <p> Sorry, I don’t have one. </p> <p> Neither of the following worked for me:<br /> </p> <blockquote> <p> if [ os.name ] != HPUX &amp;&amp; [ os.name ] != darwin<br /> if [ os.name ] != HPUX &amp;&amp; [ os.name ] != posix<br /> </p> </blockquote> <p> Which was why I ended up simply commenting out the line. </p> <p> If I understand the ECHO command then os.name appears to be empty on OSX.<br /> In python 2.7.2 (the default on OSX 10.8.2) <code>os.name</code> returns 'posix' (not very helpful) but <code>os.getenv("OSTYPE")</code> returns 'darwin'. </p> <p> However, I don’t understand boost.build well enough to know how to make use of that info.<br /> [And I’d rather eat sand then waste more time trying to understand it.] </p> </description> <category>Ticket</category> </item> </channel> </rss>