Boost C++ Libraries: Ticket #1559: bjam fails when built with gcc4.2 and strict-aliasing enabled https://svn.boost.org/trac10/ticket/1559 <p> Using gcc4.2.1 with boost-1.34.1 on x86 SUSE10.3, the bjam that I built segfaults when using it to build boost. A little bit of investigation leads me to believe that bjam may not be strict-aliasing correct. Specifically </p> <ul><li>a debug version of bjam does not exhibit this failure. (Note that the </li></ul><p> strict-alias analysis is not by default enabled at low optimization (-O0) levels.) </p> <ul><li>modifying the build.jam file to add the gcc --no-strict-aliasing option when </li></ul><p> building a release version bjam also results in a bjam which does not exhibit this failure. Specifically, change tools/jam/src/build.jam, in the section </p> <blockquote> <p> ## GCC 2.x, 3.x, 4.x toolset gcc gcc : "-o " : -D </p> <blockquote> <p> : -pedantic </p> </blockquote> </blockquote> <ul><li> [ opt --release : [ opt --symbols : -g : -s ] -O3 ] </li></ul><p> + [ opt --release : [ opt --symbols : -g : -s ] -O3 --no-strict-aliasing ] </p> <p> Note that this modification is not appropriate as is for actual merging into boost, because (I'm fairly sure) gcc2.x does not support the --[no-]strict-aliasing options. And of course, it might be preferable to figure out what is really wrong (probably in the bjam source code) and fix it there. That would likely require a much better understanding of the bjam source base than I presently have. </p> <ul><li>testing </li></ul><p> BOOST_SRC_ROOT := root of boost-1.34.1 source tree BOOST_BUILD_ROOT := root of boost-1.34.1 build tree </p> <ul><li>modify $BOOST_SRC_ROOT/tools/jam/src/build.sh, adding "--symbols" option to </li></ul><p> the invocation of ./bootstrap/jam0 at the end of the file, in order to get debugging symbols in the final bjam, so that we can get a useful backtrace. Note that if "--debug" added instead of "--symbols", the failure does not occur. </p> <p> cd $BOOST_SRC_ROOT/tools/jam/src ./build.sh cd $BOOST_SRC_ROOT gdb ./tools/jam/src/bin.linuxx86/bjam (gdb) run toolset=gcc \ </p> <blockquote> <p> variant=release \ threading=multi \ link=shared \ --build-dir=$BOOST_BUILD_ROOT \ --layout=system \ --without-graph \ --without-program_options \ --without-regex \ --without-signals \ --without-wave \ --without-python </p> </blockquote> <p> Works if bjam built with --no-strict-aliasing. Fails as follows if bjam built without that option. </p> <p> Program received signal SIGSEGV, Segmentation fault. 0x0804ca4c in hashitem (hp=0x80db298, data=0xbfa21734, enter=1) at hash.c:172 172 keyval = *b; (gdb) bt <a class="missing ticket">#0</a> 0x0804ca4c in hashitem (hp=0x80db298, data=0xbfa21734, enter=1) at hash.c:172 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1" title="#1: Bugs: boost.build causes ftjam to segfault (closed: Wont Fix)">#1</a> 0x080591a7 in file_info (filename=0x306000a &lt;Address 0x306000a out of bounds&gt;) at filesys.c:48 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2" title="#2: Bugs: list::size should be const (closed: fixed)">#2</a> 0x0805e2d3 in file_dirscan (dir=0x8072754 "/usr/share/boost-build", func=0x805a080 &lt;builtin_glob_back&gt;, closure=0xbfa21860) </p> <blockquote> <p> at fileunix.c:212 </p> </blockquote> <p> <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3" title="#3: Bugs: automatic conversion and overload proble (closed: fixed)">#3</a> 0x0805a7bc in builtin_glob (parse=0x80775b8, frame=0xbfa21a90) at builtins.c:655 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4" title="#4: Bugs: any_ptr in any library documentation? (closed: Fixed)">#4</a> 0x0804aa31 in evaluate_rule (rulename=0x0, frame=0xbfa21a90) at compile.c:1036 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5" title="#5: Bugs: shared_ptr and self-owning objects (closed: Fixed)">#5</a> 0x0804aff7 in compile_rule (parse=0x8083be0, frame=0xbfa22544) at compile.c:597 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6" title="#6: Bugs: tie in utility.hpp and tuple.hpp clash. (closed: Duplicate)">#6</a> 0x08049884 in compile_append (parse=0x8083c10, frame=0xbfa22544) at compile.c:127 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7" title="#7: Bugs: g++ 2.96 requires NO_STRINGSTREAM (closed: Fixed)">#7</a> 0x0804b146 in compile_local (parse=0x8085e90, frame=0xbfa22544) at compile.c:481 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/8" title="#8: Bugs: prop in undirected graph + out_edges (closed: Works For Me)">#8</a> 0x0804b1c4 in compile_local (parse=0x8085ec0, frame=0xbfa22544) at compile.c:505 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/9" title="#9: Bugs: config_info ambiguity error (closed: Invalid)">#9</a> 0x080532de in parse_file (f=0x806718b "+", frame=0xbfa22544) at parse.c:139 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/10" title="#10: Bugs: allyourbase.jam file is bad. (closed: Out of Date)">#10</a> 0x0804e5f5 in main (argc=14, argv=0xbfa22664, arg_environ=Cannot access memory at address 0x3060012 ) at jam.c:453 </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1559 Trac 1.4.3 René Rivera Mon, 07 Jan 2008 21:51:11 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/1559#comment:1 https://svn.boost.org/trac10/ticket/1559#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">duplicate</span> </li> </ul> <p> Duplicate of <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/977" title="#977: Bugs: bjam crashes when compiled with gcc 4.2 (closed: fixed)">#977</a>. </p> Ticket