Opened 5 years ago

Last modified 5 years ago

#13166 new Bugs

gcc static linking with LTO flag with boost filesystem fails

Reported by: mettbest@… Owned by: Beman Dawes
Milestone: To Be Determined Component: filesystem
Version: Boost 1.64.0 Severity: Problem
Keywords: lto gcc linking Cc: mika.fischer@…

Description

boost version 1.64
gcc version 6.4.1
Linux OpenSuse x64 42.2
Cmake 3.5.2

[linking, no LTO] works:
-std=gnu++11 -O2 -fopenmp -static /opt/lib64/libboost_filesystem.a /opt/lib64/libboost_system.a

[linking, with LTO] does not work:
-std=gnu++11 -O2 -fopenmp -flto=8 -static /opt/lib64/libboost_filesystem.a /opt/lib64/libboost_system.a

error:

/opt/lib64/libboost_filesystem.a(operations.o): In function `boost::filesystem::detail::is_empty(boost::filesystem::path const&, boost::system::error_code*)':
operations.cpp:(.text+0x536a): undefined reference to `vtable for boost::detail::sp_counted_impl_p<boost::filesystem::detail::dir_itr_imp>'
/opt/lib64/libboost_filesystem.a(operations.o): In function `(anonymous namespace)::remove_all_aux(boost::filesystem::path const&, boost::filesystem::file_type, boost::system::error_code*)':
operations.cpp:(.text+0x699d): undefined reference to `vtable for boost::detail::sp_counted_impl_p<boost::filesystem::detail::dir_itr_imp>'
operations.cpp:(.text+0x6add): undefined reference to `vtable for boost::detail::sp_counted_impl_p<boost::filesystem::detail::dir_itr_imp>'
collect2: error: ld returned 1 exit status
CMakeFiles/zebr.dir/build.make:137: recipe for target 'zebr' failed

Change History (2)

comment:1 by anonymous, 5 years ago

It happens also with GCC 6.2.0 but not with GCC 4.8.5

comment:2 by Mika Fischer <mika.fischer@…>, 5 years ago

Cc: mika.fischer@… added
Note: See TracTickets for help on using tickets.