【发布时间】:2020-09-03 13:16:43
【问题描述】:
我的代码中有需要 libc 的依赖项。在 Ubuntu 20.04 (glibc 2.31) 上构建 (cargo build --release) 时,生成的可执行文件无法在 CentOS 7 (glibc 2.17) 上运行。它会抛出一个错误,说它需要 GLIBC 2.18。
在 CentOS 7 上构建相同代码时,生成的可执行文件可在 CentOS 7 和 Ubuntu 20.04 上运行。
有没有办法控制在 Ubuntu 20.04 上构建这个版本需要哪个 GLIBC 版本?
【问题讨论】:
-
这并不容易。你可以尝试类似“build-anywhere”github.com/theopolis/build-anywhere(不是我的代码)。