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

Re: Reducing git size by building libgit.so

From
Paul Smith <paul@mad-scientist.net>
Date
Jun 12, 2019, 13:57 UTC
Message-ID
<9c488ce8c1e1e6d6d4c343b0b40c8a64c8147a7f.camel@mad-scientist.net>
In-Reply-To
<20190611234815.GB8616@genre.crustytoothpaste.net>
On Tue, 2019-06-11 at 23:48 +0000, brian m. carlson wrote:
> 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.

I don't have strong feeling about .so's although obviously less disk space used is always a good thing, everything else being equal.

However, the above concern isn't actually an issue. You can install the .so in a known location relative to the binaries, then link the binaries with an RPATH setting using $ORIGIN (or the equivalent on MacOS which does exist but I forget the name). On Windows, DLLs are installed in the same directory as the binary, typically.

Allowing relocatable binaries with .so dependencies without requiring LD_LIBRARY_PATH settings is a solved problem, to the best of my understanding.

One thing to think about is that runtime loading a .so can take some time if it has lots of public symbols. If someone really wanted to do this, the ideal thing would be to make all symbols hidden except those needed by the binary front-ends and have those be very small shells that just had a very limited number of entry points into the .so.

Maybe for git this doesn't matter but for some projects I've worked on the time to dlopen() a library was a blocking issue that the above procedure solved nicely.

Previous: Duy NguyenNext: Johannes Schindelin
Message 4 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.