I'm trying to download the HERMIT tool using the command cabal install hermit.
I dowloaded Haskell using GHCup. If I try to install with GHC 9.2.5 (recommended version by GHCup), I get errors like the following:
src\Text\PrettyPrint\MarkedHughesPJ.hs:487:43: error:
Ambiguous occurrence `<>'
It could refer to
either `Prelude.<>',
imported from `Prelude' at src\Text\PrettyPrint\MarkedHughesPJ.hs:33:8-38
(and originally defined in `GHC.Base')
or `Text.PrettyPrint.MarkedHughesPJ.<>',
defined at src\Text\PrettyPrint\MarkedHughesPJ.hs:629:3
|
487 | go y (z:zs) = (y <> p) : go z zs
| ^^
cabal-3.6.2.0.exe: Failed to build marked-pretty-1.1.2.1 (which is required by
exe:hermit from hermit-0.7.1.0). See the build log above for details.
Given that the tool is pretty old, my suspicion is that it should work with an older GHC version. GHCup list gives me versions from 7.10.3 till 9.4.4.
If I run with GHC 7.10.3, I get a different kind of error:
Failed to build kure-2.18.6.
Build log (
C:\cabal\logs\ghc-7.10.3\kure-2.18.6-b07c497f3357de591e4a4906067e2a1c674021a6.log
):
Preprocessing library for kure-2.18.6..
Building library for kure-2.18.6..
Language\KURE\BiTransform.hs:41:8:
Could not find module `Control.Monad.Fail'
It is a member of the hidden package `fail-4.9.0.0#JWbBevols3d7TkSXAGkvyg'.
Perhaps you need to add `fail' to the build-depends in your .cabal file.
Use -v to see a list of the files searched for.
cabal-3.6.2.0.exe: Failed to build kure-2.18.6 (which is required by
exe:hermit from hermit-1.0.1). See the build log above for details.
Very weird, since GHC 7.10.3 is recommended?
So, having no other options, I continued exploring versions. For GHC 8.0.2, I got yet another error:
Failed to build kure-2.18.6.
Build log (
C:\cabal\logs\ghc-8.0.2\kure-2.18.6-0171a393aff229af835cd303562178192d2a6c3c.log
):
Preprocessing library for kure-2.18.6..
Building library for kure-2.18.6..
[ 1 of 15] Compiling Language.KURE.Combinators.Monad ( Language\KURE\Combinators\Monad.hs, dist\build\Language\KURE\Combinators\Monad.o )
[ 2 of 15] Compiling Language.KURE.MonadCatch ( Language\KURE\MonadCatch.hs, dist\build\Language\KURE\MonadCatch.o )
[ 3 of 15] Compiling Language.KURE.Transform ( Language\KURE\Transform.hs, dist\build\Language\KURE\Transform.o )
Language\KURE\Transform.hs:241:42: error:
Not in scope: type constructor or class `Semigroup'
cabal-3.6.2.0.exe: Failed to build kure-2.18.6 (which is required by
exe:hermit from hermit-0.7.1.0). See the build log above for details.
I even tried installing on a virtual machine on the latest Ubuntu (my host PC is Windows 11), but I was stuck with the same kind of errors.
What should i try next? How to set a GHC in GHCup which is not listed anymore as availible? (an older GHC version may be the answer). Since I get this text back:
PS C:\Users\broland> ghcup install ghc 7.8.4
[ Info ] downloading: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-0.0.7.yaml as file C:\ghcup\cache\ghcup-0.0.7.yaml
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
[ Warn ] New ghc version available. To upgrade, run 'ghcup install ghc 9.4.4'
[ Warn ] New cabal version available. To upgrade, run 'ghcup install cabal 3.8.1.0'
[ Warn ] New stack version available. To upgrade, run 'ghcup install stack 2.9.3'
[ Info ] verifying digest of: gs.exe
[ Error ] Unable to find a download for the requested version/distro.
[ Error ] Also check the logs in C:\ghcup\logs
PS: I would like to stick to GHCup because it makes handling dependencies easy, I also tried downloading binary packages and that way I got stuck in another error...
Related
I've been trying to compile the Kadena chainweb-node project from source (via the docs found here) in a docker container running the arm64v8/ubuntu base image on an Apple M1 host machine and I keep getting errors. Thanks to the super helpful folks in the #haskell IRC channel, I've made it over a number of small hurdles, but the build still fails with:
Undefined symbol: ossl_sha3_512_functions
I can not find any resources on how to fix this but one of the #haskell community members informed me that these symbols are not provided by the openssl 3.0 API. That person created an issue here: https://github.com/larskuhtz/hs-hashes/issues/14
I've found that I can use the docker base image haskell:8 which comes preinstalled with ghc, cabal, and openssl 1.1.1 to cabal build chainweb-node successfully using a slightly different set of apt-get dependencies. However, when trying to cabal install the binaries so that I can run chainweb-node, I get:
Failed to build chainweb-2.14.1. The failure occurred during the configure
step.
Build log (
/root/.cabal/logs/ghc-8.10.7/chainweb-2.14.1-36aedf5adc1967eb17358e6434b6fd51bc7e64082f6c12e0df40ddafece6ff69.log
):
[1 of 1] Compiling Main ( /tmp/cabal-install.-838/dist-newstyle/tmp/src-838/chainweb-2.14.1/dist/setup/setup.hs, /tmp/cabal-install.-838/dist-newstyle/tmp/src-838/chainweb-2.14.1/dist/setup/Main.o )
Linking /tmp/cabal-install.-838/dist-newstyle/tmp/src-838/chainweb-2.14.1/dist/setup/setup ...
Configuring chainweb-2.14.1...
setup: Encountered missing or private dependencies:
criterion -any,
data-ordlist >=0.4.7,
resource-pool >=0.2,
retry >=0.7,
statistics >=0.15,
tasty-json >=0.1
cabal: Failed to build chainweb-2.14.1. See the build log above for details.
I've tried cabal install criterion and the other missing deps, one by one, but the cabal install gives me the same errors.
Can someone tell me what I'm doing wrong and help me get a working chainweb-node binary built from source and installed using docker?
I tried running my program which uses Haskell QuickCheck via ghc MyProgramm.hs , but received the following error:
$ ghc Ex2.hs
[1 of 1] Compiling Ex2 ( Ex2.hs, Ex2.o )
Ex2.hs:21:1: error:
Could not find module ‘Test.QuickCheck’
There are files missing in the ‘QuickCheck-2.11.3’ package,
try running 'ghc-pkg check'.
Use -v to see a list of the files searched for.
|
21 | import Test.QuickCheck (
| ^^^^^^^^^^^^^^^^^^^^^^^^...
I installed stack, ran stack update and stack install QuickCheck without issue but the error persisted. Then, I ran cabal install QuickCheck and got the following errors:
$ cabal install QuickCheck
Resolving dependencies...
Configuring QuickCheck-2.12.4...
Building QuickCheck-2.12.4...
Failed to install QuickCheck-2.12.4
Build log ( /home/username/.cabal/logs/ghc-8.4.3/QuickCheck-2.12.4-3d2YDDqfPBn4BfmTJbpJXK.log ):
cabal: Entering directory '/tmp/cabal-tmp-9133/QuickCheck-2.12.4'
Configuring QuickCheck-2.12.4...
Preprocessing library for QuickCheck-2.12.4..
Building library for QuickCheck-2.12.4..
[ 1 of 16] Compiling Test.QuickCheck.Exception ( Test/QuickCheck/Exception.hs, dist/build/Test/QuickCheck/Exception.o )
[ 2 of 16] Compiling Test.QuickCheck.Random ( Test/QuickCheck/Random.hs, dist/build/Test/QuickCheck/Random.o )
Test/QuickCheck/Random.hs:10:1: error:
Could not find module ‘System.Random’
There are files missing in the ‘random-1.1’ package,
try running 'ghc-pkg check'.
Use -v to see a list of the files searched for.
|
10 | import System.Random
| ^^^^^^^^^^^^^^^^^^^^
Test/QuickCheck/Random.hs:11:1: error:
Could not find module ‘System.Random.TF’
There are files missing in the ‘tf-random-0.5’ package,
try running 'ghc-pkg check'.
Use -v to see a list of the files searched for.
|
11 | import System.Random.TF
| ^^^^^^^^^^^^^^^^^^^^^^^
Test/QuickCheck/Random.hs:12:1: error:
Could not find module ‘System.Random.TF.Gen’
There are files missing in the ‘tf-random-0.5’ package,
try running 'ghc-pkg check'.
Use -v to see a list of the files searched for.
|
12 | import System.Random.TF.Gen(splitn)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cabal: Leaving directory '/tmp/cabal-tmp-9133/QuickCheck-2.12.4'
cabal: Error: some packages failed to install:
QuickCheck-2.12.4-3d2YDDqfPBn4BfmTJbpJXK failed during the building phase. The
exception was:
ExitFailure 1
However, I already have the arch packages haskell-random, haskell-tf-random and haskell-mwc-random installed. Does anybody know how to fix this?
Edit: I also ran cabal install random --reinstall.
Problem
On Archlinux as of 2022-09-17, pacman -S ghc cabal-install will install
system packages that provide only dynamic files (.so, .dyn_hi) in
installed packages inside /usr/lib/ghc-*; static files (.a, .hi) are (for
the most part) missing. However, the default cabal configuration enables static file
building. Unfortunately, upstream cabal-install doesn't track whether or not
static files are available inside installed packages. It just assumes they
are, and when they are gone, it fails with errors such as you have found:
[1 of 1] Compiling Main ( Main.hs, ../setup.dist/work/depender/dist/build/depender/depender-tmp/Main.o )
Main.hs:3:1: error:
Could not find module `Dynamic'
There are files missing in the `dynamic-1.0' package,
try running 'ghc-pkg check'.
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
| import qualified Dynamic (number)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Workaround
A quick workaround just to get up and running quickly is to disable static file
building, which is by default enabled. (Note that trying to pass package-local
flags to disable static file with e.g. --enable-shared --enable-executable-dynamic --disable-library-vanilla (which is how most if
not all current Archlinux Haskell packages seem to build packages, e.g. with
https://github.com/archlinux/svntogit-community/blob/master/haskell-scientific/trunk/PKGBUILD)
building using cabal-install may be ignored due to another, related bug; but
~/.cabal/config is a safe bet.) You may do so by adding 3 lines to
~/.cabal/config in the appropriate location:
library-vanilla: False
shared: True
executable-dynamic: True
(Alternatively, consider using alternative tools like stack.)
More complete solution
For a more long-term solution, one option involves 2 pieces: 1) one or more
system packages that provide all types of build artifacts, static and dynamic,
for the base, foundational packages (from GHC and cabal-install), at least as an option besides dynamic-only packages (secondary Haskell packages are optional,
since cabal-install can rebuild these with needed build artifacts (static or
dynamic)), and 2) patching cabal-install (and ghc-pkg, which can handle .conf
files recording information about installed packages) to track whether static
files are available, and to be aware of these when resolving dependencies so
that cabal-install knows when to prefer rebuild a source package with needed
build artifact configuration over an already installed package that doesn't
provid required build artifacts.
There is a merge request (I submitted) that provides such a patchset, called
fix-dynamic-deps, at https://github.com/haskell/cabal/pull/8461. For users
running into exactly the problem that you described (myself included), I also
created an AUR package that provides both pieces based on GHC 9.4.2 with Cabal
3.9.0.0 that includes my patchset (there is a mirror at
https://github.com/bairyn/ghc-cabal-arts.) It provides ghc and
cabal-install but includes both of these pieces.
Further reading
Here are a few more resources I wrote on or are related to this bug:
https://wiki.archlinux.org/index.php?title=Haskell&diff=745459&oldid=738269#Troubleshooting
https://github.com/haskell/cabal/pull/8461
https://github.com/bairyn/ghc-cabal-arts
https://github.com/bairyn/cabal/tree/fix-dynamic-builds
Even though I have a main = do and couldn't get it working that way, I was able to run my QuickCheck test as follows:
To run a quickCheck, first load your program with:
$ ghci MyProg.hs
Then to run the quickCheck, find the test you want to run, then run it with:
$ quickCheck my_quick_check
I've had nothing but trouble using cabal, not sure if it's due to a lack of understanding, or a faulty mental model, but things have been tough.
At the moment I'm just trying to get ghc-mod to work for my vim plugins. It usually works for a day or two and then starts failing for seemingly no reason with an error, the error I receive seems to change from time to time, right now I'm getting this one:
$ ghc-mod check Main.hs
ghc-mod: /Users/chris/.stack/snapshots/x86_64-osx/lts-6.15/7.10.3/pkgdb/package.cache:
GHC.PackageDb.readPackageDb: inappropriate type (Not a valid Unicode code point!)
Any ideas about how to fix this sort of thing? I've tried installing it again, but I get this (I think my cabal packages are all screwed up but don't know how to fix it):
$ cabal install ghc-mod
Resolving dependencies...
Downloading haskell-src-exts-1.17.1...
Configuring haskell-src-exts-1.17.1...
Failed to install haskell-src-exts-1.17.1
Build log ( /Users/chris/.cabal/logs/haskell-src-exts-1.17.1.log ):
cabal: Entering directory '/var/folders/6l/rdh2g5wn41s8vxchngkt02_c0000gn/T/cabal-tmp-45583/haskell-src-exts-1.17.1'
Configuring haskell-src-exts-1.17.1...
cabal: The program 'happy' version >=1.19 is required but it could not be
found.
cabal: Leaving directory '/var/folders/6l/rdh2g5wn41s8vxchngkt02_c0000gn/T/cabal-tmp-45583/haskell-src-exts-1.17.1'
cabal: Error: some packages failed to install:
ghc-mod-5.6.0.0 depends on haskell-src-exts-1.17.1 which failed to install.
haskell-src-exts-1.17.1 failed during the configure step. The exception was:
ExitFailure 1
hlint-1.9.35 depends on haskell-src-exts-1.17.1 which failed to install.
Edit:
Looked away for a second and tried again, now I'm getting this error, getting kinda sick of cabal changing its mind all the time:
$ ghc-mod check Main.hs
[1 of 5] Compiling CabalHelper.Common ( CabalHelper/Common.hs, /Users/chris/.ghc-mod/cabal-helper/CabalHelper/Common.o )
[2 of 5] Compiling CabalHelper.Licenses ( CabalHelper/Licenses.hs, /Users/chris/.ghc-mod/cabal-helper/CabalHelper/Licenses.o )
CabalHelper/Licenses.hs:53:18: error:
Ambiguous occurrence ‘lookupInstalledPackageId’
It could refer to either ‘Distribution.Simple.PackageIndex.lookupInstalledPackageId’,
imported from ‘Distribution.Simple.PackageIndex’ at CabalHelper/Licenses.hs:24:1-39
or ‘CabalHelper.Licenses.lookupInstalledPackageId’,
defined at CabalHelper/Licenses.hs:38:1
CabalHelper/Licenses.hs:74:10: error:
Ambiguous occurrence ‘lookupInstalledPackageId’
It could refer to either ‘Distribution.Simple.PackageIndex.lookupInstalledPackageId’,
imported from ‘Distribution.Simple.PackageIndex’ at CabalHelper/Licenses.hs:24:1-39
or ‘CabalHelper.Licenses.lookupInstalledPackageId’,
defined at CabalHelper/Licenses.hs:38:1
ghc-mod: readCreateProcess: /Users/chris/.stack/snapshots/x86_64-osx/lts-6.15/7.10.3/libexec/cabal-helper-wrapper "--with-ghc=/usr/local/bin/ghc" "--with-ghc-pkg=/usr/local/bin/ghc-pkg" "--with-cabal=cabal" "/Users/chris/dev/formatter" "/Users/chris/dev/formatter/.stack-work/dist/x86_64-osx/Cabal-1.24.0.0" "package-db-stack" "entrypoints" "source-dirs" "ghc-options" "ghc-src-options" "ghc-pkg-options" "ghc-merged-pkg-options" "ghc-lang-options" "licenses" "flags" "config-flags" "non-default-config-flags" "compiler-version" (exit 1): failed
This error was caused by having a mismatch between my local stack ghc version and the global ghc-mod ghc version, I updated the ghc version in the stack project to latest and everything is working fine.
I'm trying to install a package to the Haskell Platform in Cygwin. It requires the websockets package, for which the most recent version is 0.9.0.1.
My command looks like:
cabal install websockets
And I get the following error message during the build (it downloads fine):
Resolving dependencies...
Configuring websockets-0.9.0.1...
Building websockets-0.9.0.1...
Failed to install websockets-0.9.0.1
Last 10 lines of the build log ( C:\Users\username\AppData\Roaming\cabal\logs\websockets-0.9.0.1.log ):
Building websockets-0.9.0.1...
Preprocessing library websockets-0.9.0.1...
[ 1 of 11] Compiling Network.WebSockets.Hybi13.Mask ( src\Network\WebSockets\Hybi13\Mask.hs, dist\build\Network\WebSockets\Hybi13\Mask.o )
[ 2 of 11] Compiling Network.WebSockets.Http ( src\Network\WebSockets\Http.hs, dist\build\Network\WebSockets\Http.o )
[ 3 of 11] Compiling Network.WebSockets.Types ( src\Network\WebSockets\Types.hs, dist\build\Network\WebSockets\Types.o )
[ 4 of 11] Compiling Network.WebSockets.Stream ( src\Network\WebSockets\Stream.hs, dist\build\Network\WebSockets\Stream.o )
src\Network\WebSockets\Stream.hs:24:57:
Module `Network.Socket.ByteString.Lazy' does not export `sendAll'
cabal.exe: Error: some packages failed to install:
websockets-0.9.0.1 failed during the building phase. The exception was:
ExitFailure 1
I have a default install of Cygwin x64 and Haskell Platform x64 on Windows 7 Pro x64. Is there a workaround to this? Or am I missing some configuration?
I have the same cabal update issue mentioned at http://www.haskell.org/pipermail/beginners/2010-June/004357.html, where my updated cabal version is not being used (I keep getting notified about a newer version), but the install command keeps saying the new version installed fine. I'm not sure if that has something to do with this...
I did not find an actual answer for why the most current version of websockets won't build, but what fixed my issue is installing an older version of websockets.
cabal install websockets-0.8.6.2
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
It looks like most of the build is working but the actual install is failing.
A carefully place echo command reveals that this command is the one that is failing:
install_pkg "cabal-install"
This is the error I am receiving:
cleaning...
Linking Setup ...
Configuring cabal-install-1.17.0...
Building cabal-install-1.17.0...
Preprocessing library cabal-install-1.17.0...
[ 1 of 71] Compiling Distribution.Compat.FilePerms ( Distribution/Compat/FilePerms.hs, dist/build/Distribution/Compat/FilePerms.o )
[ 2 of 71] Compiling Distribution.Compat.Semaphore ( Distribution/Compat/Semaphore.hs, dist/build/Distribution/Compat/Semaphore.o )
Distribution/Compat/Semaphore.hs:12:26:
Module `Control.Exception' does not export `mask_'
Error during cabal-install bootstrap:
Building the cabal-install package failed
Here is the full transcript:
Checking installed packages for ghc-6.12.3...
Cabal is already installed and the version is ok.
transformers is already installed and the version is ok.
mtl is already installed and the version is ok.
deepseq is already installed and the version is ok.
text is already installed and the version is ok.
parsec is already installed and the version is ok.
network is already installed and the version is ok.
time is already installed and the version is ok.
HTTP is already installed and the version is ok.
zlib is already installed and the version is ok.
random is already installed and the version is ok.
stm is already installed and the version is ok.
===========================================
cleaning...
Linking Setup ...
Configuring cabal-install-1.17.0...
Building cabal-install-1.17.0...
Preprocessing library cabal-install-1.17.0...
[ 1 of 71] Compiling Distribution.Compat.FilePerms ( Distribution/Compat/FilePerms.hs, dist/build/Distribution/Compat/FilePerms.o )
[ 2 of 71] Compiling Distribution.Compat.Semaphore ( Distribution/Compat/Semaphore.hs, dist/build/Distribution/Compat/Semaphore.o )
Distribution/Compat/Semaphore.hs:12:26:
Module `Control.Exception' does not export `mask_'
Error during cabal-install bootstrap:
Building the cabal-install package failed