Is everything reinstalled from scratch in cabal sandboxes? - haskell

Let's assume the following procedure:
cd /home/user/experiment
git clone https://github.com/ryantrinkle/reflex.git
cabal sandbox init
cabal install --dependencies-only
Question:
At this point what packages will the sandbox in /home/user/experiment contain ? Will it contain the whole dependency hierarchy tree of Reflex ?
In other words, if Reflex is the root package then will the whole dependency tree of Reflex be compiled from scratch independently of what is installed already in the global package repository of cabal ?
I suspect yes, but I am not sure.
When I execute the above command sequence then the following packages are installed :
[vagrant#localhost reflex]$ cabal install --only-dependencies
Resolving dependencies...
Notice: installing into a sandbox located at /home/vagrant/reflex
Downloading dependent-sum-0.2.1.0...
Configuring base-orphans-0.3.3...
Downloading primitive-0.5.4.0...
Configuring mtl-2.2.1...
Building base-orphans-0.3.3...
Building mtl-2.2.1...
Installed base-orphans-0.3.3
Configuring nats-1...
Building nats-1...
Installed nats-1
Configuring stm-2.4.4...
Configuring tagged-0.8.0.1...
Installed mtl-2.2.1
Building stm-2.4.4...
Building tagged-0.8.0.1...
Configuring text-1.2.1.1...
Installed stm-2.4.4
Downloading ref-tf-0.4...
Configuring transformers-compat-0.4.0.4...
Installed tagged-0.8.0.1
Building text-1.2.1.1...
Building transformers-compat-0.4.0.4...
Configuring dependent-sum-0.2.1.0...
Installed transformers-compat-0.4.0.4
Building dependent-sum-0.2.1.0...
Configuring primitive-0.5.4.0...
Installed dependent-sum-0.2.1.0
Downloading dependent-map-0.1.1.3...
Building primitive-0.5.4.0...
Installed primitive-0.5.4.0
Configuring ref-tf-0.4...
Building ref-tf-0.4...
Installed ref-tf-0.4
Configuring StateVar-1.1.0.0...
Building StateVar-1.1.0.0...
Configuring distributive-0.4.4...
Installed StateVar-1.1.0.0
Building distributive-0.4.4...
Configuring dependent-map-0.1.1.3...
Installed distributive-0.4.4
Building dependent-map-0.1.1.3...
Configuring vector-0.10.12.3...
Installed dependent-map-0.1.1.3
Building vector-0.10.12.3...
Installed text-1.2.1.1
Configuring hashable-1.2.3.2...
Building hashable-1.2.3.2...
Installed hashable-1.2.3.2
Configuring unordered-containers-0.2.5.1...
Building unordered-containers-0.2.5.1...
Installed unordered-containers-0.2.5.1
Configuring semigroups-0.16.2.2...
Building semigroups-0.16.2.2...
Installed semigroups-0.16.2.2
Configuring void-0.7...
Configuring bifunctors-5...
Installed vector-0.10.12.3
Building void-0.7...
Building bifunctors-5...
Installed void-0.7
Configuring contravariant-1.3.1.1...
Building contravariant-1.3.1.1...
Installed contravariant-1.3.1.1
Configuring comonad-4.2.6...
Installed bifunctors-5
Building comonad-4.2.6...
Installed comonad-4.2.6
Configuring profunctors-5.1.1...
Configuring semigroupoids-5.0.0.2...
Building profunctors-5.1.1...
Building semigroupoids-5.0.0.2...
Installed profunctors-5.1.1
Installed semigroupoids-5.0.0.2
Downloading these-0.4.1...
Configuring these-0.4.1...
Building these-0.4.1...
Installed these-0.4.1
This seems an awful lot.
Are these exactly the packages contained in the dependency tree of Reflex ?
I suspect yes, but I am not sure, hence this question.

Not quite. At the moment, anything in the global package database is also used by sandboxes. I believe future versions of cabal-install will restrict this to a few whitelisted core packages that ship with GHC (and that shouldn't/can't be replaced anyway).

Related

Issue installing Snap on macOS Sierra

I'm having trouble installing the Haskell framework Snap on macOS Sierra. Whenever I install it, I get the following message:
Resolving dependencies...
Configuring securemem-0.1.9...
Configuring skein-1.0.9.4...
Configuring configurator-0.3.0.0...
Configuring cryptonite-0.24...
Building configurator-0.3.0.0...
Building securemem-0.1.9...
Building skein-1.0.9.4...
Failed to install configurator-0.3.0.0
Build log ( /Users/nicholas/.cabal/logs/ghc-8.2.1/configurator-0.3.0.0-6dySPcNCURWFswtMXJvzho.log ):
cabal: Entering directory '/tmp/cabal-tmp-66175/configurator-0.3.0.0'
Configuring configurator-0.3.0.0...
Preprocessing library for configurator-0.3.0.0..
Building library for configurator-0.3.0.0..
<command line>: cannot satisfy -package-id attoparsec-0.13.2.0-5dp4kBDsiGY4dQpLKbD5rk:
attoparsec-0.13.2.0-5dp4kBDsiGY4dQpLKbD5rk is unusable due to shadowed dependencies:
scientific-0.3.5.1-L0qYzdp0wpz8rO8gircNSR text-1.2.2.2-EGUst8sqNAZCw1xLPcmcMH
(use -v for more information)
cabal: Leaving directory '/tmp/cabal-tmp-66175/configurator-0.3.0.0'
Configuring transformers-base-0.4.4...
Building cryptonite-0.24...
Building transformers-base-0.4.4...
Installed securemem-0.1.9
Installed transformers-base-0.4.4
Installed skein-1.0.9.4
Installed cryptonite-0.24
Updating documentation index
/Users/nicholas/Library/Haskell/share/doc/x86_64-osx-ghc-8.2.1/index.html
cabal: Error: some packages failed to install:
configurator-0.3.0.0-6dySPcNCURWFswtMXJvzho failed during the building phase.
The exception was:
ExitFailure 1
snap-1.0.0.2-5CZKyA9EY4oLgkpHYCVfnv depends on snap-1.0.0.2 which failed to
install.
I'm using the Haskell Platform installed using homebrew (brew cask install haskell-platform), and cabal version 2.0.0.2. I have tried using sudo and deleting my ~/.ghc file
There was an issue with full 8.2.1 binary platform builds that's just been resolved: https://mail.haskell.org/pipermail/haskell-cafe/2017-October/127979.html
This was likely an instance of that.
(see also: GHC cannot find libraries on fresh install of Haskell-Platform)
This looks like a bug in Cabal 2 (or potentially GHC 8.2). See https://github.com/haskell/cabal/issues/4728. I'd recommend sticking to GHC 8.0.2 for the moment with either cabal 1.24 or Stack. I'm the case of Stack, the version won't matter, since it will use the Cabal version shipped with GHC.

Cant install glib on Windows when trying to install gtk3 using cabal

I have been trying to install gtk3 with cabal, following instructions on https://wiki.haskell.org/Gtk2Hs/Installation , with the exception I have replace gtk with gtk3, I downloaded the all in one bundle of gtk 3.6.4 (from: http://www.tarnyko.net/dl/gtk.htm) unzip it and added the location_of_files/bin to my path, running pkg-config --cflags gtk+-3.0 works ok, cabal install gtk2hs-buildtools correctly installs, but cabal install gtk3 stops with:
Resolving dependencies...
Configuring glib-0.13.4.1...
Failed to install glib-0.13.4.1
Build log ( C:\Users\User\AppData\Roaming\cabal\logs\glib-0.13.4.1.log ):
cabal: Entering directory 'C:\Users\User\AppData\Local\Temp\cabal-tmp-6472\glib-0.13.4.1'
[1 of 1] Compiling Main ( C:\Users\User\AppData\Local\Temp\cabal-tmp-6472\glib-0.13.4.1\dist\setup\setup.hs, C:\Users\User\AppData\Local\Temp\cabal-tmp-6472\glib-0.13.4.1\dist\setup\Main.o )
Linking C:\Users\User\AppData\Local\Temp\cabal-tmp-6472\glib-0.13.4.1\dist\setup\setup.exe ...
Configuring glib-0.13.4.1...
setup.exe: Missing dependency on a foreign library:
* Missing C library: intl
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
cabal: Leaving directory 'C:\Users\User\AppData\Local\Temp\cabal-tmp-6472\glib-0.13.4.1'
And the gtk bundle I download have a libintl.h file in the include folder and a dll in the bin folder, I tried placing the files in almost every location I could think of but to no avail, i can’t think of anything else.
More details: I am running windows 7 x64 with haskell-platform 8.0.2 x64, and I really need this to work under windows for a project I am working.
I manage to install gtk by following the instruction in https://www.gtk.org/download/windows.php, installing MSYS2 and using pacman to install gtk library, ignoring only step 4. After installing the libraries I added to my path C:\msys64\mingw64\bin, and cabal finally compiled gtk3.
I did not like this solution cause it is one more mingw installation on my pc.

Haskell - Cabal Install parsec errors

I've been trying to install the parsec library for haskell but I'm running in to a lot of errors. Im very new to haskell & cabal and i don't quite understand the output of the log file.
the output of the log file is here:
http://pastebin.com/6hPQN1W4
I tried installing the packages that the log file said that it could not find, but i keep getting errors when trying to install the packages.
I reinstalled cabal and also ran cabal update, but this did not resolve the issue
any help will be appreciated?
I suggest using stack tool with its stackage infrastructure. Please see http://haskellstack.org for more details.
You could try installing parsec in a sandbox.
$ mkdir asdf
$ cd asdf
$ cabal sandbox init
cabalWriting a default package environment file to
/Users/steshaw/Projects/asdf/cabal.sandbox.config
Creating a new sandbox at /Users/steshaw/Projects/asdf/.cabal-sandbox
$ cabal install parsec
Resolving dependencies...
Notice: installing into a sandbox located at
/Users/steshaw/Projects/steshaw/asdf/.cabal-sandbox
Configuring mtl-2.2.1...
Configuring text-1.2.2.1...
Building text-1.2.2.1...
Building mtl-2.2.1...
Installed mtl-2.2.1
Installed text-1.2.2.1
Configuring parsec-3.1.11...
Building parsec-3.1.11...
Installed parsec-3.1.11

Build Gem Native Extension

Passing on knowledge I just learned in the hopes of reducing the
headache others may experience with native gem extensions like I've
had.
TL;DR - Had an issue with bundle install. Read mkmf.log as mentioned in the error. The log had another error that I googled. Installed
necessary library. Afterwards, bundle install was successful.
Trying to install gems using bundler and getting errors about building gem native extensions:
$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/..
Resolving dependencies...
Installing daemons 1.2.3
Installing eventmachine 1.0.8 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/eventmachine-1.0.8/ext
/usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160309-8483-1so3k75.rb extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
<...>
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/usr/local/rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/eventmachine-1.0.8/mkmf.log
extconf failed, exit code 1
<...>
Installing mysql2 0.4.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/mysql2-0.4.3/ext/mysql2
/usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160309-8483-1oxfnj5.rb extconf.rb
checking for ruby/thread.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
<...>
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/usr/local/rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/mysql2-0.4.3/mkmf.log
extconf failed, exit code 1
<...>
Installing rack 1.6.4
Installing tilt 2.0.1
Using bundler 1.11.2
An error occurred while installing eventmachine (1.0.8), and Bundler cannot continue.
Make sure that `gem install eventmachine -v '1.0.8'` succeeds before bundling.
Passing on knowledge I just learned in the hopes of reducing the
headache others may experience with native gem extensions like I've
had.
TL;DR - Had an issue with bundle install. Read mkmf.log as mentioned in the error. The log had another error that I googled. Installed
necessary library. Afterwards, bundle install was successful.
I see that the errors point me to mkmf.log and where it's located. I open it up and check the error. Among other things it mentions the following on lines 2 and 3.
/usr/bin/ld: cannot find -lgmp
collect2: error: ld returned 1 exit status
I know from the error while during bundle install that it could be missing a library. So I search for a package called gmp. I find 2 libraries, one called libgmp10 and the other libgmp10-dev.
$ apt-cache search -n gmp
libgmp-dev - Multiprecision arithmetic library developers tools
libgmp10 - Multiprecision arithmetic library
<...>
I search my installed packages to see if I need to get one.
$ dpkg --get-selections | grep gmp
libgmp10:amd64 install
Since libgmp10 is already there, I try installing libgmp-dev. Then I run retry installing my gems, and it works!
$ sudo apt-get install libgmp-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libgmpxx4ldbl
Suggested packages:
libgmp10-doc libmpfr-dev
The following NEW packages will be installed:
libgmp-dev libgmpxx4ldbl
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 300 kB of archives.
After this operation, 1,675 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty/main libgmpxx4ldbl amd64 2:5.1.3+dfsg-1ubuntu1 [8,736 B]
Get:2 http://us.archive.ubuntu.com/ubuntu/ trusty/main libgmp-dev amd64 2:5.1.3+dfsg-1ubuntu1 [292 kB]
Fetched 300 kB in 0s (411 kB/s)
Selecting previously unselected package libgmpxx4ldbl:amd64.
(Reading database ... 218685 files and directories currently installed.)
Preparing to unpack .../libgmpxx4ldbl_2%3a5.1.3+dfsg-1ubuntu1_amd64.deb ...
Unpacking libgmpxx4ldbl:amd64 (2:5.1.3+dfsg-1ubuntu1) ...
Selecting previously unselected package libgmp-dev:amd64.
Preparing to unpack .../libgmp-dev_2%3a5.1.3+dfsg-1ubuntu1_amd64.deb ...
Unpacking libgmp-dev:amd64 (2:5.1.3+dfsg-1ubuntu1) ...
Setting up libgmpxx4ldbl:amd64 (2:5.1.3+dfsg-1ubuntu1) ...
Setting up libgmp-dev:amd64 (2:5.1.3+dfsg-1ubuntu1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.7) ...
$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/..
Resolving dependencies...
Using daemons 1.2.3
Installing eventmachine 1.0.8 with native extensions
Installing mysql2 0.4.3 with native extensions
Using rack 1.6.4
Using tilt 2.0.1
Using bundler 1.11.2
Installing rack-protection 1.5.3
Installing thin 1.6.4 with native extensions
Installing sinatra 1.4.6
Bundle complete! 3 Gemfile dependencies, 9 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

What can be done to resolve this dependency issue?

I'm trying to install aeson after resetting ~/.ghc and ~/.cabal.
cabal install aeson gives me the following error message:
Resolving dependencies...
cabal: Could not resolve dependencies:
next goal: aeson (user goal)
rejecting: aeson-0.9.0.1, 0.9.0.0, 0.8.1.1, 0.8.1.0 (global constraint
requires ==0.8.0.2)
trying: aeson-0.8.0.2
next goal: bytestring (user goal)
rejecting: bytestring-0.10.6.0, 0.10.4.1, 0.10.4.0, 0.10.2.0 (global
constraint requires installed instance)
rejecting: bytestring-0.10.0.2/installed-4f9... (conflict: aeson =>
bytestring>=0.10.4.0)
rejecting: bytestring-0.10.0.2, 0.10.0.1, 0.10.0.0, 0.9.2.1, 0.9.2.0,
0.9.1.10, 0.9.1.9, 0.9.1.8, 0.9.1.7, 0.9.1.6, 0.9.1.5, 0.9.1.4, 0.9.1.3,
0.9.1.2, 0.9.1.1, 0.9.1.0, 0.9.0.4, 0.9.0.3, 0.9.0.2, 0.9.0.1, 0.9 (global
constraint requires installed instance)
Dependency tree exhaustively searched.
The current version of bytestring package in my system is 0.10.2.0. I tried cabal install bytestring --reinstall so that I can have a more recent version of bytestring (thereby solving aeson dependency issue). But that returns a very odd error:
Resolving dependencies...
cabal: Could not resolve dependencies:
next goal: bytestring (user goal)
rejecting: bytestring-0.10.6.0, 0.10.4.1, 0.10.4.0, 0.10.2.0, 0.10.0.2,
0.10.0.1, 0.10.0.0, 0.9.2.1, 0.9.2.0, 0.9.1.10, 0.9.1.9, 0.9.1.8, 0.9.1.7,
0.9.1.6, 0.9.1.5, 0.9.1.4, 0.9.1.3, 0.9.1.2, 0.9.1.1, 0.9.1.0, 0.9.0.4,
0.9.0.3, 0.9.0.2, 0.9.0.1, 0.9 (global constraint requires installed instance)
Dependency tree exhaustively searched.
I can solve the problem by using sandboxes. But I'm interested to know if there is a nicer method resolve the dependency issue.
Update: Following a suggestion, I removed bytestring by ghc-pkg unregister --force bytestring, which broke some packages and am still not able to install aeson.
Following is the output of ghc-pkg list lists: http://lpaste.net/135108.
Where is your constraint (global constraint
requires ==0.8.0.2) coming from?
~/prog$ cd
~$ mkdir sbox
~$ cd sbox
~/sbox$ HOME=`pwd`
~$ export HOME
~$ cabal install bytestring
Config file path source is default config file.
Config file /home/novadenizen/sbox/.cabal/config not found.
Writing default configuration to /home/novadenizen/sbox/.cabal/config
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.
cabal: There is no package named 'bytestring'.
You may need to run 'cabal update' to get the latest list of available
packages.
~$ cabal update
Downloading the latest package list from hackage.haskell.org
~$ cabal install aeson
Resolving dependencies...
Downloading bytestring-0.10.6.0...
Downloading dlist-0.7.1.1...
Configuring dlist-0.7.1.1...
Downloading syb-0.5.1...
Downloading transformers-0.4.3.0...
Configuring syb-0.5.1...
Building dlist-0.7.1.1...
Building syb-0.5.1...
Installed dlist-0.7.1.1
Configuring bytestring-0.10.6.0...
Building bytestring-0.10.6.0...
Configuring transformers-0.4.3.0...
Installed syb-0.5.1
Building transformers-0.4.3.0...
Installed transformers-0.4.3.0
Downloading mtl-2.2.1...
Downloading primitive-0.6...
Configuring primitive-0.6...
Building primitive-0.6...
Configuring mtl-2.2.1...
Installed primitive-0.6
Downloading vector-0.10.12.3...
Building mtl-2.2.1...
Configuring vector-0.10.12.3...
Installed mtl-2.2.1
Building vector-0.10.12.3...
Installed bytestring-0.10.6.0
Downloading binary-0.7.5.0...
Configuring binary-0.7.5.0...
Building binary-0.7.5.0...
Installed binary-0.7.5.0
Downloading text-1.2.1.1...
Configuring text-1.2.1.1...
Building text-1.2.1.1...
Installed vector-0.10.12.3
Installed text-1.2.1.1
Downloading hashable-1.2.3.2...
Configuring hashable-1.2.3.2...
Building hashable-1.2.3.2...
Installed hashable-1.2.3.2
Downloading scientific-0.3.3.8...
Downloading unordered-containers-0.2.5.1...
Configuring scientific-0.3.3.8...
Configuring unordered-containers-0.2.5.1...
Building scientific-0.3.3.8...
Building unordered-containers-0.2.5.1...
Installed scientific-0.3.3.8
Downloading attoparsec-0.13.0.0...
Configuring attoparsec-0.13.0.0...
Building attoparsec-0.13.0.0...
Installed unordered-containers-0.2.5.1
Installed attoparsec-0.13.0.0
Downloading aeson-0.9.0.1...
Configuring aeson-0.9.0.1...
Building aeson-0.9.0.1...
Installed aeson-0.9.0.1
~$

Resources