git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: FR: Provide Out-Of-Tree Building; Provide Cross-Compile Parameters

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Jul 8, 2024, 19:08 UTC
Message-ID
<CAPig+cTaH+TiD9Ut5Q_BPinqdAirW51J56R_tUTSnL=XGzxvfg@mail.gmail.com>
In-Reply-To
<CALaQ_hr2Hzri6y4KwYOPmGzfvM8EjJpddvLL7CQ=d3H4QLCzJw@mail.gmail.com>
[please avoid top-posting on this mailing list(*)]
On Mon, Jul 8, 2024 at 2:33 PM Nathan Royce <nroycea+kernel@gmail.com> wrote:
Show 10 quoted lines
> Well goodness me, seems I spoke too soon.
> I found the that zlib was required (looking for "zlib.h"), so I built
> that first and that too wasn't all that cross-compile friendly.
> I saw "CHOST" is used, and was surprised that it didn't seem to need
> anything to link against from the target sysroot, so that turned out
> better than I thought it would.
>
> I then used `configure` prefixed with
> the`CFLAGS="--sysroot=<pathToSysroot>"`, along with `HOST_CPU=<tuple>`
> for `make`, and it worked out fine.

The Git build system determines some aspects of the environment dynamically, so if you were cross-compiling for a different architecture, it is possible that this did not enable every feature of Git. For instance, if you look inside `config.mak.uname` and `Makefile`, you will find a number of invocations of $(shell ...) which pluck some host system information at build time rather than at configuration time.

> Before moving it to my device, I just nspawned/chrooted into it and
> `git --help` worked. So looks good and easy steps. Of course, it'll
> depend on whether or not a git function using zlib also passes (hoping
> zlib actually built fine without needing any outside linkage).

A successful `git --help` is one small victory. Running the full test suite on the cross-compiled project will give a more complete picture of whether or not the effort was successful.

> I'd still suggest and prefer that git (and zlib) follows what others
> have settled on doing to be cross-compile-friendly.

I can't speak for the zlib project, but for this to happen in Git, someone with an interest in seeing such an outcome will need to submit patches.

[*] https://lore.kernel.org/all/YQK0JuI1w1zsEHeC@kroah.com/
Previous: Nathan RoyceNext: Junio C Hamano
Message 4 of 8 in “FR: Provide Out-Of-Tree Building; Provide Cross-Compile Parameters”
  1. Nathan RoyceJul 8, 2024
  2. Eric SunshineJul 8, 2024
  3. Nathan RoyceJul 8, 2024
  4. Eric SunshineJul 8, 2024
  5. Junio C HamanoJul 8, 2024
  6. Đoàn Trần Công DanhJul 10, 2024
  7. Nathan RoyceJul 10, 2024
  8. Junio C HamanoJul 10, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.