Closed s5k6 closed 4 years ago
Hi @s5k6,
Have you tried running ghc-pkg -v0 check
?
Yes, ghc-pkg -v0 check
prints 510 error messages, the first of which are below. They all start with Warning: haddock-
.
$ ghc-pkg -v0 check 2>&1 |head
Warning: haddock-interfaces: /usr/share/doc/stack/html/stack.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/stack/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/pandoc/html/pandoc.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/pandoc/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-pantry/html/pantry.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-pantry/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-mustache/html/mustache.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-mustache/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-http/html/HTTP.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-http/html doesn't exist or isn't a directory
But I have found something else →next message
There seems to be a similar problem with cabal
$ cabal --version
cabal-install version 2.4.0.0
compiled using version 2.4.0.1 of the Cabal library
$ mkdir sfklshfsdf
$ cd sfklshfsdf
$ cabal init
[... answer manyquestions ...]
$ cabal v2-build
Resolving dependencies...
Build profile: -w ghc-8.6.5 -O1
In order, the following will be built (use -v for more details):
- sfklshfsdf-0.1.0.0 (exe:sfklshfsdf) (first run)
Configuring executable 'sfklshfsdf' for sfklshfsdf-0.1.0.0..
Preprocessing executable 'sfklshfsdf' for sfklshfsdf-0.1.0.0..
Building executable 'sfklshfsdf' for sfklshfsdf-0.1.0.0..
[1 of 1] Compiling Main ( Main.hs, /tmp/sfklshfsdf/dist-newstyle/build/x86_64-linux/ghc-8.6.5/sfklshfsdf-0.1.0.0/x/sfklshfsdf/build/sfklshfsdf/sfklshfsdf-tmp/Main.o )
Main.hs:1:8: error:
Could not find module ‘Prelude’
There are files missing in the ‘base-4.12.0.0’ package,
try running 'ghc-pkg check'.
Use -v to see a list of the files searched for.
|
1 | module Main where
| ^^^^
According to this stackoverflow question, the culprit is GHC (not) expecting shared libraries.
For cabal, adding
ghc-options: -dynamic
to the executable
section in the the .cabal
file solved the problem.
This solution, however, does not solve the problem for stack
, i.e., I've appended -dynamic
to all ghc-options
I could find in the stack
-generated .cabal
-file, but the error persists.
I think you'll want to pass ghc
options via stack.yaml
as described here instead. Are you able to make it work that way?
Hmm, after removing all comments from stack.yaml
, and adding the last two lines, it reads:
resolver: lts-14.11
packages:
- .
ghc-options:
"$locals": -dynamic
but the error seems to be the same:
$ stack build
[1 of 2] Compiling Main ( /home/sk/.stack/setup-exe-src/setup-mPHDZzAJ.hs, /home/sk/.stack/setup-exe-src/setup-mPHDZzAJ.o )
/home/sk/.stack/setup-exe-src/setup-mPHDZzAJ.hs:1:1: error:
Could not find module ‘Prelude’
There are files missing in the ‘base-4.12.0.0’ package,
try running 'ghc-pkg check'.
Use -v to see a list of the files searched for.
|
1 | import Distribution.Simple
| ^
/home/sk/.stack/setup-exe-src/setup-mPHDZzAJ.hs:1:1: error:
Could not find module ‘Distribution.Simple’
There are files missing in the ‘Cabal-2.4.0.1’ package,
try running 'ghc-pkg check'.
Use -v to see a list of the files searched for.
|
1 | import Distribution.Simple
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
-- While building simple Setup.hs using:
/usr/bin/ghc-8.6.5 -rtsopts -threaded -clear-package-db -global-package-db -hide-all-packages -package base -main-is StackSetupShim.mainOverride -package Cabal-2.4.0.1 /home/sk/.stack/setup-exe-src/setup-mPHDZzAJ.hs /home/sk/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs -o /home/sk/.stack/setup-exe-cache/x86_64-linux/tmp-Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.5
Process exited with code: ExitFailure 1
I've noticed, that -dynamic
does not show up in the line showing how the compiler is being called...
I'm kind of flying blind here since I don't have a setup that'll allow me to reproduce, but I wonder if swapping $locals
with $everything
would cause it to work?
In any case, we might have better luck consulting Arch's forums/wiki/etc since this problem seems to be more related to their package management strategy than stack
itself.
Based on the stack overflow link you pasted above there also appears to be an alternative ghc-static
package you could try installing - have you tried (+had any luck with) that instead?
About using $everything
: Same result.
I've just tested with additionally hinstalling the ghc-static
package (allegedly allocating another 1260.62 MiB), and it works.
Interestingly, with ghc-options: "$locals": -dynamic
, this builds an executable of 18kB, and without this option it builds an executable of 1.1M in size.
Also, after deinstalling ghc-static
, compilation succeeds with the -dynamic
flag present in stack.yaml
, and fails without (complains about missing Lib
in base-4.12.0.0
).
Maybe you're right, and it's a packaging thing. I'll try to drop the packager a note, linking to this issue.
For now, thanks for your help, but please don't waste your time on this, I'll stick with plain cabal
for the time being.
Please excuse this rant: I have to say that I find the state of Haskells compiler infrastructure the most appalling aspect of it all. I have used and taught Haskell for over a decade, albeit in a rather researchy way, or for pet projects, i.e., neither industrial nor commercial applications. This time is over (since 2016), but occasionally I come back with an idea I wonder what it would be like to do it in Haskell. And then I need a library, and hit the wall of cabal
or stack
. And I have not seen this situation improve much in recent years. I find this sad, because Haskell is such a nice language. As said above: I'll try cabal
with its “new style” stuff, and see how it goes. Wish me luck!
General summary/comments (optional)
I've tried to follow the Quick Start Guide, but it fails.
The only deviation is that I insist to use the GHC (version 8.6.5) installed on the system. I cannot check without, because the download would take approx. 6h.
Steps to reproduce
Yes, I've tried this suggestion, to no avail.
Expected
Expected to see successful compilation
Actual
Compilation failed
Method of installation
Packages from ArchLinux official repositories