haskell - Haskell 中的静态可执行文件取决于 text-icu
问题描述
我正在尝试创建一个依赖于text-icu的静态可执行文件。
这是缩小的示例https://github.com/4e6/text-icu-static-example
为了启用静态链接,我在这里icu
使用--enable-static
标志构建:
# http://userguide.icu-project.org/packaging#TOC-Link-to-ICU-statically
icu-static = pkgs.icu.overrideAttrs (attrs: {
dontDisableStatic = true;
configureFlags = (attrs.configureFlags or "") + " --enable-static";
outputs = attrs.outputs ++ [ "static" ];
postInstall = ''
mkdir -p $static/lib
mv -v lib/*.a $static/lib
'' + (attrs.postInstall or "");
});
并在此处添加以下 ghc 选项:
configureFlags = [
"--ghc-option=-optl=-static"
"--ghc-option=-optl=-pthread"
"--ghc-option=-optl=-L${pkgs.glibc.static}/lib"
"--ghc-option=-optl=-L${pkgs.gmp6.override { withStatic = true; }}/lib"
"--ghc-option=-optl=-L${icu-static.static}/lib"
];
结果nix-build .
,我收到了很多关于未定义引用的错误,请参阅nix-build.log:
/nix/store/2h1il2pyfh20kc5rh7vnp5a564alxr21-icu4c-59.1-static/lib/libicui18n.a(regexcmp.ao):(.text+0x7805): more undefined references to `icu_59::UVector64::setElementAt(long, int)' follow
/nix/store/2h1il2pyfh20kc5rh7vnp5a564alxr21-icu4c-59.1-static/lib/libicui18n.a(regexcmp.ao): In function `icu_59::RegexCompile::compile(UText*, UParseError&, UErrorCode&)':
(.text+0x8355): undefined reference to `__cxa_throw_bad_array_new_length'
/nix/store/2h1il2pyfh20kc5rh7vnp5a564alxr21-icu4c-59.1-static/lib/libicui18n.a(regexcmp.ao):(.data.rel.ro._ZTIN6icu_5912RegexCompileE[_ZTIN6icu_5912RegexCompileE]+0x0): undefined reference to `vtable for __cxxabiv1::__si_class_type_info'
collect2: error: ld returned 1 exit status
`cc' failed in phase `Linker'. (Exit code: 1)
此设置适用于其他库,但无法使用text-icu
. 关于我做错了什么的任何想法?
链接到github 问题
解决方案
推荐阅读
- python - Celery - 异常重新引发信息
- channel - grpc-java,方法可用的字段名:ManagedChannelBuilder.defaultServiceConfig()
- python - 如何将弹出消息从 django 中的应用程序发送到同一 django 项目中的帐户应用程序
- qt - 将鼠标悬停在地图上时突出显示国家/地区
- docker - maven:来自 gitlab-runner 的最新图像,带有 docker 执行器“无法连接到 gitlab 连接被拒绝”,使用 docker-compose
- android - Android Data Binding 根据不同状态不同图标
- python-3.x - Django 休息框架工作;组合来自不同模型的数据不起作用
- reactjs - 我的 Redux 状态没有更新——即使旧的和新的状态不相等
- python - 如何在 AI 平台训练中使用 pandas-gbq 和 BigQuery Storage API?
- jenkins - 如何在 Jenkins 中获取 Jenkins 旧版本