与LTO标志的gcc静态链接与boost文件系统失败

时间:2017-08-17 14:48:00

标签: c++ gcc boost static lto

提升版1.64
gcc版本6.4.1
Linux OpenSuse x64 42.2
Cmake 3.5.2

[链接,没有LTO]有效:

-std=gnu++11 -O2  -fopenmp -static /opt/lib64/libboost_filesystem.a /opt/lib64/libboost_system.a

[与LTO关联]不起作用:

-std=gnu++11 -O2  -fopenmp -flto=8 -static /opt/lib64/libboost_filesystem.a /opt/lib64/libboost_system.a

错误:

/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

- &GT;使用gcc 6.4.1-std=gnu++11标志来编译库 - &GT;与gcc 4.8.5一切正常

0 个答案:

没有答案