Skip to content

cabal extra-libraries check does not correctly propagate E2BIG error #5355

@nh2

Description

@nh2

I have a Haskell library that uses extra-libraries: glog.

When I try to build it I get:

Setup: Missing dependencies on foreign libraries:
* Missing C libraries: glog

This is a lie; the dependency exists.

The problem is that because in the eventual gcc invocation that Cabal creates to check whether the dependency really exists (I suspect it compiles a small C file to check if it can really use glog, similar to how autoconf does it), the amount of arguments passed to GCC turns out to be very long (further inflated by the fact that I use nix, but in general that's just a small constant factor difference).

Strace confirms:

strace -fye execve -s 100000000 -v runhaskell Setup.hs build 2>&1 | grep E2BIG
execve("cc1", [arguments here], [env vars here, "COLLECT_GCC_OPTIONS='-fno-stack-protector -L... 150KB of -L flags here'"] = -1 E2BIG (Argument list too long)

E2BIG (Argument list too long), in this case because COLLECT_GCC_OPTIONS is longer than 128 KB (32 * 4 KB pages, see here).

But cabal doesn't correctly propagate the E2BIG failure; instead of telling me that some internal invocaiton failed, it claims Missing dependencies on foreign libraries.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions