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

Re: Cross-compiling git (was: [PATCHv2] add Android support)

From
Jeff King <peff@peff.net>
Date
May 23, 2011, 14:30 UTC
Message-ID
<20110523143040.GB17743@sigill.intra.peff.net>
In-Reply-To
<m3k4dhzynr.fsf_-_@localhost.localdomain>
On Mon, May 23, 2011 at 12:04:44AM -0700, Jakub Narebski wrote:
Show 7 quoted lines
> > So I think we are probably stuck either with the user setting an ANDROID
> > meta-flag that sets the other flags appropriately, or leaving it up to
> > the user to provide a sane config.mak.
> 
> By the way, how well Git supports cross-compiling (which from the
> thread is necessity to generate binaries for Android)?  `uname -a`
> trick works only when compiling on same machine.

It should work fine if you set the make variables appropriately for the target platform. But I've never tried it. Didn't msysgit people cross-compile for a while (or maybe still do)?

> ./configure supports --host and --build options, but I don't know if
> it pass them down to make somehow.  ANDROID=YesPlease seems wasteful:
> what about setting HOST or MACHINE, or even uname_* variables, or just
> using Autoconf's `host` (in the form of CPU-VENDOR-OS)?

I know very little about autoconf internals, but what would CPU-VENDOR-OS look like? Your CPU is probably some arm variant, though it will vary from device to device. Your kernel is Linux. The special steps in this case are about some weird userspace issues. So the equivalent would be more like finding a Linux distro that ships a crappy libc. I guess that is what the "vendor" slot is for?

But even if you somehow tell autoconf or the Makefile "yes, this is android", you are still going to need to manually specify the set of knobs that should be tweaked in that case. Whether you call it "ANDROID=YesPlease" or some other form.

-Peff
Previous: Jakub NarebskiNext: Jakub Narebski
Message 9 of 13 in “[PATCHv2] add Android support”
  1. Rafael GieschkeMay 16, 2011
  2. Junio C HamanoMay 19, 2011
  3. Rafael GieschkeMay 19, 2011
  4. Jeff KingMay 19, 2011
  5. Rafael GieschkeMay 19, 2011
  6. Jeff KingMay 19, 2011
  7. Rafael GieschkeMay 19, 2011
  8. Cross-compiling git (was: [PATCHv2] add Android support)Jakub Narebski, May 23, 2011
  9. Jeff KingMay 23, 2011
  10. Jakub NarebskiMay 25, 2011
  11. Jeff KingMay 25, 2011
  12. Junio C HamanoMay 19, 2011
  13. Tor ArntsenMay 23, 2011

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.