On Fri, Oct 20, 2023 at 4:59 AM Jan <
pfe...@gmail.com> wrote:
>
> Thanks for all the replies.
>
> Unfortunately, as I found out today, including the `.a` (static libraries) in the Github just got to its limit (100Mb), so I don't think this is an option anymore :( I'm going to investigate the Gihtub LFS (Large File Storage), not sure how well it will integrate with `go get` though -- I've never used it before.
Hi Jan!
`.a` static library is an archive of `.o` files. It can be unpacked
and repacked into several `.a` files so that each of them is less than
100Mb GitHub limit.
ar -x libbig.a
ar -r libsmall1.a obj1.o obj2.o obj3.o
ar -r libsmall2.a obj4.o obj5.o obj6.o
See
https://stackoverflow.com/a/53522978
Then link all `.a` files from #cgo.
You may need to link the libraries twice:
#cgo LDFLAGS: -L${SRCDIR} -lsmall1 -lsmall2 -lsmall1 -lsmall2
Alternatively you can figure out dependencies between .o files, run
topological sort before splitting and make sure that small2 does not
depend on small1. Then no need to link them twice.
See
https://stackoverflow.com/a/409470
Also `.o` files can be stripped using the `strip` tool unless you need
debugging. This can result in dramatic size decrease.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/9e56ac27-386d-41d0-a520-263e3402c6d2n%40googlegroups.com.
--
Best regards,
Boris Nagaev