haskell / cabal

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

cabal-install 1.24 passes bad options to custom Setup #3433

Closed hvr closed 8 years ago

hvr commented 8 years ago

NB: base-noprelude-4.7.0.2 uses a custom-setup stanza

in this case, cabal-install-1.24 needs to talk to a custom Setup.hs compiled against Cabal-1.20:

$ cabal install -v2 -w /opt/ghc/7.8.4/bin/ghc base-noprelude 
Warning: /home/hvr/.cabal/config: 'root-keys' for repository
"hackage.haskell.org" non-empty, but 'secure' not set to True.
/home/hvr/.cabal/bin/alex --version
/home/hvr/.cabal/bin/c2hs --numeric-version
/home/hvr/.cabal/bin/cpphs --version
/usr/bin/gcc -dumpversion
/home/hvr/.cabal/bin/ghcjs --numeric-ghcjs-version
/home/hvr/.cabal/bin/ghcjs-pkg --version
looking for tool haddock near compiler in /opt/ghc/7.8.4/bin
found haddock in /opt/ghc/7.8.4/bin/haddock
/opt/ghc/7.8.4/bin/haddock --version
/home/hvr/.cabal/bin/happy --version
looking for tool hpc near compiler in /opt/ghc/7.8.4/bin
found hpc in /opt/ghc/7.8.4/bin/hpc
/opt/ghc/7.8.4/bin/hpc version
looking for tool hsc2hs near compiler in /opt/ghc/7.8.4/bin
found hsc2hs in /opt/ghc/7.8.4/bin/hsc2hs
/opt/ghc/7.8.4/bin/hsc2hs --version
/home/hvr/.cabal/bin/HsColour -version
/home/hvr/.cabal/bin/jhc --version
/opt/ghc/7.8.4/bin/ghc -c /tmp/1804289383846930886.c -o /tmp/16816927771714636915.o -ferror-spans
/usr/bin/ld -x -r /tmp/16816927771714636915.o -o /tmp/1957747793424238335.o
/usr/bin/pkg-config --version
/bin/tar --help
Reading available packages...
/usr/bin/pkg-config --list-all
/usr/bin/pkg-config --modversion sqlite3 blkid pixman-1 iso-codes gmodule-export-2.0 libevent_pthreads xaw7 gstreamer-interfaces-0.10 cairo-svg libdrm_intel recordproto nettle gnutls libpcreposix lapack-netlib lqr-1 atk-bridge-2.0 m17n-gui libelf cairo-tee xcb-render dbus-1 e2p dri gnome-icon-theme-symbolic xkbcommon dri3proto systemd udisks adwaita-icon-theme mobile-broadband-provider-info libbsd cairo-png wayland-cursor gstreamer-pbutils-0.10 QtXml pangoxft QtDBus xcursor libcurl xft libidn libxslt mircookie glu gstreamer-rtp-0.10 xtrans libexif gdk-pixbuf-2.0 'gtk+-x11-3.0' xf86vidmodeproto QtScriptTools lapack gnome-system-tools damageproto QtDeclarative libpulse kbproto expat videoproto cairo-xlib mit-krb5-gssapi banshee-lastfm-gui gstreamer-netbuffer-0.10 uuid valgrind fontutil xcb-dri2 xcb-dri3 panel gconf-2.0 randrproto pygoocanvas libxdot openal xrandr libgssglue 'Magick++' dleyna-server-1.0 wayland-egl bash-completion QtGui gdk-2.0 capi20 xcomposite libtasn1 dri2proto QtScript OpenEXR gstreamer-riff-0.10 icu-i18n libgphoto2 datrie-0.2 QtDesigner sm xorg-sgml-doctools cairo-ps p11-kit-1 libcdt libpulse-mainloop-glib python gstreamer-check-0.10 gdk-mir-3.0 protobuf-lite python2 mirclient gnome-icon-theme gmodule-2.0 gdk-pixbuf-xlib-2.0 ImageMagick gstreamer-dataprotocol-0.10 libdrm_radeon libdrm fixesproto libgdiplus libpulse-simple pango QtDesignerComponents banshee-mono-media m17n-flt geoclue-2.0 m17n-core banshee-hyena pangoft2 atspi-2 xineramaproto gdk-3.0 sane-backends compositeproto icu-uc libbsd-ctor xvmc ginn libpcre libpcre16 cairo-xcb-shm libthai glproto cairo-pdf gstreamer-sdp-0.10 libevent_openssl pangocairo gstreamer-0.10 lcms2 pm-utils gstreamer-app-0.10 gnome-mime-data-2.0 x11-xcb libpq gthread-2.0 libusb-1.0 'gtk+-broadway-3.0' vdpau gstreamer-base-0.10 libssl Qt3Support libpcrecpp cairo-xcb gl xorg-wacom gstreamer-plugins-base-0.10 menu QtXmlPatterns intel-gen4asm MagickWand egl libxml-2.0 mit-krb5 libcrypto QtTest libdrm_nouveau alsa xextproto cairo-gobject yelp-xsl gstreamer-controller-0.10 gmodule-no-export-2.0 wayland-client libsepol bdw-gc x11 libdrm_amdgpu xtst libgvpr gstreamer-fft-0.10 ddjvuapi 'gtk+-mir-3.0' libevent libpcre32 xcb-glx libpathplan QtCLucene QtCore xmu 'gtk+-unix-print-2.0' gstreamer-cdda-0.10 gdk-broadway-3.0 hogweed poppler-data libexslt dleyna-server-service-1.0 wayland-server ibus-table xi 'libcrypto++' banshee-services udev libR xbitmaps xt cairo-fc xv glib-2.0 cairo xorg-macros gdk-wayland-3.0 Wand icu-io cairo-ft banshee-hyena-data-sqlite xcb-sync banshee-lastfm gio-unix-2.0 MagickCore libquvi-scripts pygtksourceview-2.0 QtSql xfixes presentproto xcb-xfixes tomboy-addins 'gtk+-unix-print-3.0' banshee-thickclient tic gstreamer-tag-0.10 xinerama libbsd-overlay tinfo epoxy libpng m17n-shell usbutils xpm 'gtk+-wayland-3.0' gstreamer-rtsp-0.10 gdk-x11-2.0 blas-netlib xml2po librsvg-2.0 libomxil-bellagio xshmfence xcb-randr IlmBase banshee-musicbrainz freetype2 xext libjpeg libudev libgphoto2_port libtiff-4 xau harfbuzz xcb-present ice xdamage xkbcomp libselinux openssl atk xxf86vm cairo-script 'gtk+-2.0' ruby-1.9 banshee-hyena-gui dleyna-connector-dbus-1.0 python-2.7 QtHelp icu-le libffi wayland-scanner xkeyboard-config gnome-doc-utils xcb-shape banshee-collection-indexer libclc harfbuzz-icu pthread-stubs shared-mime-info QtOpenGL xrender gstreamer-net-0.10 banshee-core inputproto icu-lx 'ImageMagick++' libpng12 banshee-webbrowser xcb-shm xproto protobuf xcb libmpg123 dbus-glib-1 liblzma gdk-x11-3.0 libpcsclite gstreamer-audio-0.10 gstreamer-video-0.10 ncurses form fontconfig dbus-python cairo-xlib-xrender ruby-2.3 'gtk+-3.0' QtUiTools banshee-nowplaying ext2fs harfbuzz-gobject gstreamer-floatcast-0.10 lxappearance zlib xfce4-session-2.0 com_err 'ncurses++' libcgraph gobject-2.0 ruby m17n-db libotf gio-2.0 QtSvg d3d libgvc xdmcp QtNetwork notify-python 'gtk+-x11-2.0' blas renderproto
Choosing modular solver.
Resolving dependencies...
Ready to install base-noprelude-4.7.0.2
Extracting
/home/hvr/.cabal/packages/hackage.haskell.org/base-noprelude/4.7.0.2/base-noprelude-4.7.0.2.tar.gz
to /tmp/cabal-tmp-5991...
Updating base-noprelude.cabal with the latest revision from the index.
Configuring base-noprelude-4.7.0.2...
Waiting for install task to finish...
creating /tmp/cabal-tmp-5991/base-noprelude-4.7.0.2/dist/setup
creating /tmp/cabal-tmp-5991/base-noprelude-4.7.0.2/dist
creating /tmp/cabal-tmp-5991/base-noprelude-4.7.0.2/dist/setup
copy /tmp/cabal-tmp-5991/base-noprelude-4.7.0.2/Setup.hs to
/tmp/cabal-tmp-5991/base-noprelude-4.7.0.2/dist/setup/setup.hs
/opt/ghc/7.8.4/bin/ghc --make -fbuilding-cabal-package -odir /tmp/cabal-tmp-5991/base-noprelude-4.7.0.2/dist/setup -hidir /tmp/cabal-tmp-5991/base-noprelude-4.7.0.2/dist/setup -i -i/tmp/cabal-tmp-5991/base-noprelude-4.7.0.2 -optP-include -optP/tmp/cabal-tmp-5991/base-noprelude-4.7.0.2/dist/setup/setup_macros.h -hide-all-packages -package-id Cabal-1.20.0.3-714a9efc373b208cfba0775acac262d0 -package-id base-4.7.0.2-bfd89587617e381ae01b8dd7b6c7f1c1 -package-id filepath-1.3.0.2-25a474a9272ae6260626ce0d70ad1cab /tmp/cabal-tmp-5991/base-noprelude-4.7.0.2/dist/setup/setup.hs -o /tmp/cabal-tmp-5991/base-noprelude-4.7.0.2/dist/setup/setup -threaded -ferror-spans
/tmp/cabal-tmp-5991/base-noprelude-4.7.0.2/dist/setup/setup configure
--verbose=2 --builddir=dist --ghc --with-compiler=/opt/ghc/7.8.4/bin/ghc
--prefix=/home/hvr/.cabal --bindir=/home/hvr/.cabal/bin
--libdir=/home/hvr/.cabal/lib
--libsubdir=x86_64-linux-ghc-7.8.4/base-noprelude-4.7.0.2-BnLIddom9I4GRVKz87SqFV
--libexecdir=/home/hvr/.cabal/libexec --datadir=/home/hvr/.cabal/share
--datasubdir=x86_64-linux-ghc-7.8.4/base-noprelude-4.7.0.2
--docdir=/home/hvr/.cabal/share/doc/x86_64-linux-ghc-7.8.4/base-noprelude-4.7.0.2
--htmldir=/home/hvr/.cabal/share/doc/x86_64-linux-ghc-7.8.4/base-noprelude-4.7.0.2/html
--haddockdir=/home/hvr/.cabal/share/doc/x86_64-linux-ghc-7.8.4/base-noprelude-4.7.0.2/html
--sysconfdir=/home/hvr/.cabal/etc --user
--ipid=base-noprelude-4.7.0.2-BnLIddom9I4GRVKz87SqFV
--dependency=base=base-4.7.0.2-bfd89587617e381ae01b8dd7b6c7f1c1
--disable-tests --exact-configuration --disable-benchmarks
--ghc-option=-ferror-spans
Redirecting build log to {handle:
/home/hvr/.cabal/logs/base-noprelude-4.7.0.2.log}
Failed to install base-noprelude-4.7.0.2
Build log ( /home/hvr/.cabal/logs/base-noprelude-4.7.0.2.log ):
cabal: Entering directory '/tmp/cabal-tmp-5991/base-noprelude-4.7.0.2'
[1 of 1] Compiling Main             ( /tmp/cabal-tmp-5991/base-noprelude-4.7.0.2/dist/setup/setup.hs, /tmp/cabal-tmp-5991/base-noprelude-4.7.0.2/dist/setup/Main.o )
Linking /tmp/cabal-tmp-5991/base-noprelude-4.7.0.2/dist/setup/setup ...
unrecognized 'configure' option `--ipid=base-noprelude-4.7.0.2-BnLIddom9I4GRVKz87SqFV'
cabal: Leaving directory '/tmp/cabal-tmp-5991/base-noprelude-4.7.0.2'
World file is already up to date.
cabal: Error: some packages failed to install:
base-noprelude-4.7.0.2 failed during the configure step. The exception was:
ExitFailure 1
hvr commented 8 years ago

Even worse with --constraint 'Cabal == 1.18.*' (the Cabal version that was bundled with GHC 7.8):

copy /tmp/cabal-tmp-6156/base-noprelude-4.7.0.2/Setup.hs to
/tmp/cabal-tmp-6156/base-noprelude-4.7.0.2/dist/setup/setup.hs
/opt/ghc/7.8.4/bin/ghc --make -fbuilding-cabal-package -odir /tmp/cabal-tmp-6156/base-noprelude-4.7.0.2/dist/setup -hidir /tmp/cabal-tmp-6156/base-noprelude-4.7.0.2/dist/setup -i -i/tmp/cabal-tmp-6156/base-noprelude-4.7.0.2 -optP-include -optP/tmp/cabal-tmp-6156/base-noprelude-4.7.0.2/dist/setup/setup_macros.h -hide-all-packages -package-id Cabal-1.18.1.5-6478013104bde01737bfd67d34bbee0a -package-id base-4.7.0.2-bfd89587617e381ae01b8dd7b6c7f1c1 -package-id filepath-1.3.0.2-25a474a9272ae6260626ce0d70ad1cab /tmp/cabal-tmp-6156/base-noprelude-4.7.0.2/dist/setup/setup.hs -o /tmp/cabal-tmp-6156/base-noprelude-4.7.0.2/dist/setup/setup -threaded -ferror-spans
/tmp/cabal-tmp-6156/base-noprelude-4.7.0.2/dist/setup/setup configure
--verbose=2 --builddir=dist --ghc --with-compiler=/opt/ghc/7.8.4/bin/ghc
--prefix=/home/hvr/.cabal --bindir=/home/hvr/.cabal/bin
--libdir=/home/hvr/.cabal/lib
--libsubdir=x86_64-linux-ghc-7.8.4/base-noprelude-4.7.0.2-BnLIddom9I4GRVKz87SqFV
--libexecdir=/home/hvr/.cabal/libexec --datadir=/home/hvr/.cabal/share
--datasubdir=x86_64-linux-ghc-7.8.4/base-noprelude-4.7.0.2
--docdir=/home/hvr/.cabal/share/doc/x86_64-linux-ghc-7.8.4/base-noprelude-4.7.0.2
--htmldir=/home/hvr/.cabal/share/doc/x86_64-linux-ghc-7.8.4/base-noprelude-4.7.0.2/html
--haddockdir=/home/hvr/.cabal/share/doc/x86_64-linux-ghc-7.8.4/base-noprelude-4.7.0.2/html
--sysconfdir=/home/hvr/.cabal/etc --user
--ipid=base-noprelude-4.7.0.2-BnLIddom9I4GRVKz87SqFV
--dependency=base=base-4.7.0.2-bfd89587617e381ae01b8dd7b6c7f1c1
--disable-tests --exact-configuration --disable-benchmarks
--ghc-option=-ferror-spans
Redirecting build log to {handle:
/home/hvr/.cabal/logs/base-noprelude-4.7.0.2.log}
Failed to install base-noprelude-4.7.0.2
Build log ( /home/hvr/.cabal/logs/base-noprelude-4.7.0.2.log ):
cabal: Entering directory '/tmp/cabal-tmp-6156/base-noprelude-4.7.0.2'
[1 of 1] Compiling Main             ( /tmp/cabal-tmp-6156/base-noprelude-4.7.0.2/dist/setup/setup.hs, /tmp/cabal-tmp-6156/base-noprelude-4.7.0.2/dist/setup/Main.o )
Linking /tmp/cabal-tmp-6156/base-noprelude-4.7.0.2/dist/setup/setup ...
unrecognized option `--ipid=base-noprelude-4.7.0.2-BnLIddom9I4GRVKz87SqFV'

