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

Re: Reducing git size by building libgit.so

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jun 12, 2019, 09:41 UTC
Message-ID
<87y32787k9.fsf@evledraar.gmail.com>
In-Reply-To
<21f1f334-755e-3283-d0da-ec0ab9231cfc@ucdenver.edu>
On Tue, Jun 11 2019, Elmar Pruesse wrote:
Show 10 quoted lines
> Hi!
>
> The total compiled size of libexec/git-core is currently somewhere
> around 30 MB. This is largely due to a number of binaries linking
> statically against libgit.a. For some folks, every byte counts. I
> meddled with the Makefile briefly to make it build and use a libgit.so
> instead, which dropped package size down to 5MB.
>
> Are there, beyond the ~20 ms in extra startup time and the slightly
> bigger hassle with DSO locations, reasons for the choice to link statically?

brian mentioned API stability. I'd be fine with having a *.so shipped with git. We'd document the API non-stability, and of course it's GPL so you can only link other GPL programs to it, but if people would be fine with still using it and very closely following git development as we break their API/ABI why not.

Have you looked at INSTALL_SYMLINKS & friends? I.e. maybe you're measuring size without accounting for most of the binaries being hardlinks to the same thing.

We still have some stand-alone binaries, but IIRC there's under 5 of those with INSTALL_SYMLINKS. We could probably also just make those built-ins to get the rest of the size benefits.

I.e. we'd just have one git binary, everything else symlinking to that, and we'd route to the right program by inspecting argv, which we mostly do already.

Previous: Johannes SixtNext: Duy Nguyen
Message 10 of 12 in “Reducing git size by building libgit.so”
  1. Elmar PruesseJun 11, 2019
  2. brian m. carlsonJun 11, 2019
  3. Duy NguyenJun 12, 2019
  4. Paul SmithJun 12, 2019
  5. Johannes SchindelinJun 13, 2019
  6. Paul SmithJun 13, 2019
  7. Junio C HamanoJun 13, 2019
  8. brian m. carlsonJun 12, 2019
  9. Johannes SixtJun 13, 2019
  10. Ævar Arnfjörð BjarmasonJun 12, 2019
  11. Duy NguyenJun 12, 2019
  12. SZEDER GáborJun 12, 2019

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.