libgit2/libgit2 — Issue #458: static link drags in lots of code
Author: boyski
Created: 2011-10-14 15:51:11+00:00
State: open

I'm not saying this is a bug, it may just be an architectural fact of life, but I was a little concerned to see how much my program grew in size when statically linked with libgit2. At the moment it's only using libgit2 to calculate SHA-1 hashes which I was previously doing with OpenSSL/libcrypto.a. Picking up the SHA-1 API from libcrypto did not grow the executable by a lot, but switching to libgit2 and git_odb_hash() made it ~500K larger on Linux (Ubuntu 11.04 64-bit).

I'm going to attach a little test program which links to ~10K bytes when the call to git_odb_hash() is commented out and ~500K bytes with it in. That's nearly half the size of the entire library.

Is this just a fact of life with libgit2 or does it indicate something that could be done better?