Skip to content

bug: building dependencies with cabal "new-build" and profiling #3485

Closed

Description

@bitc

Edit @ezyang. Simplified the test case; you only need to depend on bifunctors or one of the Kmett packages. Seems to be related to custom setup.

Compiling my project with profiling does not work. A test cabal file is pasted below. Running the following:

$ cabal new-build --enable-profiling --enable-library-profiling

stops building dependencies half way through, and when I look at the log file ~/.cabal/logs/bifunctors-5.3.log I see at the bottom:

src/Data/Bifunctor/Tannen.hs:35:8:
    Could not find module ‘Control.Comonad’
    Perhaps you haven't installed the profiling libraries for package ‘comonad-5@comon_BPwjoCtOoUPAMJakPkbNa0’?
    Use -v to see a list of the files searched for.

When I run the command again, it tries again to build the failed dependencies, and fails in the same way. Running plain cabal new-build works fine.

Here is a complete test case. Run this as root on a fresh Ubuntu 14.04 install:

#!/bin/bash

# Install ghc and cabal-install
add-apt-repository -y ppa:hvr/ghc
apt-get update
apt-get install -y ghc-7.10.3 ghc-7.10.3-prof cabal-install-1.24

# Add a regular unix user
useradd -m -s /bin/bash -U captain
echo "PATH=/opt/ghc/7.10.3/bin:/opt/cabal/1.24/bin:"'$PATH' >> /home/captain/.profile

cat << 'EOF' | sudo -u captain -i
  cabal update
  mkdir test
  cd test
  curl -O https://gist.githubusercontent.com/bitc/b9a75eec6da145b5a151254bcc906a53/raw/6e68a763dba63ff8f32026a8d1ab90ec6504d33b/test.cabal
  cabal new-build
  echo "Finished regular new-build with exit code: $?"
  cabal new-build --enable-profiling --enable-library-profiling
  echo "Finished prof new-build with exit code: $? (but check the logs!)"
EOF

test.cabal

name:                test
version:             0.1.0.0
license:             BSD3
license-file:        LICENSE
author:              captain
maintainer:          <>
build-type:          Simple
extra-source-files:  ChangeLog.md
cabal-version:       >=1.10

library
  exposed-modules:
  build-depends:       base,
                       bifunctors
  hs-source-dirs:      src
  default-language:    Haskell2010

Activity

  1. added
    cabal-install: v2-build system
    on Jun 7, 2016
  2. 23Skidoo commented on Jun 7, 2016

    @23Skidoo
    Member
  3. ezyang commented on Sep 6, 2016

    @ezyang
    Contributor

    Confirm that I can reproduce.

  4. ezyang commented on Sep 6, 2016

    @ezyang
    Contributor

    Known facts:

    • It seems to be related to bifunctors/comonad using a Custom setup
    • If you make these packages inplace the problem goes away
    • If you look at the installs in the store, there are no profiling objects

    Current hypothesis: Cabal 1.22 didn't know how to install profiling objects; Cabal 1.24 does know how, so we need to force a newer custom setup in this case.

  5. ezyang commented on Sep 6, 2016

    @ezyang
    Contributor

    OK, hypothesis verified. Workaround: add constraints: Cabal >= 1.24 to your Cabal file.

  6. ezyang commented on Sep 19, 2016

    @ezyang
    Contributor

    OK this is a dupe of #3790 which diagnoses the problem more directly.

  7. 23Skidoo commented on Sep 21, 2016

    @23Skidoo
    Member

    Closing in favour of #3790, which has been now fixed.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    cabal-install: v2-build systemresolution: duplicatetype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions