Closed idontgetoutmuch closed 6 years ago
nix generates a cabal configure command (see above). If I run this at the CLI
cabal configure
--verbose
--prefix=/nix/store/xjkd9wwym237wbza28hr8mysq9rp0cp3-hmatrix-0.18.1.1
--libdir=$prefix/lib/$compiler
--libsubdir=$pkgid
--docdir=/nix/store/nhkhx3aa32bk8dpilf3g7mhrpa9y1jmq-hmatrix-0.18.1.1-doc/share/doc
--with-gcc=clang
--package-db=/private/tmp/nix-build-hmatrix-0.18.1.1.drv-0/package.conf.d
--ghc-option=-optl=-Wl,-headerpad_max_install_names
--ghc-option=-j1
--disable-split-objs
--disable-library-profiling
--disable-profiling
--enable-shared
--disable-coverage
--enable-library-vanilla
--enable-executable-dynamic
--enable-tests -fopenblas -fdisable-default-paths
--extra-include-dirs=/nix/store/3mj5i7xqii2kd3dpx9avkxmyhnig9zv7-openblas-0.2.20/include
--extra-lib-dirs=/nix/store/3mj5i7xqii2kd3dpx9avkxmyhnig9zv7-openblas-0.2.20/lib
--extra-lib-dirs=/nix/store/bgbhyzfx5yilan9qydnzyxybd71am6dz-liblapack-3.4.1/lib
--extra-include-dirs=/nix/store/vgbc1jcn639f4nrrszxyaagxx0frss2a-atlas-3.10.2/include
--extra-lib-dirs=/nix/store/vgbc1jcn639f4nrrszxyaagxx0frss2a-atlas-3.10.2/lib
--extra-include-dirs=/nix/store/cfl3g7nakfffmk3a9g8frjbj74wfayra-libc++-4.0.1/include
--extra-lib-dirs=/nix/store/cfl3g7nakfffmk3a9g8frjbj74wfayra-libc++-4.0.1/lib
then this step succeeds
Using a sandbox located at /Users/dom/hmatrix/packages/base/.cabal-sandbox
/Users/dom/.nix-profile/bin/ghc --numeric-version
looking for tool ghc-pkg near compiler in /Users/dom/.nix-profile/bin
found ghc-pkg in /Users/dom/.nix-profile/bin/ghc-pkg
/Users/dom/.nix-profile/bin/ghc-pkg --version
/Users/dom/.nix-profile/bin/ghc --supported-languages
/Users/dom/.nix-profile/bin/ghc --info
Reading available packages...
index-state(hackage.haskell.org) = 2018-01-09T20:11:22Z
index-state() =
/Users/dom/.nix-profile/bin/pkg-config --version
/Users/dom/.nix-profile/bin/pkg-config --list-all
/Users/dom/.nix-profile/bin/pkg-config --modversion
Failed to query pkg-config, Cabal will continue without solving for pkg-config
constraints: dieVerbatim: user error (CallStack (from HasCallStack):
die', called at ./Distribution/Simple/Program/Run.hs:171:7 in
Cabal-2.0.1.1-AinAwvgvuAO6LrBWWFTAd2:Distribution.Simple.Program.Run
getProgramInvocationOutput, called at ./Distribution/Simple/Program.hs:165:3
in Cabal-2.0.1.1-AinAwvgvuAO6LrBWWFTAd2:Distribution.Simple.Program
getProgramOutput, called at ./Distribution/Solver/Types/PkgConfigDb.hs:70:28
in main:Distribution.Solver.Types.PkgConfigDb
cabal: '/Users/dom/.nix-profile/bin/pkg-config' exited with an error:
Must specify package names on the command line
)
Resolving dependencies...
Using internal setup method with build-type Simple and args:
["configure","--verbose=2","--ghc","--prefix=/nix/store/xjkd9wwym237wbza28hr8mysq9rp0cp3-hmatrix-0.18.1.1","--bindir=$prefix/bin","--libdir=/lib/","--libsubdir=","--dynlibdir=$libdir/$abi","--libexecdir=$prefix/libexec","--libexecsubdir=$abi/$pkgid","--datadir=$prefix/share","--datasubdir=$abi/$pkgid","--docdir=/nix/store/nhkhx3aa32bk8dpilf3g7mhrpa9y1jmq-hmatrix-0.18.1.1-doc/share/doc","--htmldir=$docdir/html","--haddockdir=$htmldir","--sysconfdir=$prefix/etc","--enable-library-vanilla","--disable-library-profiling","--enable-shared","--enable-executable-dynamic","--disable-profiling","--disable-split-objs","--global","--package-db=/Users/dom/hmatrix/packages/base/.cabal-sandbox/x86_64-osx-ghc-8.0.2-packages.conf.d","--flags=openblas","--flags=disable-default-paths","--extra-include-dirs=/nix/store/3mj5i7xqii2kd3dpx9avkxmyhnig9zv7-openblas-0.2.20/include","--extra-include-dirs=/nix/store/vgbc1jcn639f4nrrszxyaagxx0frss2a-atlas-3.10.2/include","--extra-include-dirs=/nix/store/cfl3g7nakfffmk3a9g8frjbj74wfayra-libc++-4.0.1/include","--ipid=hmatrix-0.18.1.1-D06BQIMqMCsIs1bt9tbOUn","--extra-lib-dirs=/nix/store/3mj5i7xqii2kd3dpx9avkxmyhnig9zv7-openblas-0.2.20/lib","--extra-lib-dirs=/nix/store/bgbhyzfx5yilan9qydnzyxybd71am6dz-liblapack-3.4.1/lib","--extra-lib-dirs=/nix/store/vgbc1jcn639f4nrrszxyaagxx0frss2a-atlas-3.10.2/lib","--extra-lib-dirs=/nix/store/cfl3g7nakfffmk3a9g8frjbj74wfayra-libc++-4.0.1/lib","--extra-prog-path=/Users/dom/.cabal/bin","--dependency=array=array-0.5.1.1","--dependency=base=base-4.9.1.0","--dependency=binary=binary-0.8.3.0","--dependency=bytestring=bytestring-0.10.8.1","--dependency=deepseq=deepseq-1.4.2.0","--dependency=random=random-1.1-9tceXaeYIMZ4JrKq20Egog","--dependency=semigroups=semigroups-0.18.3-IxQNmCA7qrSEQNkoHSF7A","--dependency=split=split-0.2.3.2-CJl40zTyCIV16Pr60nb7CT","--dependency=storable-complex=storable-complex-0.2.2-68P661PjpFUQpfwmdxcda","--dependency=vector=vector-0.12.0.1-BtK5bVORdhu8bC6gqUfFYi","--enable-tests","--disable-coverage","--exact-configuration","--disable-benchmarks","--with-gcc=clang","--ghc-option=-optl=-Wl,-headerpad_max_install_names","--ghc-option=-j1"]
Configuring hmatrix-0.18.1.1...
Flags chosen: disable-default-paths=True, openblas=True
Dependency array ==0.5.1.1: using array-0.5.1.1
Dependency base ==4.9.1.0: using base-4.9.1.0
Dependency binary ==0.8.3.0: using binary-0.8.3.0
Dependency bytestring ==0.10.8.1: using bytestring-0.10.8.1
Dependency deepseq ==1.4.2.0: using deepseq-1.4.2.0
Dependency random ==1.1: using random-1.1
Dependency semigroups ==0.18.3: using semigroups-0.18.3
Dependency split ==0.2.3.2: using split-0.2.3.2
Dependency storable-complex ==0.2.2: using storable-complex-0.2.2
Dependency vector ==0.12.0.1: using vector-0.12.0.1
Source component graph: component lib
Configured component graph:
component hmatrix-0.18.1.1-D06BQIMqMCsIs1bt9tbOUn
include base-4.9.1.0
include binary-0.8.3.0
include array-0.5.1.1
include deepseq-1.4.2.0
include random-1.1-9tceXaeYIMZ4JrKq20Egog
include split-0.2.3.2-CJl40zTyCIV16Pr60nb7CT
include bytestring-0.10.8.1
include storable-complex-0.2.2-68P661PjpFUQpfwmdxcda
include semigroups-0.18.3-IxQNmCA7qrSEQNkoHSF7A
include vector-0.12.0.1-BtK5bVORdhu8bC6gqUfFYi
Linked component graph:
unit hmatrix-0.18.1.1-D06BQIMqMCsIs1bt9tbOUn
include base-4.9.1.0
include binary-0.8.3.0
include array-0.5.1.1
include deepseq-1.4.2.0
include random-1.1-9tceXaeYIMZ4JrKq20Egog
include split-0.2.3.2-CJl40zTyCIV16Pr60nb7CT
include bytestring-0.10.8.1
include storable-complex-0.2.2-68P661PjpFUQpfwmdxcda
include semigroups-0.18.3-IxQNmCA7qrSEQNkoHSF7A
include vector-0.12.0.1-BtK5bVORdhu8bC6gqUfFYi
Numeric.LinearAlgebra=hmatrix-0.18.1.1-D06BQIMqMCsIs1bt9tbOUn:Numeric.LinearAlgebra,Numeric.LinearAlgebra.Data=hmatrix-0.18.1.1-D06BQIMqMCsIs1bt9tbOUn:Numeric.LinearAlgebra.Data,Numeric.LinearAlgebra.Devel=hmatrix-0.18.1.1-D06BQIMqMCsIs1bt9tbOUn:Numeric.LinearAlgebra.Devel,Numeric.LinearAlgebra.HMatrix=hmatrix-0.18.1.1-D06BQIMqMCsIs1bt9tbOUn:Numeric.LinearAlgebra.HMatrix,Numeric.LinearAlgebra.Static=hmatrix-0.18.1.1-D06BQIMqMCsIs1bt9tbOUn:Numeric.LinearAlgebra.Static
Ready component graph:
definite hmatrix-0.18.1.1-D06BQIMqMCsIs1bt9tbOUn
depends base-4.9.1.0
depends binary-0.8.3.0
depends array-0.5.1.1
depends deepseq-1.4.2.0
depends random-1.1-9tceXaeYIMZ4JrKq20Egog
depends split-0.2.3.2-CJl40zTyCIV16Pr60nb7CT
depends bytestring-0.10.8.1
depends storable-complex-0.2.2-68P661PjpFUQpfwmdxcda
depends semigroups-0.18.3-IxQNmCA7qrSEQNkoHSF7A
depends vector-0.12.0.1-BtK5bVORdhu8bC6gqUfFYi
Using Cabal-2.0.1.1 compiled by ghc-8.0
Using compiler: ghc-8.0.2
Using install prefix:
/nix/store/xjkd9wwym237wbza28hr8mysq9rp0cp3-hmatrix-0.18.1.1
Executables installed in:
/nix/store/xjkd9wwym237wbza28hr8mysq9rp0cp3-hmatrix-0.18.1.1/bin
Libraries installed in: /lib/
Dynamic Libraries installed in: /lib//x86_64-osx-ghc-8.0.2
Private executables installed in:
/nix/store/xjkd9wwym237wbza28hr8mysq9rp0cp3-hmatrix-0.18.1.1/libexec/x86_64-osx-ghc-8.0.2/hmatrix-0.18.1.1
Data files installed in:
/nix/store/xjkd9wwym237wbza28hr8mysq9rp0cp3-hmatrix-0.18.1.1/share/x86_64-osx-ghc-8.0.2/hmatrix-0.18.1.1
Documentation installed in:
/nix/store/nhkhx3aa32bk8dpilf3g7mhrpa9y1jmq-hmatrix-0.18.1.1-doc/share/doc
Configuration files installed in:
/nix/store/xjkd9wwym237wbza28hr8mysq9rp0cp3-hmatrix-0.18.1.1/etc
No alex found
Using ar found on system at:
/nix/store/lb93fgb9hm5ispds27rp34zb1j24v9v8-cctools-binutils-darwin/bin/ar
No c2hs found
No cpphs found
No doctest found
Using gcc version 4.2.1 given by user at: /usr/bin/clang
Using ghc version 8.0.2 found on system at: /Users/dom/.nix-profile/bin/ghc
Using ghc-pkg version 8.0.2 found on system at:
/Users/dom/.nix-profile/bin/ghc-pkg
No ghcjs found
No ghcjs-pkg found
No greencard found
Using haddock version 2.17.3 found on system at:
/Users/dom/.nix-profile/bin/haddock
No happy found
Using haskell-suite found on system at: haskell-suite-dummy-location
Using haskell-suite-pkg found on system at: haskell-suite-pkg-dummy-location
No hmake found
Using hpc version 0.67 found on system at: /Users/dom/.nix-profile/bin/hpc
Using hsc2hs version 0.68.1 found on system at:
/Users/dom/.nix-profile/bin/hsc2hs
No hscolour found
No jhc found
Using ld found on system at:
/nix/store/p1fm10d3hr68nrjddq7zr38zax5pgjax-clang-wrapper-4.0.1/bin/ld
No lhc found
No lhc-pkg found
Using pkg-config version 0.29.2 found on system at:
/Users/dom/.nix-profile/bin/pkg-config
Using runghc version 8.0.2 found on system at:
/Users/dom/.nix-profile/bin/runghc
Using strip found on system at: /usr/bin/strip
Using tar found on system at: /usr/bin/tar
No uhc found
NB that the flags are set correctly: Flags chosen: disable-default-paths=True, openblas=True
Seems like this is happening because of the preConfigure options for hmatrix
.
preConfigure = "sed -i hmatrix.cabal -e '/\\/usr\\//D'";
I have created my own nix file using cabal2nix
and then commenting out the offending line. Specifically I have
hmatrix =
pkgs.haskell.lib.enableCabalFlag (pkgs.haskell.lib.enableCabalFlag (haskellPackagesNew.callPackage ./hmatrix.nix { }) "openblas") "disable-default-paths";
and
{ mkDerivation, array, base, binary, openblas, bytestring, deepseq
, liblapack, random, semigroups, split, stdenv, storable-complex
, vector
}:
mkDerivation {
pname = "hmatrix";
version = "0.18.1.1";
src = /Users/dom/hmatrix/packages/base;
libraryHaskellDepends = [
array base binary bytestring deepseq random semigroups split
storable-complex vector
];
librarySystemDepends = [ openblas liblapack ];
# preConfigure = "sed -i hmatrix.cabal -e '/\\/usr\\//D'";
homepage = "https://github.com/albertoruiz/hmatrix";
description = "Numeric Linear Algebra";
license = stdenv.lib.licenses.bsd3;
}
Now it compiles but linking fails:
[27 of 27] Compiling Numeric.LinearAlgebra.HMatrix ( src/Numeric/LinearAlgebra/HMatrix.hs, dist/build/Numeric/LinearAlgebra/HMatrix.o )
ld: framework not found Accelerate
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
`cc' failed in phase `Linker'. (Exit code: 1)
note: keeping build directory ‘/private/tmp/nix-build-hmatrix-0.18.1.1.drv-41’
builder for ‘/nix/store/nxjafarxcbkhkbzc272fhihqlh7m3cs2-hmatrix-0.18.1.1.drv’ failed with exit code 1
cannot build derivation ‘/nix/store/jb22nf039plngnc8w107nay0zzpl5hdx-project1-1.0.0.drv’: 1 dependencies couldn't be built
error: build of ‘/nix/store/jb22nf039plngnc8w107nay0zzpl5hdx-project1-1.0.0.drv’ failed
You are missing the override found in configuration-nix.nix
.
hmatrix = if pkgs.stdenv.isDarwin
then addBuildDepend super.hmatrix pkgs.darwin.apple_sdk.frameworks.Accelerate
else super.hmatrix;
{ mkDerivation, array, base, binary, openblas, bytestring, deepseq
, random, semigroups, split, stdenv, storable-complex
, vector
, fetchFromGitHub
, darwin
}:
let
src = fetchFromGitHub {
owner = "albertoruiz";
repo = "hmatrix";
rev = "0d4018b09f1d38bbc05fdc0d8197d0f8a6ce5571";
sha256 = "0l6pvgkrykjkdi3q71qh7b2fk5alnf9qr9fi80dwj9xyaqpiwn3l";
};
in
mkDerivation {
pname = "hmatrix";
version = "0.18.1.1";
src = "${src}/packages/base";
buildDepends = [ (stdenv.lib.optionals stdenv.isDarwin darwin.apple_sdk.frameworks.Accelerate) ];
configureFlags = [
"-fdisable-default-paths"
"-fopenblas"
];
libraryHaskellDepends = [
array base binary bytestring deepseq random semigroups split
storable-complex vector
];
librarySystemDepends = [ openblas ];
# preConfigure = "sed -i hmatrix.cabal -e '/\\/usr\\//D'";
homepage = "https://github.com/albertoruiz/hmatrix";
description = "Numeric Linear Algebra";
license = stdenv.lib.licenses.bsd3;
}
# I have many questions:
#
# 1. I would like to use the blas that comes with OSX but if I replace
# openblas by blas, this derivation(?) picks up the Haskell package
# called blas not the nix package called blas
#
# bash-3.2$ nix-env -qaPf /Users/dom/nixpkgs |
# grep -i blas
#
# blas blas-3.7.1
#
# bash-3.2$ nix-env -f /Users/dom/nixpkgs -qaP -A haskellPackages |
# grep -i blas
#
# haskellPackages.blas blas-0.7.6
@copumpkin comments
copumpkin> no 5:34 PM optionals takes a list and returns a list 5:34 PM which means that you're not passing it what it expects, and it'll do weird stuff if we get stricter about types 5:34 PM plus shouldn't it be buildInputs? 5:34 PM lib.optional will take a single value and wrap it in a list or return an empty list 5:35 PM lib.optionals takes a list and return it or return an empty list
5:34 PM plus shouldn't it be buildInputs? no because the haskellPackages.mkDerivation is changing all of the things compared to the stdenv.mkDerivation, while keeping the same name
I think this an be closed now?
Issue description
nix-build
fails with a cabal configure errorSteps to reproduce
nix-build --attr project1 release1.nix
release1.nix:
default.nix:
hmatrix.nix:
hmatrix.cabal:
The failure is
Here is the relevant line:
https://github.com/albertoruiz/hmatrix/blob/master/packages/base/hmatrix.cabal#L119
Technical details
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the results.