【问题标题】:How do I build a statically linked executable with scala-native?如何使用 scala-native 构建静态链接的可执行文件?
【发布时间】:2018-04-17 14:17:18
【问题描述】:

我想使用 Scala Native 编写一个程序,但它必须在带有非常旧的 glibc 的 linux 主机(centos 6.5)上运行。所以我想将该程序部署为静态链接的可执行文件,例如就像 golang 一样。

如何使用 scala-native 构建静态链接的可执行文件?可能吗?如果是,我该怎么做?如果没有,为什么不呢?

【问题讨论】:

  • 即使我也在寻找这个问题的答案。如果您有这个问题的答案,请将其添加到答案部分。这会很有帮助。

标签: scala static-linking scala-native


【解决方案1】:

sbt 选项nativeLinkingOptions 采用Seq[String] 的额外参数,这些参数在链接期间逐字传递给clang。

在快速测试中将以下内容添加到项目构建设置中对我有用:

nativeLinkingOptions += "-static"

【讨论】:

    猜你喜欢
    • 2013-06-24
    • 1970-01-01
    • 1970-01-01
    • 2016-01-11
    • 1970-01-01
    • 2011-06-07
    • 2015-10-24
    • 2012-04-19
    • 1970-01-01
    相关资源
    最近更新 更多