unrecognized option `--dependency=base=base-4.7.0.2-bfd89587617e381ae01b8dd7b6c7f1c1'

unrecognized option `--exact-configuration'
cabal: Leaving directory '/tmp/cabal-tmp-6156/base-noprelude-4.7.0.2'
World file is already up to date.
cabal: Error: some packages failed to install:
base-noprelude-4.7.0.2 failed during the configure step. The exception was:
ExitFailure 1
hvr commented 8 years ago

essential information for reproducing this: Cabal-1.22.8.0 needs to be registered in the pkg-db as well; then cabal-install seems to assume it's talking to Cabal-1.22 even though it selected Cabal-1.18 for compiling Setup.hs...

/cc @dcoutts

PS: this does not affect cabal new-build afaics (I've been told, cabal new-build uses a different scheme to determine the Cabal-lib version).

jaccokrijnen commented 8 years ago

I'm having a similar issue when building gi-cairo (ghc 7.10.3)

...
/home/jacco/projects/leksah/leksah/dist-newstyle/build/gi-cairo-1.0.4/setup/setup
configure --verbose=2
--builddir=/home/jacco/projects/leksah/leksah/dist-newstyle/build/gi-cairo-1.0.4
--ghc --prefix=/home/jacco/.cabal --bindir=/home/jacco/.cabal/bin
--libdir=/home/jacco/.cabal/lib/x86_64-linux-ghc-7.10.3/.fake.gi-cairo-1.0.4
--libsubdir= --libexecdir=/home/jacco/.cabal/libexec
--datadir=/home/jacco/.cabal/share/x86_64-linux-ghc-7.10.3/gi-cairo-1.0.4
--datasubdir=
--docdir=/home/jacco/.cabal/share/doc/x86_64-linux-ghc-7.10.3/gi-cairo-1.0.4
--htmldir=/home/jacco/.cabal/share/doc/x86_64-linux-ghc-7.10.3/gi-cairo-1.0.4/html
--haddockdir=/home/jacco/.cabal/share/doc/x86_64-linux-ghc-7.10.3/gi-cairo-1.0.4/html
--sysconfdir=/home/jacco/.cabal/etc --enable-library-vanilla
--disable-library-profiling --enable-shared --disable-executable-dynamic
--disable-profiling --profiling-detail=default
--library-profiling-detail=default --enable-optimization --disable-debug-info
--disable-library-for-ghci --disable-split-objs --disable-executable-stripping
--disable-library-stripping --package-db=clear --package-db=global
--package-db=/home/jacco/.cabal/store/ghc-7.10.3/package.db
--package-db=/home/jacco/projects/leksah/leksah/dist-newstyle/packagedb/ghc-7.10.3
--ipid=gi-cairo-1.0.4-inplace
--dependency=base=base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d
--dependency=bytestring=bytestring-0.10.6.0-c60f4c543b22c7f7293a06ae48820437
--dependency=containers=containers-0.5.6.2-e59c9b78d840fa743d4169d4bea15592
--dependency=haskell-gi-base=haskell-gi-base-0.17-inplace
--dependency=text=text-1.2.2.1-78576e9b1e5bd3089726a9044c764b870dda7b4864f6ab653a7e549915e3c95f
--dependency=transformers=transformers-0.4.2.0-81450cd8f86b36eaa8fa0cbaf6efc3a3
--disable-tests --disable-coverage --exact-configuration --disable-benchmarks
--with-ghc=/opt/ghc/7.10.3/bin/ghc --with-ghc-pkg=/opt/ghc/7.10.3/bin/ghc-pkg
unrecognized 'configure' option `--profiling-detail=default'

unrecognized 'configure' option `--library-profiling-detail=default'

unrecognized 'configure' option `--ipid=gi-cairo-1.0.4-inplace'
hvr commented 8 years ago

@23Skidoo you self-assigned this bug... are you working on this already?

23Skidoo commented 8 years ago

I haven't yet started, but I want to fix this before the release.

hamishmack commented 8 years ago

I just had this error. I have been working on getting travis builds of Leksah working again. It is tricky because we need to test it with recent versions of Gtk+. So I have been playing with a travis-docker branch that runs Ubuntu 16.04 docker container in travis and builds there.

The latest GHC 8.0.1 build worked (YAY). The GHC 7.10.3 build failed. Here is the error:

https://travis-ci.org/leksah/leksah/jobs/136645154#L3869

hamishmack commented 8 years ago

Here is a Dockerfile to reproduce the issue:

FROM ubuntu:xenial

RUN apt-get update && \
    apt-get -y install software-properties-common && \
    add-apt-repository -y ppa:hvr/ghc && \
    apt-get update && \
    apt-get -y install happy-1.19.5 alex-3.1.7 libgtk-3-dev libgirepository1.0-dev

RUN apt-get install -y cabal-install-1.24 ghc-7.10.3

RUN PATH=$HOME/.cabal/bin:/opt/ghc/7.10.3/bin:/opt/cabal/1.24/bin:/opt/alex/3.1.7/bin:/opt/happy/1.19.5/bin:$PATH && ( \
    cabal update && \
    cabal install haskell-gi haskell-gi-base \
    )

RUN PATH=$HOME/.cabal/bin:/opt/ghc/7.10.3/bin:/opt/cabal/1.24/bin:/opt/alex/3.1.7/bin:/opt/happy/1.19.5/bin:$PATH && ( \
    cabal unpack gi-cairo && \
    cd gi-cairo* && \
    cabal new-build \
    )
hamishmack commented 8 years ago

Changing cabal new-build to LC_ALL=C.UTF-8 cabal new-build --constraint='Cabal>=1.24' makes that Dockerfile work (I don't think the LC_ALL thing is related, just makes the haskell-gi code read the GIR files as UTF-8).

Perhaps we should add Cabal>=1.24 to the custom-setup in gi-cairo?

grayjay commented 8 years ago

I think that the error involving base-noprelude and --constraint 'Cabal == 1.18.*' is related to #3436. See https://github.com/haskell/cabal/issues/3436#issuecomment-225403445. The variable cabalLibVersion, which is the Cabal version that would be used if the dependency solver didn't pick a version, is also used to filter the configure flags: https://github.com/haskell/cabal/blob/dc3eca7d9ec990faa8df1447fbfd3f8ac965ae23/cabal-install/Distribution/Client/SetupWrapper.hs#L362 . The commit that I linked to in #3436 (https://github.com/grayjay/cabal/commit/9f6cbea106e25342fea6629ed753ad79da74245e?w=1) allows this command to run with GHC 7.8.4 and Cabal-1.20.0.4: cabal install -v2 base-noprelude --constraint 'Cabal == 1.18.*'