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

Re: [PATCH/RFC] Build a shared / renamed / "stable" version of the library?

From
A Large Angry SCM <gitzilla@gmail.com>
Date
Sep 16, 2005, 14:41 UTC
Message-ID
<432AD981.2080400@gmail.com>
In-Reply-To
<pan.2005.09.16.12.37.14.736570@smurf.noris.de>
Matthias Urlichs wrote:
Show 35 quoted lines
> Build (and use) libgit.so instead of libgit.a.
> 
> --- 
> 
> I have written this nice Python extension that gives me fast access to
> git objects. Python extensions are built as shared libraries. Linking
> shared and non-shared objects into one library results in a couple of
> linker warnings on i386; other architectures are far less forgiving.
> 
> So the best choice I seem to have is to build a shared libgit.so.
> 
> Unfortunately, libgit doesn't have nice symbol names. I dunno how you
> all would feel about a big patch which renames absoutely every foo()
> function in libgit to be git_foo() instead (or one that #ifdef's them)...
> so I'm taking the easy way out, and use versioned symbols. That should
> prevent symbol name conflicts with other libraries.
> 
> I've had to redefine usage(), error() and die() to git_*(), because
> they're just too conflict-ish. "error" is even a weak symbol in libc. :-/
> 
> To summarize, the choices seem to be:
> - don't do anything => no script language extensions, need to fork off
>   a git program for absolutely everything. Bah.
> - build libgit.a with -fpic'd objects => doesn't work on all
>   architectures.
> - build libgit.shared.a and use that for building script language
>   extensions => works now, but may cause name conflicts down the road.
> - build a "normal" libgit.so => ditto on the name conflicts.
> - build a libgit.so with symbol versions => no name conflicts expected,
>   but works only with the GNU linker.
> - rename all library functions and globals => quite a bit of work,
>   and more typing down the road.
> - add "#define foo git_foo" to all library functions => ugly.
> 
> Opinions?

Renaming all the library functions and globals is the way to go if the long term view is that Git functionality will be desired in other projects. This is my view.

However, it's not clear (to me, anyway) that libgit is structured (other than naming) in a way that's usable for non core-git tools; git-daemon was discussed recently. Some research needs to be done to answer this question.

Previous: Matthias UrlichsNext: Junio C Hamano
Message 2 of 7 in “Build a shared / renamed / "stable" version of the library?”
  1. Build a shared / renamed / "stable" version of the library?Matthias Urlichs, Sep 16, 2005
  2. A Large Angry SCMSep 16, 2005
  3. Junio C HamanoSep 16, 2005
  4. Chuck LeverSep 16, 2005
  5. Junio C HamanoSep 16, 2005
  6. Chuck LeverSep 16, 2005
  7. Matthias UrlichsSep 16, 2005

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.