matil019 / haskell-libfuse3

A Haskell binding for libfuse-3.x
https://hackage.haskell.org/package/libfuse3
MIT License
5 stars 1 forks source link

Support for stack #15

Closed ghost closed 2 years ago

ghost commented 2 years ago

Hello! Thanks for writing this package binding.

I have an issue using this package with stack (both from including the package name into package.yaml and/or direct git repository reference into stack.yaml) and I'm failing to build my project.

I could build the library in isolation and as a dependency with cabal just fine though.

OS: OpenSUSE 15.3 Leap Stack version: Version 2.7.5, Git revision ba147e6f59b2da75b1beb98b1888cce97f7032b1 x86_64 hpack-0.34.4 C's libfuse3 was installed from the official package manager fuse3-devel (version: 3.6.1-3.3.8)

Build log of (stack build):

Trying to generate configure with autoreconf in /tmp/stack-d952671704453c33/libfuse3-0.1.2.0/
libfuse3> configure
libfuse3> [1 of 2] Compiling Main             ( /tmp/stack-d952671704453c33/libfuse3-0.1.2.0/Setup.hs, /tmp/stack-d952671704453c33/libfuse3-0.1.2.0/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.4.1.0/setup/Main.o )
libfuse3> [2 of 2] Compiling StackSetupShim   ( /home/modotte/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /tmp/stack-d952671704453c33/libfuse3-0.1.2.0/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.4.1.0/setup/StackSetupShim.o )
libfuse3> Linking /tmp/stack-d952671704453c33/libfuse3-0.1.2.0/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.4.1.0/setup/setup ...
libfuse3> Configuring libfuse3-0.1.2.0...
libfuse3> build
libfuse3> Preprocessing library for libfuse3-0.1.2.0..
libfuse3> compiling .stack-work/dist/x86_64-linux-tinfo6/Cabal-3.4.1.0/build/System/LibFuse3/Internal_hsc_make.c failed (exit code 1)
libfuse3> rsp file was: ".stack-work/dist/x86_64-linux-tinfo6/Cabal-3.4.1.0/build/System/LibFuse3/hsc2hscall22993-0.rsp"
libfuse3> command was: /usr/bin/gcc -c .stack-work/dist/x86_64-linux-tinfo6/Cabal-3.4.1.0/build/System/LibFuse3/Internal_hsc_make.c -o .stack-work/dist/x86_64-linux-tinfo6/Cabal-3.4.1.0/build/System/LibFuse3/Internal_hsc_make.o -fuse-ld=gold -D__GLASGOW_HASKELL__=900 -Dlinux_BUILD_OS=1 -Dx86_64_BUILD_ARCH=1 -Dlinux_HOST_OS=1 -Dx86_64_HOST_ARCH=1 -Iinclude -I/usr/include/fuse3 -I.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.4.1.0/build/include -I/usr/include/fuse3 -I.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.4.1.0/build/autogen -I.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.4.1.0/build/global-autogen -include .stack-work/dist/x86_64-linux-tinfo6/Cabal-3.4.1.0/build/autogen/cabal_macros.h -I/home/modotte/.stack/programs/x86_64-linux/ghc-tinfo6-9.0.2/lib64/ghc-9.0.2/unix-2.7.2.2/include -I/home/modotte/.stack/programs/x86_64-linux/ghc-tinfo6-9.0.2/lib64/ghc-9.0.2/time-1.9.3/include -I/home/modotte/.stack/snapshots/x86_64-linux-tinfo6/f9ac3f602e4f7d9c0347503494e57a84725c58d20ba3eac85bd77d188e49f3a3/9.0.2/lib/x86_64-linux-ghc-9.0.2/primitive-0.7.3.0-EikPDi9CXNiB9f5MDJybeY/include -I/home/modotte/.stack/programs/x86_64-linux/ghc-tinfo6-9.0.2/lib64/ghc-9.0.2/bytestring-0.10.12.1/include -I/home/modotte/.stack/programs/x86_64-linux/ghc-tinfo6-9.0.2/lib64/ghc-9.0.2/base-4.15.1.0/include -I/home/modotte/.stack/programs/x86_64-linux/ghc-tinfo6-9.0.2/lib64/ghc-9.0.2/ghc-bignum-1.1/include -I/home/modotte/.stack/programs/x86_64-linux/ghc-tinfo6-9.0.2/lib64/ghc-9.0.2/include -I/home/modotte/.stack/programs/x86_64-linux/ghc-tinfo6-9.0.2/lib64/ghc-9.0.2/include/
libfuse3> error: In file included from /usr/include/fuse3/fuse.h:19:0,
libfuse3>                  from Internal.hsc:66:
libfuse3> /usr/include/fuse3/fuse_common.h:791:4: error: #error only API version 30 or greater is supported
libfuse3>  #  error only API version 30 or greater is supported
libfuse3>     ^~~~~
libfuse3> /tmp/stack-d952671704453c33/libfuse3-0.1.2.0/In file included from Internal.hsc:67:0:
libfuse3> /usr/include/fuse3/fuse_lowlevel.h:22:2: error: #error FUSE_USE_VERSION not defined
libfuse3>  #error FUSE_USE_VERSION not defined
libfuse3>   ^~~~~
libfuse3>   
Progress 1/2

--  While building package libfuse3-0.1.2.0 (scroll up to its section to see the error) using:
      /tmp/stack-d952671704453c33/libfuse3-0.1.2.0/.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.4.1.0/setup/setup --builddir=.stack-work/dist/x86_64-linux-tinfo6/Cabal-3.4.1.0 build --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1

Thanks.

matil019 commented 2 years ago

Nice to meet you!

The error message tells you that a C macro FUSE_USE_VERSION is not defined. This packages makes use of Cabal's buildinfo file, which defines the macro.

Perhaps Stack is not generating a libfuse3.buildinfo file, or not compatible with it. I'm afraid I don't think I have time to fix this by myself because I don't use Stack at all.

Try looking for libfuse3.buildinfo. It looks like that your log doesn't contain the output of ./configure, so Stack might have not run it. If Stack does run ./configure, it must be generated somewhere:

find -name libfuse3.buildinfo
ghost commented 2 years ago

@matil019 Thanks for the pointers :slightly_smiling_face: . After viewing the linked doc, I noticed haskell-libfuse3's Setup.hs file content is not identical to the snippet from the documentation page.

If I understand correctly from that documentation, defaultMain is for Simple build-type and doesn't fit well for Configure or other custom build?

Good news is, I managed to build the library with both cabal and stack after replacing the main = defaultMain with main = defaultMainWithHooks autoconfUserHooks in Setup.hs file. I also could build the examples and use the package as a library from other projects just fine with both cabal and stack too.

matil019 commented 2 years ago

@modotte The new version is published to Hackage as 0.1.2.1! Please take a look.

ghost commented 2 years ago

Building from source and git url works brilliantly now, unfortunately, I still couldn't build the one from Hackage (yes, including 0.1.2.1). :slightly_frowning_face:

I'll try to investigate the potential cause.

Edit: Nevermind! I forgot to update my Stack packages index! My stack did try to build with 0.1.2.0 and not 0.1.2.1. All works fine as expected now! :sweat_smile: