vasi / squashfuse

FUSE filesystem to mount squashfs archives
Other
288 stars 66 forks source link

`ll.h` includes SquashFUSE's `config.h` #65

Open reidpr opened 2 years ago

reidpr commented 2 years ago

Thanks for the library support (PR #59); this helps us a lot!!

One challenge we ran into is that ll.h includes (via some intermediate headers IIRC) the Autoconf-produced config.h. This clashes with two things:

  1. our own Autoconf-produced config.h, and
  2. something in the system headers, because it defines _POSIX_C_SOURCE to a different value than our project.

We did find a workaround:

#define SQFS_CONFIG_H
#define FUSE_USE_VERSION 32
#include <squashfuse/ll.h>

(Note that we are libfuse3 only so that's why it seemed OK to define FUSE_USE_VERSION unconditionally.)

But it would be nice if there were an externally-facing header to include.

DrDaveD commented 1 year ago

Can you submit a PR with a suggested fix?

reidpr commented 1 year ago

We don’t have the expertise on this project to submit a PR; sorry.

DrDaveD commented 1 year ago

I don't really understand how your workaround works or what it does. I don't see how it can get away with ignoring all the config.h definitions determined by configure.

reidpr commented 1 year ago

config.h is an internal header and shouldn't be exposed to other programs using the library. Thus, it was fine to have it included by ll.h when there was no shared library, but now that there is, including that file may break any library user that also uses Autoconf.

The workaround above works by preventing ll.h from defining the specific symbols that clash with Charliecloud's build. It is not a general fix. The general fix would be to separate the SquashFUSE headers into internal and external (which requires knowledge of SquashFUSE we don't have).

DrDaveD commented 1 year ago

I see, that makes sense. Perhaps the developer of the library interface @haampie could come up with a PR for that?

vasi commented 11 months ago

Here are the config.h-related things in squashfuse headers: