haskell / cabal

Official upstream development repository for Cabal and cabal-install
https://haskell.org/cabal
Other
1.62k stars 691 forks source link

cabal new-build fails to pass any options for `libexecsubdir` when using 'build-type: configure'. #4509

Open vmchale opened 7 years ago

vmchale commented 7 years ago

Steps to reproduce:

$ cabal unpack old-time
$ cd old-time-1.1.0.3/
$ cabal new-build --with-ghc=ghc-8.0.2 --with-ghc-pkg=ghc-pkg-8.0.2
Resolving dependencies...
In order, the following will be built (use -v for more details):
 - old-time-1.1.0.3 (lib) (first run)
Configuring library for old-time-1.1.0.3..
configure: error: unrecognized option: `--libexecsubdir='
Try `./configure --help' for more information

I am using head. Excerpt of output with -v:

...
/bin/sh ./configure '--with-compiler=ghc' '--prefix=/home/vanessa/.cabal' '--bindir=/home/vanessa/.cabal/bin' '--libdir=/home/vanessa/.cabal/lib/x86_64-linux-ghc-8.0.2/old-time-1.1.0.3-inplace' '--libexecdir=/home/vanessa/.cabal/libexec/x86_64-linux-ghc-8.0.2/old-time-1.1.0.3' '--libexecsubdir=' '--datadir=/home/vanessa/.cabal/share/x86_64-linux-ghc-8.0.2/old-time-1.1.0.3' '--sysconfdir=/home/vanessa/.cabal/etc' 'CC=/usr/bin/gcc'
configure: error: unrecognized option: `--libexecsubdir='
Try `./configure --help' for more information

Excerpt from my ~/.cabal/config:

...
install-dirs user
  -- prefix: /home/vanessa/.cabal
  -- bindir: $prefix/bin
  -- libdir: $prefix/lib
  -- libsubdir: $abi/$libname
  -- dynlibdir: $libdir/$abi
  -- libexecdir: $prefix/libexec
  -- libexecsubdir: $abi/$pkgid
  -- datadir: $prefix/share
  -- datasubdir: $abi/$pkgid
  -- docdir: $datadir/doc/$abi/$pkgid
  -- htmldir: $docdir/html
  -- haddockdir: $htmldir
  -- sysconfdir: $prefix/etc

install-dirs global
  -- prefix: /usr/local
  -- bindir: $prefix/bin
  -- libdir: $prefix/lib
  -- libsubdir: $abi/$libname
  -- dynlibdir: $libdir/$abi
  -- libexecdir: $prefix/libexec
  -- libexecsubdir: $abi/$pkgid
  -- datadir: $prefix/share
  -- datasubdir: $abi/$pkgid
  -- docdir: $datadir/doc/$abi/$pkgid
  -- htmldir: $docdir/html
  -- haddockdir: $htmldir
  -- sysconfdir: $prefix/etc
ezyang commented 7 years ago

@DanielG, IIRC, you added this variable. Can you take a look?

DanielG commented 7 years ago

I can't reproduce this using master (934009b28377fb138c38d031fa91a5e34caa14e3). See -v2 logs here.

@vmchale can you post the full -v2 logs so I can compare with what I got?

DanielG commented 7 years ago

One other thing --libexecsubdir isn't an option that actually exists for autoconf generated configure scripts. It's an internal variable of Cabal like $libsubdir. I couldn't find the code that runs that configure command so I don't know how that could possibly sneak through.

hvr commented 7 years ago

The title is misleading, as old-time doesn't use a custom Setup.hs. Instead, old-time is a build-type: configure package.

alexbiehl commented 7 years ago

Also happend for me when building ghc-paths.

Linking /Users/alexbiehl/git/haddock/dist-newstyle/tmp/src-71567/ghc-paths-0.1.0.9/dist/setup/setup ...
unrecognized 'configure' option `--libexecsubdir='
cabal: Failed to build ghc-paths-0.1.0.9 (which is required by exe:haddock
from haddock-2.18.0). See the build log above for details.
alexbiehl commented 7 years ago

In my case I was using ghc-8.2-rc1 which already ships a Cabal-2.0.0 lib but which didn't support --libexecsubdir flag yet. Upgrading to to ghc-8.2-rc2 helped here as it ships with a more recent Cabal.

DanielG commented 7 years ago

Ah, that makes sense. The code can't really know that the Cabal-2.0 that shipped with rc1 is different from the 2.0 from rc2. I guess you could call this a "bug" in the release process, I wonder why it's done like that, though my guess is because the PVP doesn't have a concept of a pre-release unlike semver.

hvr commented 7 years ago

@DanielG the reason was simply because we didn't pay too much attention. Version hacks that were used in the past (in this or other packages):

And then there's also https://ghc.haskell.org/trac/ghc/wiki/Commentary/Libraries/EagerVersionBump

There's not much you can do to encode pre-releases, if everything you can work with is a non-empty list of natural numbers... which is simply a technical limitation of Cabal.