Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bitc opened this issue Jun 7, 2016 · 6 comments
Closed

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

bitc opened this issue Jun 7, 2016 · 6 comments

Comments

@bitc
Copy link

bitc commented Jun 7, 2016

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
@23Skidoo
Copy link
Member

23Skidoo commented Jun 7, 2016

/cc @dcoutts

@ezyang
Copy link
Contributor

ezyang commented Sep 6, 2016

Confirm that I can reproduce.

@ezyang
Copy link
Contributor

ezyang commented Sep 6, 2016

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.

@ezyang
Copy link
Contributor

ezyang commented Sep 6, 2016

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

@ezyang
Copy link
Contributor

ezyang commented Sep 19, 2016

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

@23Skidoo
Copy link
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
Projects
None yet
Development

No branches or pull requests

3 participants