How to cross-compile Git for ARM?

I just cross compiled to ARM for a more recent version of git, 2.28, and also ran into issues with tests that cannot run during a cross build.

Please note that I had previously built zlib for ARM and have it installed at /opt/arm-zlib, which appears in the paths below.

The incantation that worked for me, without touching sources, was:

./configure --build=i686-pc-linux-gnu --host=arm-linux NO_ICONV=true ac_cv_fread_reads_directories=true ac_cv_snprintf_returns_bogus=false

make LDFLAGS=-L/opt/arm-zlib/lib CFLAGS=-I/opt/arm-zlib/include NO_TCLTK=true NO_GETTEXT=true

NO_TCLTK disables the GUI, which I did not want.

The other definitions that I passed to configure and make were best guesses; I did not investigate what the best answer would be on my ARM platform.


The macro that's failing is ST_MTIME_NSEC in git-compat-util.h. This macro is controlled by the macros USE_NSEC, NO_NSEC and USE_ST_TIMESPEC, which are provided on the build commandline or by config.mak.uname, not by configure.

It should be that if no options are provided, git doesn't attempt to use nanosecond timestamps (or st_mtim) at all, but it looks like a bug slipped through.

Try make NO_NSEC=1 and see if that resolves your problem.