Compile git for 32-bit linux on shared hosting

时光怂恿深爱的人放手 提交于 2019-12-19 18:29:42

问题


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


回答1:


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.




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/4147730/compile-git-for-32-bit-linux-on-shared-hosting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!