c++ - 由于 Ubuntu 18.04 上的 libicu 链接错误,无法静态链接 boost-locale
问题描述
以下代码:
#include <boost/locale.hpp>
int main()
{
using namespace boost::locale;
generator gen;
}
使用以下标志构建:
g++ -static -static-libstdc++ -pthread main.cpp -lboost_locale -lboost_system -licuuc -licudata -licui18n
链接失败,出现以下错误:
(.text+0x16b8): undefined reference to `icu_60::CacheKeyBase::~CacheKeyBase()'
(.text+0x1c8d): undefined reference to `icu_60::UVector64::~UVector64()'
(.text+0x7dc): undefined reference to `icu_60::UCharsTrie::Iterator::~Iterator()'
...hundreds of other undefined symbols
...(the sample code also has boost linking errors, but let's ignore them, as they only appear in my attempt of reproduction; the real code I have issues with has only icu-related link errors)
我正在使用 Ubuntu 18.04,两者都libboost-all-dev
安装libicu-dev
在 Ubuntu 存储库中。我可能缺少使其链接在一起所需的一些琐碎的组件/标志/库,但我无法找到它。
解决方案
推荐阅读
- terraform - 在 terraform 中重命名时,有什么方法可以自动将对象从旧存储桶转移到新存储桶?
- loops - 空白、Null 或空字段的访问检查
- x86 - Phoenix BIOS 跳过 MBR 代码,ACTUAL BIOS 标准是什么?
- javascript - 从 HTML 字符串中获取 JSON 对象
- scala - Spark Scala:如何同时过滤 RDD 和更新计数器
- javascript - 在跟踪代码管理器中捕获 URL 的一部分
- function - 在 Julia 中查找具有许多参数的函数的单变量根
- sql - 使用另一个表中的值更新表中的列并获得意外的 NULL 值
- java - 与递归解决方案相比,为什么这个 MinDepth 级别的解决方案如此缓慢?
- sql - 如何选择在一个项目上一起工作时间最长的员工?