Leon0824 / rimeime

Automatically exported from code.google.com/p/rimeime
1 stars 0 forks source link

boost 也使用 c++11 编译的话, librime 链接出错 #586

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
系统的 boost 如果使用 c++11 编译安装的话, librime 
会在最后链接的时候出错。
错误提示为

../lib/librime.so.1.1.0:对‘boost::filesystem::detail::copy_file(boost::file
system::path const&, boost::filesystem::path const&, 
boost::filesystem::copy_option::enum_type, 
boost::system::error_code*)’未定义的引用。

如果 boost 使用 c++98 模式编译的就没问题。

gcc-4.8.2
binutils-2.24
boost-1.55

Original issue reported on code.google.com by microcai...@gmail.com on 12 Apr 2014 at 4:56

GoogleCodeExporter commented 9 years ago
找到原因了, 是 librime 使用了 BOOST_NO_SCOPED_ENUMS 
这个是在 boost 本身是 c++98 模式编译,而 librime 
使用 c++11 编译才需要使用的一个 workarround 。

Original comment by microcai...@gmail.com on 12 Apr 2014 at 5:17

GoogleCodeExporter commented 9 years ago
可以在 cmake 里检测一下 boost 是否是在 c++11 
模式下编译的,是的话再启用那个。

Original comment by microcai...@gmail.com on 12 Apr 2014 at 5:58

GoogleCodeExporter commented 9 years ago
Which version of librime?

BOOST_NO_SCOPED_ENUMS is deprecated.

My code at master has
#define BOOST_NO_CXX11_SCOPED_ENUMS

Original comment by chen....@gmail.com on 14 May 2014 at 8:33

GoogleCodeExporter commented 9 years ago
有沒有找到好的解法?

Original comment by chen....@gmail.com on 23 Jun 2014 at 9:44

GoogleCodeExporter commented 9 years ago
Try this fix:
https://github.com/lotem/librime/commit/c705ccb0fea88747c080d14ae6c26268639b9762

Just pass -DBOOST_USE_CXX11=ON to cmake in the command line.

Original comment by chen....@gmail.com on 23 Jun 2014 at 12:58