Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split squashfuse_ll into a lib and executable #59

Merged
merged 5 commits into from
Mar 31, 2021

Conversation

haampie
Copy link
Contributor

@haampie haampie commented Mar 30, 2021

This makes it easier for people to statically link squashfuse_ll into
their application, which can in turn be used to more easily ship
self-exectracting binaries (e.g. facebook xar or appimage)

This makes it easier for people to statically link squashfuse_ll into
their application, which can in turn be used to more easily ship
self-exectracting binaries (e.g. facebook xar or appimage)
@chipturner
Copy link
Collaborator

Is it easy to make it so the squashfuse binary links against squashfuse_ll statically rather than dynamically? Having a more portable, self-contained executable is nicer (probably no practical perf benefit but there's that, too). Automake is... challenging... so it may be nontrivial. But if it's easy I think I'd prefer that.

@haampie
Copy link
Contributor Author

haampie commented Mar 30, 2021

I was wondering the same thing, but didn't bother looking into it yet. Right now we have

bin/{squashfuse,squashfuse_ll} and lib/{libsquashfuse,libsquasfuse_ll}.{a,so}

what you mean is to statically link lib/* into bin/*, right?

Then the only dynamically linked libs are likely libfuse and compression libs? I don't think we can statically link other libs, since libfuse is LGPL and squashfuse BSD (otherwise we'd have to make squashfuse GPL too).

Not very experienced with autotools, but to be honest I don't hate it -- in fact it's better than cmake when it comes to generating static AND shared libraries (and even cross compilation out of the box?).

@haampie
Copy link
Contributor Author

haampie commented Mar 30, 2021

Hm, I guess it should just not link at all, but use the object files.

@haampie
Copy link
Contributor Author

haampie commented Mar 30, 2021

I think I've figured it out. For what it's worth, the executables and libs can be really tiny:

$ autoreconf -fi
$ ./configure
$ make CFLAGS=-Os DESTDIR=$PWD/install install -j
$ libtree install/usr/local/bin/squashfuse
squashfuse
├── liblzma.so.5 [ld.so.conf]
├── liblz4.so.1 [ld.so.conf]
├── libzstd.so.1 [ld.so.conf]
└── libfuse3.so.3 [ld.so.conf]

$ libtree install/usr/local/bin/squashfuse_ll 
squashfuse_ll
├── liblzma.so.5 [ld.so.conf]
├── liblz4.so.1 [ld.so.conf]
├── libzstd.so.1 [ld.so.conf]
└── libfuse3.so.3 [ld.so.conf]

$ ls install/usr/local/lib/
libsquashfuse.a  libsquashfuse.la  libsquashfuse_ll.a  libsquashfuse_ll.la  libsquashfuse_ll.so  libsquashfuse_ll.so.0  libsquashfuse_ll.so.0.0.0  libsquashfuse.so  libsquashfuse.so.0  libsquashfuse.so.0.0.0  pkgconfig

$ du -sh install/usr/local/bin/* install/usr/local/lib/libsquashfuse.so.0.0.0 install/usr/local/lib/libsquashfuse_ll.so.0.0.0 
40K     install/usr/local/bin/squashfuse
56K     install/usr/local/bin/squashfuse_ll
48K     install/usr/local/lib/libsquashfuse.so.0.0.0
68K     install/usr/local/lib/libsquashfuse_ll.so.0.0.0

@chipturner
Copy link
Collaborator

Looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants