Skip to content

Instantly share code, notes, and snippets.

@nkpart
Last active January 20, 2019 04:35
Show Gist options
  • Save nkpart/d84e201af45a5f9379443f3ed0e34e01 to your computer and use it in GitHub Desktop.
Save nkpart/d84e201af45a5f9379443f3ed0e34e01 to your computer and use it in GitHub Desktop.
∴ cat cabal.project
packages: tools/work-common/
          tools/work-project/

I did the expected thing, and tried to build everything:

∴ cabal new-build
Up to date
∴

Nothing was built.

I read the docs here: http://cabal.readthedocs.io/en/latest/nix-local-build.html#developing-multiple-packages

Then, to build every component of every package, from the top-level directory, run the command: (Warning: cabal-install-1.24 does NOT have this behavior; you will need to upgrade to HEAD.)

Oh. As I'm using the latest released cabal, that does not work for me.

∴ cabal new-build work-project
In order, the following will be built (use -v for more details):
gtk2hs-buildtools-0.13.2.2
cairo-0.13.3.1
Chart-cairo-1.8.2
hsndfile-0.8.0
hsndfile-vector-0.5.2
zlib-0.6.1.2
streaming-commons-0.1.18
conduit-extra-1.1.17
conduit-combinators-1.1.1
work-project-0.1.0.0
Configuring hsndfile-0.8.0...
Configuring zlib-0.6.1.2...
Configuring gtk2hs-buildtools-0.13.2.2...
Building hsndfile-0.8.0...
∴

The process ended. Nothing had been built.

Let's try again with verbose on.

∴ cabal new-build work-project --verbose
In order, the following will be built:
gtk2hs-buildtools-0.13.2.2 (lib:gtk2hs-buildtools) (requires build)
cairo-0.13.3.1 (lib:cairo) (requires build)
Chart-cairo-1.8.2 (lib:Chart-cairo) (requires build)
hsndfile-0.8.0 (lib:hsndfile) (requires build)
hsndfile-vector-0.5.2 (lib:hsndfile-vector) (requires build)
zlib-0.6.1.2 (lib:zlib) (requires build)
streaming-commons-0.1.18 (lib:streaming-commons) (requires build)
conduit-extra-1.1.17 (lib:conduit-extra) (requires build)
conduit-combinators-1.1.1 (lib:conduit-combinators) (requires build)
work-project-0.1.0.0 (lib:work-project) (first run)

... [SNIP] ...

Building hsndfile-0.8.0...
/Users/nkpart/.local/bin/cabal act-as-setup --build-type=Simple -- build
--verbose=2 --builddir=dist
Redirecting build log to {handle:
/Users/nkpart/.cabal/logs/hsndfile-0.8.0.log}

∴

Again. Process ended.

∴ tail -n 5 /Users/nkpart/.cabal/logs/hsndfile-0.8.0.log
dist/build/Sound/File/Sndfile/Interface.chs.h:3:10: fatal error: 'sndfile.h' file not found
#include <sndfile.h>
         ^~~~~~~~~~~
1 error generated.
c2hs: Error during preprocessing custom header file

The error is legit, the lack of reporting is not.

Maybe things are better in cabal HEAD, but right now, cabal-latest might build my work projects, but won't report errors.

Therefore, at work, we need to use either a HEAD version of cabal, or a HEAD version of stack (as stack-released will not build cassava-0.5.1.0), to build our haskell code.

@hvr
Copy link

hvr commented Dec 20, 2017

The last one is a known issue; for now you have to be specific about which package ought to get those extra flags, i.e.

package zlib
  extra-lib-dirs: /usr/local/lib
  extra-include-dirs: /usr/local/include

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment