[Nix-dev] Developing Haskell packages that use the FFI

Charles Strahan charles at cstrahan.com
Sun Mar 15 20:30:53 CET 2015


Hey Ian,

It looks like the version of protobuf is propogated by the the
pythonProtobuf passed in to the mesos package, which uses protobuf 2.6.
Does that need to be 2.5 (or some other version)? It looks like the
version of protobuf that mesos build is using is the one packaged with
the source, so it might be that the version of the python package should
be different, and we just haven't noticed it yet.

I'm not sure about the libzfs problem, though. Assuming libzfs includes
a proper pkg-config setup, you should be able to add `pkgconfig' to the
list of buildInputs, and I think Cabal should get the correct paths
(e.g. the $PKG_CONFIG_PATH variable should automatically be configured
properly).

I'm interested in using your hs-mesos package, so I'd be more than
happy to help you work out the kinks on #nixos (I'm cstrahan) or some
other medium.

-Charles

On Fri, Mar 6, 2015, at 11:36 PM, Ian Duncan wrote:
> Hi there,


> I’m pretty new to NixOS, and I’m trying to get into using it for
> Haskell development. So far, I’ve been following the guide here
> (http://wiki.ocharles.org.uk/Nix) with moderate success for libraries
> that don’t directly need to interact with C/C++ libraries. However,
> I’ve got some projects that I’m working on that use “picky” libraries
> (for lack of a better term).


> To be specific, I’ve got two packages that I’m working on that are
> giving me grief:


>  * I’m working on a package that depends on the hs-mesos cabal
>    package, but I’m ending up with the wrong version of the C++
>    protobuf library (incompatible headers) due to Nix somehow
>    automatically picking up the wrong protobuf dependency for using
>    the mesos C++ headers. How can I configure what version of protobuf
>    is used for mesos / hs-mesos? My shell.nix is:


> with (import <nixpkgs> {}).pkgs;
(haskellngPackages.callPackage ./. {}).env
>
> And my default.nix is:


> { mkDerivation, base, hs-mesos, hzk, lens, stdenv, stm }:
mkDerivation { pname = "mesotron"; version = "0.1.0.0"; src = ./.;
isLibrary = false; isExecutable = true; buildDepends = [ base hs-mesos
hzk lens stm ]; license = stdenv.lib.licenses.unfree; }
>
>  * Similarly, I’m trying to write Haskell bindings for libzfs, don’t
>    know how to pull in the zfs dependency properly. This one seems to
>    be more complex– I need to add something like ${zfs}/include/libspl
>    & ${zfs}/include/libzfs to the include paths, but even after doing
>    that, I get macro recursion errors in glib? In file included from
>    /nix/store/93zfs0zzndi7pkjkjxawlafdj8m90kg5-glibc-2.20/include/unistd.h:610:0:
    , from
    /nix/store/g6d4ddw286x57m5drm905fhnqac68i8q-zfs-user-0.6.3-1.2/include/libspl/unistd.h:28,
    from
    /nix/store/g6d4ddw286x57m5drm905fhnqac68i8q-zfs-user-0.6.3-1.2/include/libspl/sys/param.h:32,
    from
    /nix/store/g6d4ddw286x57m5drm905fhnqac68i8q-zfs-user-0.6.3-1.2/include/libspl/sys/types.h:34,
    from
    /nix/store/93zfs0zzndi7pkjkjxawlafdj8m90kg5-glibc-2.20/include/stdlib.h:315,
    from
    /nix/store/g6d4ddw286x57m5drm905fhnqac68i8q-zfs-user-0.6.3-1.2/include/libspl/stdlib.h:28,
    from
    /nix/store/g6d4ddw286x57m5drm905fhnqac68i8q-zfs-user-0.6.3-1.2/include/libspl/assert.h:34,
    from
    /nix/store/g6d4ddw286x57m5drm905fhnqac68i8q-zfs-user-0.6.3-1.2/include/libzfs/libzfs.h:34,
    from src/ZFS.hs:4:

/nix/store/93zfs0zzndi7pkjkjxawlafdj8m90kg5-glibc-2.20/include/bits/confname.h:201:0:
error: detected recursion whilst expanding macro "_SC_UIO_MAXIOV"
_SC_IOV_MAX = _SC_UIO_MAXIOV, ^

/nix/store/93zfs0zzndi7pkjkjxawlafdj8m90kg5-glibc-2.20/include/bits/confname.h:497:0:
error: detected recursion whilst expanding macro
"_SC_LEVEL1_ICACHE_SIZE" _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50, ^

In file included from
/nix/store/g6d4ddw286x57m5drm905fhnqac68i8q-zfs-user-0.6.3-1.2/include/libzfs/libzfs.h:34:0:
, from src/ZFS.hs:4:

/nix/store/g6d4ddw286x57m5drm905fhnqac68i8q-zfs-user-0.6.3-1.2/include/libspl/assert.h:39:0:
error: detected recursion whilst expanding macro "stderr"
fprintf(stderr, "%s:%i: %s: Assertion `%s` failed.\n", ^
>
> Anyways, these questions are kind of ill-formed, for which I
> apologize. I’m not really sure what I’m missing here, and I just
> don’t have enough experience with Nix yet to understand what I’m
> doing wrong.


>


>
>
>
> – Ian Duncan
>
>


> _________________________________________________
> nix-dev mailing list nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20150315/68d9808a/attachment.html 


More information about the nix-dev mailing list