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

Re: Reducing git size by building libgit.so

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Jun 11, 2019, 23:48 UTC
Message-ID
<20190611234815.GB8616@genre.crustytoothpaste.net>
In-Reply-To
<21f1f334-755e-3283-d0da-ec0ab9231cfc@ucdenver.edu>
On 2019-06-11 at 19:52:18, 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?

I think the reason is that libgit is not API stable and we definitely don't want people linking against it. Before libgit2 existed, projects like cgit built their own libgit and it required pinning to a specific version of Git.

Also, some people install Git into their home directories, and a shared library means that they'll have to use LD_LIBRARY_PATH (or equivalent) to run Git.

Finally, we have support for a runtime relocatable Git which can be run out of any path and still automatically find its dependent binaries. That won't work with a shared library.

So if we did allow for building a shared library, it would have to be an option that defaulted to off, I think.

-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204
Previous: Elmar PruesseNext: Duy Nguyen
Message 2 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.