Boost C++ Libraries: Ticket #13166: gcc static linking with LTO flag with boost filesystem fails https://svn.boost.org/trac10/ticket/13166 <p> boost version 1.64 <br /> gcc version 6.4.1 <br /> Linux <a class="missing wiki">OpenSuse</a> x64 42.2 <br /> Cmake 3.5.2 <br /> <br /> <strong>[linking, no LTO] works:</strong> <br /> -std=gnu++11 -O2 -fopenmp -static /opt/lib64/libboost_filesystem.a /opt/lib64/libboost_system.a <br /> </p> <p> <strong>[linking, with LTO] does not work:</strong> <br /> -std=gnu++11 -O2 -fopenmp -flto=8 -static /opt/lib64/libboost_filesystem.a /opt/lib64/libboost_system.a </p> <p> <strong>error:</strong> </p> <pre class="wiki">/opt/lib64/libboost_filesystem.a(operations.o): In function `boost::filesystem::detail::is_empty(boost::filesystem::path const&amp;, boost::system::error_code*)': operations.cpp:(.text+0x536a): undefined reference to `vtable for boost::detail::sp_counted_impl_p&lt;boost::filesystem::detail::dir_itr_imp&gt;' /opt/lib64/libboost_filesystem.a(operations.o): In function `(anonymous namespace)::remove_all_aux(boost::filesystem::path const&amp;, boost::filesystem::file_type, boost::system::error_code*)': operations.cpp:(.text+0x699d): undefined reference to `vtable for boost::detail::sp_counted_impl_p&lt;boost::filesystem::detail::dir_itr_imp&gt;' operations.cpp:(.text+0x6add): undefined reference to `vtable for boost::detail::sp_counted_impl_p&lt;boost::filesystem::detail::dir_itr_imp&gt;' collect2: error: ld returned 1 exit status CMakeFiles/zebr.dir/build.make:137: recipe for target 'zebr' failed </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13166 Trac 1.4.3 anonymous Thu, 17 Aug 2017 15:11:19 GMT <link>https://svn.boost.org/trac10/ticket/13166#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/13166#comment:1</guid> <description> <p> It happens also with GCC 6.2.0 but not with GCC 4.8.5 </p> </description> <category>Ticket</category> </item> <item> <author>Mika Fischer <mika.fischer@…></author> <pubDate>Wed, 18 Apr 2018 08:46:33 GMT</pubDate> <title>cc set https://svn.boost.org/trac10/ticket/13166#comment:2 https://svn.boost.org/trac10/ticket/13166#comment:2 <ul> <li><strong>cc</strong> <span class="trac-author">mika.fischer@…</span> added </li> </ul> Ticket