在共享主机上为 32 位 Linux 编译 git

发布于 2024-10-01 06:07:24 字数 316 浏览 1 评论 0原文

我需要在廉价的共享主机上设置 Git 客户端,并使用一个不知名的 32 位 Linux 发行版。 GCC 不可用,所以我无法在服务器上编译它。我确实有两台其他 64 位 Linux 服务器和一台 OSX 笔记本电脑,我可以尝试在其上交叉编译二进制文件。但我似乎无法让它正确编译;当我将二进制文件推送到 32 位服务器时,它说它无法运行可执行文件。从其他来源看来,我需要将“-arch i386”和/或“-m32”添加到 ./configure 或 make 命令才能适用于 32 位,但我想我没有正确使用它们。有人知道如何做到这一点,或者知道在哪里可以找到通用的 32 位 Git 二进制文件吗?

谢谢

I need to set up the Git client on a cheap shared hosting, with a no-name 32-bit Linux distribution. GCC isn't available so I can't compile it on the server. I do have at my disposal 2 other 64-bit Linux servers and an OSX laptop which I could try to cross-compile a binary on. But I can't seem to get it to compile correctly; when I push the binaries to the 32-bit server it says it can't run the executable. It looks from other sources like I need to add "-arch i386" and/or "-m32" to the ./configure or make commands to work for 32-bit, but I guess I'm not using them correctly. Anyone know how to do this, or alternately, where to find a universal 32-bit Git binary?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

怎言笑 2024-10-08 06:07:24

最好的选择是尝试将 git 编译为静态二进制文件。您的二进制文件可能具有不同的共享库版本(甚至未安装所有依赖项)。

此链接:

如何为没有编译器的主机构建 git

提供有关如何将 git 构建为静态二进制文件的信息。

stackoverflow 答案 提供有关如何从 64 位主机交叉编译它的信息。

希望这有帮助。

Your best bet is trying to compile git as a static binary. Your binary probably have different shared libraries versions (or even, not all dependencies installed).

This link:

How to build git for a host with no compiler

Provides information on how to build git as a static binary.

This stackoverflow answer provides information on how to cross compile it from a 64 bit host.

Hope this helps.

秋风の叶未落 2024-10-08 06:07:24

老实说,如果是我,我会在虚拟机中启动 32 位 Linux 并在那里进行编译。

Honestly, if it were me, I would just fire up 32-bit Linux in a VM and compile there.

坏尐絯 2024-10-08 06:07:24

OS X 不会工作 - 它旨在使用 OS X 系统调用接口生成 Mach-O 二进制文件,而不是 Linux ELF 二进制文件。

在 CLFAGS 上使用 -m32 会有帮助,但最重要的是,也使用 -static。静态二进制文件更加可移植。

如果失败,请具体说明失败的原因。

OS X isn't going to work - its geared to produce Mach-O binaries with the OS X syscall interface, not Linux ELF binaries.

Using -m32 on the CLFAGS is going to help, but most importantly, use -static as well. Static binaries are much more portable.

If that fails, please provide exactly how it failed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文