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

Re: Is detecting endianness at compile-time unworkable?

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Aug 1, 2018, 07:16 UTC
Message-ID
<87pnz2tv38.fsf@evledraar.gmail.com>
In-Reply-To
<xmqq600wkc4i.fsf@gitster-ct.c.googlers.com>
On Mon, Jul 30 2018, Junio C Hamano wrote:
Show 8 quoted lines
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
>> And, as an aside, the reason we can't easily make it better ourselves is
>> because the build process for git.git doesn't have a facility to run
>> code to detect this type of stuff (the configure script is always
>> optional). So we can't just run this test ourselves.
>
> It won't help those who cross-compile anyway.

I was being unclear, what I mean by having "a hard dependency on some way of doing checks via compiled code in our build system" is that we would do some equivalent of this:

    diff --git a/Makefile b/Makefile
    index 08e5c54549..b021b6e1b6 100644
    --- a/Makefile
    +++ b/Makefile
    @@ -1107,7 +1107,7 @@ DC_SHA1_SUBMODULE = auto
     endif
     include config.mak.uname
    --include config.mak.autogen
    +include config.mak.autogen
     -include config.mak
     ifdef DEVELOPER

And document that in order to build git you needed to do './configure && make' instead of just 'make', and we'd error out by default if config.mak.autogen wasn't there.

Now obviously that would need some sort of escape hatch. I.e. you could invoke 'make' like this:

    make CONFIGURE_MAK_AUTOGEN_FILE=some-file

That's how you would do cross-compilation, you'd arrange to run './configure' on some system, save the output, and ferry over this 'some-file' to where you're building git, or you would manually prepare a file that had all the settings we'd expect to have been set already set.

Now, whether we do this with autoconf or not is just an implementation detail. Looking at this some more I think since we already use the $(shell) construct we could just have some 'configure-detect' Makefile target which would compile various test programs, and we'd use their output to set various settings, a sort of home-grown autoconf (because people are bound to have objections to a hard dependency on it...).

Show 5 quoted lines
> I thought we declared "we make a reasonable effort to guess the target
> endianness from the system header by inspecting usual macros, but will
> not aim to cover every system on the planet---instead there is a knob
> to tweak it for those on exotic platforms" last time we discussed
> this?

Yes, but I think it's worth re-visiting that decision, which was made with the constraints that we don't have a build system that can do checks via compiled code, so we need this hack in the first place instead of things Just Working.

And as I pointed out in the linked E-Mail this also impacts us in other ways, and will cause other issues in the future, so it's worth thinking about if this is the right path to take.

Previous: Eric WongNext: Michael Felt
Message 16 of 25 in “git broken for AIX somewhere between 2.13.2 and 2.13.3”
  1. MichaelJul 29, 2018
  2. brian m. carlsonJul 29, 2018
  3. MichaelJul 29, 2018
  4. Ævar Arnfjörð BjarmasonJul 29, 2018
  5. Andreas SchwabJul 29, 2018
  6. MichaelJul 30, 2018
  7. MichaelJul 29, 2018
  8. brian m. carlsonJul 29, 2018
  9. MichaelJul 29, 2018
  10. Is detecting endianness at compile-time unworkable?Ævar Arnfjörð Bjarmason, Jul 30, 2018
  11. Junio C HamanoJul 30, 2018
  12. Junio C HamanoJul 30, 2018
  13. Daniel ShumowJul 30, 2018
  14. Michael FeltJul 31, 2018
  15. Eric WongAug 1, 2018
  16. Ævar Arnfjörð BjarmasonAug 1, 2018
  17. Michael FeltJul 31, 2018
  18. Ævar Arnfjörð BjarmasonAug 1, 2018
  19. sha1dc: update from upstreamÆvar Arnfjörð Bjarmason, Aug 2, 2018
  20. Michael Felt (aixtools)Aug 2, 2018
  21. Stefan BellerAug 2, 2018
  22. Michael FeltJul 31, 2018
  23. Michael FeltJul 31, 2018
  24. Ævar Arnfjörð BjarmasonJul 31, 2018
  25. MichaelJul 31, 2018

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.