Boost C++ Libraries: Ticket #9766: boost >= 1.54 failes to compile with gcc-4.8.2 and LTO enabled https://svn.boost.org/trac10/ticket/9766 <p> I tried to compile boost on my gentoo systemd and it failes while linking libboost_log.so with the following error: </p> <p> gcc.link.dll bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/libboost_log.so.1.55.0 </p> <blockquote> <p> "x86_64-pc-linux-gnu-g++" -o "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/libboost_log.so.1.55.0" -Wl,-h -Wl,libboost_log.so.1.55.0 -shared -Wl,--start-group "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/dump_ssse3.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/dump_avx2.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/attribute_name.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/attribute_set.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/attribute_value_set.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/code_conversion.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/core.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/record_ostream.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/severity_level.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/global_logger_storage.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/named_scope.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/process_name.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/process_id.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/thread_id.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/timer.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/exceptions.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/default_attribute_names.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/default_sink.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/text_ostream_backend.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/text_file_backend.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/syslog_backend.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/thread_specific.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/once_block.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/timestamp.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/threadsafe_queue.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/event.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/trivial.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/spirit_encoding.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/format_parser.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/date_time_format_parser.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/named_scope_format_parser.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/unhandled_exception_count.o" "bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/dump.o" "bin.v2/libs/thread/build/gcc-4.8/gentoorelease/pch-off/threading-multi/libboost_thread.so.1.55.0" "bin.v2/libs/filesystem/build/gcc-4.8/gentoorelease/pch-off/threading-multi/libboost_filesystem.so.1.55.0" "bin.v2/libs/date_time/build/gcc-4.8/gentoorelease/pch-off/threading-multi/libboost_date_time.so.1.55.0" "bin.v2/libs/chrono/build/gcc-4.8/gentoorelease/pch-off/threading-multi/libboost_chrono.so.1.55.0" "bin.v2/libs/system/build/gcc-4.8/gentoorelease/pch-off/threading-multi/libboost_system.so.1.55.0" -Wl,-Bstatic -Wl,-Bdynamic -lrt -Wl,--end-group -Wl,-O1 -Wl,--as-needed -march=native -O2 -pipe -ggdb -floop-interchange -floop-strip-mine -floop-block -ftree-loop-distribution -fira-loop-pressure -ftree-vectorize -ftree-loop-linear -flto=5 -fuse-linker-plugin -Wl,-znow -Wl,--sort-common -Wl,--hash-style=gnu -Wl,--enable-new-dtags -pthread -lrt -lpthread </p> </blockquote> <p> /usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include/avx2intrin.h: In function ‘_ZN5boost3log11v2_mt_posix3aux20dump_data_wchar_avx2EPKvmRSt13basic_ostreamIwSt11char_traitsIwEE.part.4’: /usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include/avx2intrin.h:737:62: error: ‘<span class="underline">builtin_ia32_psrlwi256’ needs isa option -m32 </span></p> <blockquote> <p> return (<span class="underline">m256i)</span>builtin_ia32_psrlwi256 ((<span class="underline">v16hi)</span>A, <span class="underline">B); </span></p> </blockquote> <p> [snip a lot more of these isa option errors] /usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/include/avx2intrin.h:585:23: error: ‘<span class="underline">builtin_ia32_pshufb256’ needs isa option -m32 </span></p> <blockquote> <p> (<span class="underline">v32qi)</span>Y); </p> <blockquote> <p> <sup> </sup></p> </blockquote> </blockquote> <p> make: /home/misc/gentoo/tmp/portage/dev-libs/boost-1.55.0-<a class="changeset" href="https://svn.boost.org/trac10/changeset/1/temp/ccobKVrF" title="Import core sources for SVNmanger 0.38 ">r1/temp/ccobKVrF</a>.ltrans0.ltrans.o Error 1 make: Waiting for unfinished jobs.... lto-wrapper: make returned 2 exit status /usr/lib/gcc/x86_64-pc-linux-gnu/4.8.2/../../../../x86_64-pc-linux-gnu/bin/ld: fatal error: lto-wrapper failed collect2: error: ld returned 1 exit status ...skipped &lt;pstage/lib&gt;libboost_log.so.1.55.0 for lack of &lt;pbin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi&gt;libboost_log.so.1.55.0... gcc.compile.c++ bin.v2/libs/log/build/gcc-4.8/gentoorelease/log-api-unix/pch-off/threading-multi/filter_parser.o </p> <p> I've attached the complete gentoo build.log. Here are some additional details about my system environment: </p> <p> Portage 2.2.8-<a class="changeset" href="https://svn.boost.org/trac10/changeset/1" title="Import core sources for SVNmanger 0.38 ">r1</a> (default/linux/amd64/13.0, gcc-4.8.2, glibc-2.18-<a class="changeset" href="https://svn.boost.org/trac10/changeset/1" title="Import core sources for SVNmanger 0.38 ">r1</a>, 3.13.5-HAUIHAU x86_64) ================================================================= System uname: Linux-3.13.5-HAUIHAU-x86_64-Intel-R-_Core-TM-_i7-2620M_CPU_@_2.70GHz-with-gentoo-2.2 KiB Mem: 7974844 total, 2094852 free KiB Swap: 8388604 total, 7620020 free Timestamp of tree: Mon, 10 Mar 2014 10:30:01 +0000 ld GNU gold (GNU Binutils 2.24) 1.11 ccache version 3.1.9 [disabled] app-shells/bash: 4.2_p45-<a class="changeset" href="https://svn.boost.org/trac10/changeset/1" title="Import core sources for SVNmanger 0.38 ">r1</a> dev-java/java-config: 2.2.0 dev-lang/python: 2.7.6, 3.3.4 dev-util/ccache: 3.1.9-<a class="changeset" href="https://svn.boost.org/trac10/changeset/3" title="Tweak disclaimer text">r3</a> dev-util/cmake: 2.8.12.2 dev-util/pkgconfig: 0.28 sys-apps/baselayout: 2.2 sys-apps/sandbox: 2.6-<a class="changeset" href="https://svn.boost.org/trac10/changeset/1" title="Import core sources for SVNmanger 0.38 ">r1</a> sys-devel/autoconf: 2.13, 2.69 sys-devel/automake: 1.11.6, 1.14.1 sys-devel/binutils: 2.24-<a class="changeset" href="https://svn.boost.org/trac10/changeset/2" title="Add Boost Disclaimer">r2</a> sys-devel/gcc: 4.8.2-<a class="changeset" href="https://svn.boost.org/trac10/changeset/1" title="Import core sources for SVNmanger 0.38 ">r1</a> sys-devel/gcc-config: 1.8 sys-devel/libtool: 2.4.2 sys-devel/make: 4.0-<a class="changeset" href="https://svn.boost.org/trac10/changeset/1" title="Import core sources for SVNmanger 0.38 ">r1</a> sys-kernel/linux-headers: 3.13 (virtual/os-headers) sys-libs/glibc: 2.18-<a class="changeset" href="https://svn.boost.org/trac10/changeset/1" title="Import core sources for SVNmanger 0.38 ">r1</a> </p> <p> CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=native -O2 -pipe -ggdb -floop-interchange -floop-strip-mine -floop-block -ftree-loop-distribution -fira-loop-pressure -ftree-vectorize -ftree-loop-linear -flto=5 -fuse-linker-plugin" CHOST="x86_64-pc-linux-gnu" CXXFLAGS="-march=native -O2 -pipe -ggdb -floop-interchange -floop-strip-mine -floop-block -ftree-loop-distribution -fira-loop-pressure -ftree-vectorize -ftree-loop-linear -flto=5 -fuse-linker-plugin" LDFLAGS="-Wl,-O1 -Wl,--as-needed -march=native -O2 -pipe -ggdb -floop-interchange -floop-strip-mine -floop-block -ftree-loop-distribution -fira-loop-pressure -ftree-vectorize -ftree-loop-linear -flto=5 -fuse-linker-plugin -Wl,-znow -Wl,--sort-common -Wl,--hash-style=gnu -Wl,--enable-new-dtags" </p> <p> If you need further information, please let me know. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9766 Trac 1.4.3 steffen@… Mon, 10 Mar 2014 13:01:23 GMT attachment set https://svn.boost.org/trac10/ticket/9766 https://svn.boost.org/trac10/ticket/9766 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-1.55_build.log.bz2</span> </li> </ul> <p> boost 1.55 build log </p> Ticket steffen@… Wed, 23 Apr 2014 10:47:27 GMT <link>https://svn.boost.org/trac10/ticket/9766#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9766#comment:1</guid> <description> <p> No one ever looked at this issue? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Wed, 23 Apr 2014 10:59:48 GMT</pubDate> <title>component changed; owner set https://svn.boost.org/trac10/ticket/9766#comment:2 https://svn.boost.org/trac10/ticket/9766#comment:2 <ul> <li><strong>owner</strong> set to <span class="trac-author">Andrey Semashev</span> </li> <li><strong>component</strong> <span class="trac-field-old">Building Boost</span> → <span class="trac-field-new">log</span> </li> </ul> <p> Try moving it to Log library </p> Ticket Andrey Semashev Wed, 23 Apr 2014 11:46:42 GMT <link>https://svn.boost.org/trac10/ticket/9766#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9766#comment:3</guid> <description> <p> Can you provide the b2 or bjam command line so I could reproduce the error? BTW, I compile with gcc 4.8.2 on Kubuntu without problems. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 23 Apr 2014 12:22:58 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9766#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9766#comment:4</guid> <description> <p> Hi, </p> <p> this is the command, Gentoo's ebuild used to build boost: </p> <pre class="wiki">b2 gentoorelease -j5 -q -d+2 --user-config=/home/misc/gentoo/tmp/portage/dev-libs/boost-1.55.0-r1/work/boost_1_55_0/user-config.jam -sICU_PATH=/usr --without-mpi --without-python --without-context --without-coroutine pch=off --boost-build=/usr/share/boost-build --prefix="/home/misc/gentoo/tmp/portage/dev-libs/boost-1.55.0-r1/image/usr" --layout=system threading=multi link=shared </pre><p> and this is the content of user-config.jam: </p> <pre class="wiki">using gcc : 4.8 : x86_64-pc-linux-gnu-g++ : &lt;cflags&gt;"-march=native -O2 -pipe -ggdb -floop-interchange -floop-strip-mine -floop-block -ftree-loop-distribution -fira-loop-pressure -ftree-vectorize -ftree-loop-linear -flto=5 -fuse-linker-plugin" &lt;cxxflags&gt;"-march=native -O2 -pipe -ggdb -floop-interchange -floop-strip-mine -floop-block -ftree-loop-distribution -fira-loop-pressure -ftree-vectorize -ftree-loop-linear -flto=5 -fuse-linker-plugin -std=gnu++98" &lt;linkflags&gt;"-Wl,-O1 -Wl,--as-needed -march=native -O2 -pipe -ggdb -floop-interchange -floop-strip-mine -floop-block -ftree-loop-distribution -fira-loop-pressure -ftree-vectorize -ftree-loop-linear -flto=5 -fuse-linker-plugin -Wl,-znow -Wl,--sort-common -Wl,--hash-style=gnu -Wl,--enable-new-dtags" ; </pre><p> Please let me know if you need further information. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 23 Apr 2014 12:41:10 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9766#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9766#comment:5</guid> <description> <p> I can see you're using LTO. That may be the source of the problem. There are several source files in Boost.Log which are compiled with different compiler flags. In particular, it's dump_avx2.cpp, which contains the failing function you seen in the compiler errors. To verify that try disabling LTO and rebuilding the library. </p> <p> I have no experience with GCC LTO, but from what I know I can't use all the flags on the linking stage since that would make the whole resulting binary AVX2-only instead of only just the optimized part in dump_avx2.cpp. I could try adding attributes to the particular functions in dump_avx2.cpp so that they contain the required compiler options. But really, this has to be done by the compiler since I already pass the options on the compilation stage. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 23 Apr 2014 13:09:34 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9766#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9766#comment:6</guid> <description> <p> Have you been able to reproduce the failure with my flags? Disabling LTO fixes the issue, sorry I forgot to mention that in my initial bug report. I guess this bug should be reported upstream to the GCC devs? Can you do this or do I have to deal with it? I'm wondering why I haven't found any other guys around who fail to compile boost &gt;=1.54 with LTO enabled. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Wed, 23 Apr 2014 18:33:43 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9766#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9766#comment:7</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/9766#comment:6" title="Comment 6">anonymous</a>: </p> <blockquote class="citation"> <p> Have you been able to reproduce the failure with my flags? </p> </blockquote> <p> No, I have tried to compile git develop branch with your flags and it succeeded without errors. As I said, I have gcc 4.8.2 on Ubuntu. I'm not sure how to verify that LTO was actually used. The object files (*.o) have the __gnu_lto_v1 symbol, if that's an indication. OTOH, objdump produces disassembly for these files, which I find surprising. </p> <blockquote class="citation"> <p> Disabling LTO fixes the issue, sorry I forgot to mention that in my initial bug report. I guess this bug should be reported upstream to the GCC devs? Can you do this or do I have to deal with it? I'm wondering why I haven't found any other guys around who fail to compile boost &gt;=1.54 with LTO enabled. </p> </blockquote> <p> I suppose, LTO is not used very often yet in Linux world. Since I cannot reproduce the failure, it's probably easier for you to communicate with gcc devs (or package maintainers in Gentoo) regarding this issue. </p> </description> <category>Ticket</category> </item> <item> <author>steffen@…</author> <pubDate>Fri, 25 Apr 2014 12:29:25 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9766#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9766#comment:8</guid> <description> <p> I tried to compile it under OpenSUSE 13.1 (gcc 4.8.1) on another system (also Core i7 Sandy Bridge) and it failed there with the same error. </p> <p> Then I tried to compile it on my older computer under Ubuntu 14.04 (AMd Athlon X2 4600), and it failed with an internal compiler error, I guess due to the lack of AVX support in that old CPU: </p> <pre class="wiki">libs/log/src/dump_avx2.cpp: In function ‘_ZN5boost3log11v2_mt_posix3aux20dump_data_wchar_avx2EPKvmRSt13basic_ostreamIwSt11char_traitsIwEE.part.4’: libs/log/src/dump_avx2.cpp:260:6: warning: AVX vector return without AVX enabled changes the ABI [-Wpsabi] void dump_data_wchar_avx2(const void* data, std::size_t size, std::basic_ostream&lt; wchar_t &gt;&amp; strm) ^ libs/log/src/dump_avx2.cpp:260:6: internal compiler error: in convert_move, at expr.c:316 Please submit a full bug report, with preprocessed source if appropriate. See &lt;file:///usr/share/doc/gcc-4.8/README.Bugs&gt; for instructions. </pre><p> Did you use my user-config.jam? Then bjam should have called g++ with "-flto=5" option. You can see the compiler options in the output lines of bjam. I'll file a bug report for this to GCC and give you the id. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Fri, 25 Apr 2014 12:45:33 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9766#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9766#comment:9</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/9766#comment:8" title="Comment 8">steffen@…</a>: </p> <blockquote class="citation"> <p> Then I tried to compile it on my older computer under Ubuntu 14.04 (AMd Athlon X2 4600), and it failed with an internal compiler error, I guess due to the lack of AVX support in that old CPU: </p> </blockquote> <p> Host CPU features should not influence the code generation, unless you use -march=native. BTW, you shouldn't really use -march and similar flags, b2 has instruction-set property, which has the same meaning but may also be picked up by Boost libraries build scripts. </p> <blockquote class="citation"> <p> Did you use my user-config.jam? </p> </blockquote> <p> Yes, I only had to change the compiler executable name and correct directories and similar stuff in the command line. I'll try experimenting more though. </p> <blockquote class="citation"> <p> Then bjam should have called g++ with "-flto=5" option. You can see the compiler options in the output lines of bjam. </p> </blockquote> <p> Yes, all options were there, both at compilation and linking stages. I wonder if it could be related to -march=native flag since I tried this on a Haswell machine. I'll try on another machine when I have time. </p> <blockquote class="citation"> <p> I'll file a bug report for this to GCC and give you the id. </p> </blockquote> <p> Thanks, I appreciate that. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Sat, 26 Apr 2014 17:35:52 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9766#comment:10 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9766#comment:10</guid> <description> <p> After all my experiments I still fail to reproduce the error. I even tried to replay the compilation with the command lines from your build log. I've discovered one nasty detail though - the resulting binaries in my case are AVX2-only. I guess my compiler somehow applies the flags for dump_avx2.cpp to all object files. Needless to say that if that's how LTO is supposed to work, it cannot be used with projects such as Boost.Log. </p> <p> However, I have a patch I'd like to test. Basically, it adds attributes to all SSE/AVX functions so that the compiler knows what CPU they are targeted for. I'd appreciate if you could perform the following experiment: </p> <ol><li>Apply the patch from this ticket. </li><li>Perform a clean rebuild of Boost. </li><li>If Boost.Log compiles this time, run the following command: </li></ol><pre class="wiki">objdump -dS libboost_log.so.1.55.0 &gt;libboost_log.so.1.55.0.S </pre><p> (add the directory name to the compiled library, if necessary). </p> <ol start="4"><li>Compress libboost_log.so.1.55.0.S and attach it to this ticket. </li></ol><p> The libboost_log.so.1.55.0.S is the disassembled library; I'd like to inspect the resulting code for whether it's AVX2-only or not. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Sat, 26 Apr 2014 17:36:41 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/9766 https://svn.boost.org/trac10/ticket/9766 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">add_target_attribs.patch</span> </li> </ul> <p> The patch adds target CPU attributes to the optimized functions. </p> Ticket steffen@… Tue, 29 Apr 2014 16:24:38 GMT <link>https://svn.boost.org/trac10/ticket/9766#comment:11 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9766#comment:11</guid> <description> <p> I have reported it upstream. Here is the link: gcc.gnu.org/bugzilla/show_bug.cgi?id=60964. Seems like your suggestion was really close with -march=native (I used this as it was suggested in wiki.gentoo.org/wiki/CFLAGS). They asked for a test case. May you provide one based on your log library? </p> <p> I also tried to compile with -march=corei7-avx and that solved the issue for me. I may also try to compile with your patch. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Tue, 29 Apr 2014 18:33:48 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9766#comment:12 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9766#comment:12</guid> <description> <blockquote class="citation"> <p> May you provide one based on your log library? </p> </blockquote> <p> I'm still not able to reproduce the failure, sorry. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 30 Apr 2014 10:16:36 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9766#comment:13 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9766#comment:13</guid> <description> <p> Could you please give some detail about your used platform? Which Ubuntu release/GCC version are you using? This bug is only present in GCC 4.8 and newer. I've now checked also Fedora 20 and had the same issue as under Gentoo and current OpenSUSE. </p> <p> I'll try to compile boost with your patch and -march=native next week as I'm on business trip until next week. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Wed, 30 Apr 2014 10:20:54 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9766#comment:14 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9766#comment:14</guid> <description> <p> I'm on Kubuntu 13.10 x86_64, gcc -v gives: </p> <pre class="wiki">gcc -v Using built-in specs. COLLECT_GCC=/usr/bin/gcc-4.8.real COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.8.1-10ubuntu9' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu9) </pre><p> It's the standard compiler installed from the Ubuntu packages. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Sat, 03 May 2014 10:05:07 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/9766#comment:15 https://svn.boost.org/trac10/ticket/9766#comment:15 <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">fixed</span> </li> </ul> <p> I managed to reproduce the error, after I upgraded to Kubuntu 14.04 and tried to compile Boost with -march=native on a Sandy Bridge machine. The patch I attached earlier does not help. For now I have no further ideas how to work it around and make -march=native work, the issue has to be fixed in gcc. </p> <p> Considering that even when the compilation succeeds (i.e. -march=native is not used) the resulting binaries are incorrect, I'll document gcc LTO as unsupported. </p> Ticket Andrey Semashev Sat, 03 May 2014 12:31:19 GMT <link>https://svn.boost.org/trac10/ticket/9766#comment:16 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9766#comment:16</guid> <description> <p> BTW, I reported another LTO bug: <a class="ext-link" href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61043"><span class="icon">​</span>http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61043</a> </p> </description> <category>Ticket</category> </item> <item> <author>steve@…</author> <pubDate>Sat, 13 Feb 2016 23:19:43 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9766#comment:17 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9766#comment:17</guid> <description> <p> This isn't a GCC bug. Use of -march is expected to produce code suitable for *only* the target CPU architecture. Usage of -march or other -m flags to enable features from within build-systems is incorrect usage of the compiler. The build-system should detect which features are available on the configured compiler, not the other way around. Generic code should be generated with with a specific minimum requirement in mind, but should always be limited to whatever the build toolchain is constrained by. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Sat, 13 Feb 2016 23:25:07 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9766#comment:18 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9766#comment:18</guid> <description> <p> Read the discussion and the referred bug. The architecture-specific flags are passed for compilation of the files, which are executed only when the relevant CPU features are present in run time. The compiler bug is that it produces binary code as if the flags were specified for all files rather than those few special ones. </p> </description> <category>Ticket</category> </item> <item> <author>steve@…</author> <pubDate>Sun, 14 Feb 2016 10:04:22 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9766#comment:19 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9766#comment:19</guid> <description> <p> My point is though that even when generating generic code with run-time detection it's inappropriate to override -march. If generic code is required -march can be used to specify a generic target (such as x86_64, or i686) and then use feature -m switches. If building not building generic code, it should generally be constrained to the specific set of enabled features, and certainly shouldn't override the per target code generation optimization. The GCC bug recommends using <span class="underline">attribute</span>(target("...")) which allows specific functions to use features not necessarily available for the given -march, and which doesn't fail for LTO, and actually produces the desired behaviour. See: <a class="ext-link" href="https://gcc.gnu.org/onlinedocs/gcc/Function-Specific-Option-Pragmas.html"><span class="icon">​</span>https://gcc.gnu.org/onlinedocs/gcc/Function-Specific-Option-Pragmas.html</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Sun, 14 Feb 2016 10:21:33 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9766#comment:20 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9766#comment:20</guid> <description> <p> Specifying different compiler options for different translation units is a common practice, I'm not sure what you're arguing for. </p> <p> The bug report also mentions that the attributes don't work up until gcc 4.9. And the bug is fixed proper in 5.1. I do not think mangling the code just for 4.9 is worth the effort. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Sun, 14 Feb 2016 11:10:59 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9766#comment:21 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9766#comment:21</guid> <description> <p> Actually, I'm using gcc-5.3, and it still causes build failure on amdfam10 (AMD Phenom II). I'm arguing that overriding -march isn't one of the compiler options that should be set for different translation units. This is something that often crops up in Gentoo, where -march is set system-wide, and then gets overridden by upstream build-systems not following best practises. There are plenty of patches in Portage to work around these issues. </p> <p> The simplest solution is to just make the optimized functions individually build-time configurable, that way a generic distributor build can chose a suitable generic -march, along with enabling run-time CPU optimizations. Conversely, a targeted build can just include support and optimization as appropriate. </p> <p> I brought up the function attributes because that's the solution GCC has implemented to support this type of situation as was discussed in the GCC bug report, but as you say, it's only good for GCC&gt;4.9. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Sun, 14 Feb 2016 18:52:43 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9766#comment:22 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9766#comment:22</guid> <description> <blockquote class="citation"> <p> Actually, I'm using gcc-5.3, and it still causes build failure on amdfam10 (AMD Phenom II). </p> </blockquote> <p> Could you provide more details on the failure? Is the error reproducible with the latest vanilla Boost release? </p> <blockquote class="citation"> <p> The simplest solution is to just make the optimized functions individually build-time configurable </p> </blockquote> <p> That is too difficult to maintain. </p> </description> <category>Ticket</category> </item> </channel> </rss>