yesod devel fail when starting development server - haskell

I was starting to read about Yesod and I tried to install it on my Linux Mint Maya 64-bit machine.
The haskell platform was already installed, I just installed the yesod-platform package with cabal install yesod-platform and all worked very well.
Next step was to call yesod init with respond to all the questions - the application name: test. The problems starts when I called yesod devel... here it is what I've got:
Yesod devel server. Press ENTER to quit
Resolving dependencies...
Configuring test-0.0.0...
Rebuilding application...
Building test-0.0.0...
Preprocessing library test-0.0.0...
Registering test-0.0.0...
Starting development server: runghc -package-confdist/package.conf.inplace devel.hs
devel.hs:2:1:
Failed to load interface for `Application'
It is not a module in the current program, or in any known package.
Exit code: ExitFailure 1
I'm a little bit lost with this issue - I made a lot of research related to it but I have no luck...
Can anyone help with this problem?
Here it is my ghc-pkg list:
/var/lib/ghc/package.conf.d:
Cabal-1.14.0
GLUT-2.1.2.1
HDBC-2.3.1.1
HDBC-odbc-2.2.3.0
HTTP-4000.2.2
HUnit-1.2.4.2
MonadCatchIO-mtl-0.3.0.4
OpenGL-2.2.3.1
QuickCheck-2.4.2
SHA-1.5.0.0
aeson-0.6.0.0
ansi-terminal-0.5.5
array-0.4.0.0
asn1-data-0.6.1.3
attoparsec-0.10.1.1
attoparsec-conduit-0.2.0
attoparsec-enumerator-0.3
authenticate-1.0.0.1
base-4.5.0.0
base-unicode-symbols-0.2.2.3
base64-bytestring-0.1.1.0
bin-package-db-0.0.0.0
binary-0.5.1.0
blaze-builder-0.3.1.0
blaze-builder-conduit-0.2.0
blaze-html-0.4.3.1
byteorder-1.0.3
bytestring-0.9.2.1
bytestring-lexing-0.4.0
case-insensitive-0.4.0.1
cereal-0.3.5.1
certificate-1.1.0
cgi-3001.1.8.2
clientsession-0.7.4.1
conduit-0.2.0
containers-0.4.2.1
convertible-1.0.11.0
cookie-0.4.0
cprng-aes-0.2.3
crypto-api-0.9
crypto-conduit-0.1.3.1
crypto-pubkey-types-0.1.0
cryptocipher-0.3.0
cryptohash-0.7.4
css-text-0.1.1
data-default-0.3.0
deepseq-1.3.0.0
directory-1.1.0.2
dlist-0.5
email-validate-0.2.8
entropy-0.2.1
enumerator-0.4.18
extensible-exceptions-0.1.1.4
failure-0.2.0
fast-logger-0.0.2
fgl-5.4.2.4
file-embed-0.0.4.1
filepath-1.3.0.0
(ghc-7.4.1)
ghc-prim-0.2.0.0
hamlet-0.10.8
hashable-1.1.2.3
haskell-src-1.0.1.5
(haskell2010-1.1.0.1)
(haskell98-2.0.0.1)
hjsmin-0.0.15
hoopl-3.8.7.3
hpc-0.5.1.1
html-1.0.1.2
http-conduit-1.2.5
http-date-0.0.2
http-types-0.6.9
integer-gmp-0.4.0.0
language-javascript-0.4.10
largeword-1.0.1
lifted-base-0.1.0.3
mime-mail-0.4.1.1
monad-control-0.3.1
mtl-2.0.1.0
network-2.3.0.10
old-locale-1.0.0.4
old-time-1.1.0.0
parallel-3.2.0.2
parsec-3.1.2
path-pieces-0.1.0
persistent-0.8.0.1
persistent-template-0.8.1.1
pool-conduit-0.0.0.1
pretty-1.1.1.0
primitive-0.4.1
process-1.1.0.1
pureMD5-2.1.0.3
pwstore-fast-2.2
random-1.0.1.1
ranges-0.2.4
regex-base-0.93.2
regex-compat-0.95.1
regex-posix-0.95.1
resource-pool-0.2.1.0
rts-1.0
safe-0.3.3
semigroups-0.8
shakespeare-0.10.3.1
shakespeare-css-0.10.7
shakespeare-i18n-0.0.1
shakespeare-js-0.11.0.1
shakespeare-text-0.10.5
simple-sendfile-0.2.0
skein-0.1.0.5
socks-0.4.1
stm-2.2.0.1
syb-0.3.6
system-filepath-0.4.6
tagged-0.2.3.1
tagsoup-0.12.6
template-haskell-2.7.0.0
text-0.11.1.13
time-1.4
tls-0.9.0
tls-extra-0.4.3
transformers-0.2.2.0
transformers-base-0.4.1
unix-2.5.1.0
unix-compat-0.3.0.1
unordered-containers-0.1.4.6
utf8-light-0.4.0.1
utf8-string-0.3.7
vault-0.1.0.0
vector-0.9.1
wai-1.1.0.1
wai-app-static-1.1.2
wai-extra-1.1.0.1
wai-logger-0.1.4
warp-1.1.0.1
xhtml-3000.2.0.5
xml-conduit-0.5.3
xml-types-0.3.1
xss-sanitize-0.3.1
yaml-0.5.2
yesod-0.10.1.3
yesod-auth-0.8.1.1
yesod-core-0.10.2.1
yesod-form-0.4.2
yesod-json-0.3.1
yesod-persistent-0.3.1
yesod-routes-0.0.1
yesod-static-0.10.1
zlib-0.5.3.3
zlib-bindings-0.0.3.2
zlib-conduit-0.2.0
/home/ionica/.ghc/x86_64-linux-7.4.1/package.conf.d:
Cabal-1.16.0.1
HDBC-2.3.1.1
HDBC-odbc-2.3.1.0
HDBC-sqlite3-2.3.3.0
HaXml-1.23.3
SHA-1.5.1
aeson-0.6.0.2
ansi-terminal-0.5.5
asn1-data-0.7.1
attoparsec-0.10.2.0
attoparsec-conduit-0.5.0.2
authenticate-1.3.1.1
base-unicode-symbols-0.2.2.4
base64-bytestring-1.0.0.0
blaze-builder-0.3.1.0
blaze-builder-conduit-0.5.0.1
blaze-html-0.5.1.0
blaze-markup-0.5.1.1
byteorder-1.0.3
cairo-0.12.3.1
case-insensitive-0.4.0.3
cereal-0.3.5.2
certificate-1.2.8
cipher-aes-0.1.2
clientsession-0.8.0.1
conduit-0.5.2.5
conduit-0.5.2.6
convertible-1.0.11.1
cookie-0.4.0.1
cpphs-1.14
cprng-aes-0.2.4
cpu-0.1.1
crypto-api-0.10.2
crypto-conduit-0.4.0.1
crypto-pubkey-types-0.1.1
cryptocipher-0.3.5
cryptohash-0.7.5
css-text-0.1.1
data-default-0.5.0
date-cache-0.3.0
derive-2.5.11
dlist-0.5
email-validate-0.2.8
entropy-0.2.1
failure-0.2.0.1
fast-logger-0.3.1
file-embed-0.0.4.6
filesystem-conduit-0.5.0.1
ghc-paths-0.1.0.8
gio-0.12.3
glib-0.12.3.1
gtk-0.12.3.1
hamlet-1.1.1
hashable-1.1.2.5
haskell-src-exts-1.13.5
hjsmin-0.1.3
hspec-1.3.0.1
hspec-expectations-0.3.0.2
html-conduit-0.1.0.2
http-conduit-1.6.1.2
http-date-0.0.2
http-types-0.7.3.0.1
language-javascript-0.5.5
largeword-1.0.3
lifted-base-0.1.2
lifted-base-0.2
mime-mail-0.4.1.2
mime-types-0.1.0.0
monad-control-0.3.1.4
monad-logger-0.2.1
network-conduit-0.6.0
network-conduit-0.6.1.1
pango-0.12.3
parallel-3.2.0.2
parallel-3.2.0.3
parallel-io-0.3.2.1
path-pieces-0.1.2
pem-0.1.1
persistent-1.0.1.3
persistent-sqlite-0.8.0
persistent-sqlite-1.0.0
persistent-template-1.0.0.2
polyparse-1.8
pool-conduit-0.1.0.3
primitive-0.5
primitive-0.5.0.1
pureMD5-2.1.2.1
pwstore-fast-2.3
ranges-0.2.4
resource-pool-0.2.1.1
resourcet-0.4.0.1
resourcet-0.4.0.2
safe-0.3.3
semigroups-0.8.4.1
shakespeare-1.0.1.4
shakespeare-css-1.0.1.5
shakespeare-i18n-1.0.0.2
shakespeare-js-1.0.0.6
shakespeare-text-1.0.0.5
silently-1.2.0.2
simple-sendfile-0.2.8
skein-0.1.0.9
socks-0.4.2
split-0.1.4.3
stringsearch-0.3.6.4
system-fileio-0.3.10
system-filepath-0.4.7
tagged-0.4.4
tagsoup-0.12.8
tagstream-conduit-0.5.3
tar-0.3.2.0
tar-0.4.0.1
tls-0.9.11
tls-extra-0.4.7
transformers-base-0.4.1
uniplate-1.6.7
unix-compat-0.4.0.0
unix-time-0.1.2
unordered-containers-0.2.2.1
utf8-string-0.3.7
vault-0.2.0.1
vector-0.10
vector-0.10.0.1
void-0.5.8
wai-1.3.0.1
wai-app-static-1.3.0.2
wai-extra-1.3.0.3
wai-logger-0.3.0
wai-test-1.3.0
warp-1.3.4.1
xml-conduit-1.0.3.1
xml-types-0.3.3
xss-sanitize-0.3.2
yaml-0.8.1
yesod-1.1.2
yesod-auth-1.1.1.2
yesod-core-1.1.3.1
yesod-default-0.6.1
yesod-default-1.1.0.2
yesod-form-1.1.3
yesod-json-1.1.0
yesod-persistent-1.1.0
yesod-platform-1.1.4
yesod-routes-1.1.0.1
yesod-routes-1.1.0.2
yesod-static-1.1.0.1
yesod-test-0.3.0.1
zlib-bindings-0.1.1.1
zlib-conduit-0.5.0.1

After a complete clean up of the system - I mean uninstall haskell-platform, yesod-platform and delete files related to haskell, yesod and ghc - then a fresh install for haskell-platform + yesod-platform all goes splendid.

Related

how to get the source code of a RPM package

I want to get the source code of an RPM package, with all patches applied. (what the apt source do)
For example, bash. Here is something I've tried.
Firstly, I download the src RPM package via yumdownloader:
yumdownloader --source bash
Then, I got a package named bash-4.2.46-35.el7_9.src.rpm. I used the following command to extract this file:
rpm2cpio bash-4.2.46-35.el7_9.src.rpm | cpio -ivdm
Then, I got the following files:
[root#ce944fc560a2 src]# ls
bash-2.02-security.patch bash-3.2-ssh_source_bash.patch bash-4.2-cve-2014-7169-0.patch bash-4.2-man-ulimit.patch bash-4.3-cve-2016-0634.patch bash-5.0-syslog-history.patch bash42-003 bash42-013 bash42-023 bash42-033 bash42-043
bash-2.03-paths.patch bash-4.0-nobits.patch bash-4.2-cve-2014-7169-1.patch bash-4.2-manpage.patch bash-4.3-cve-2016-7543.patch bash-bashbug.patch bash42-004 bash42-014 bash42-024 bash42-034 bash42-044
bash-2.03-profile.patch bash-4.1-broken_pipe.patch bash-4.2-cve-2014-7169-2.patch bash-4.2-manpage_trap.patch bash-4.3-dircomp-append-slash.patch bash-cve-2016-9401.patch bash42-005 bash42-015 bash42-025 bash42-035 bash42-045
bash-2.05a-interpreter.patch bash-4.1-defer-sigchld-trap.patch bash-4.2-double-alloc.patch bash-4.2-missing-opt-cd.patch bash-4.3-pipefd-leak.patch bash-infotags.patch bash42-006 bash42-016 bash42-026 bash42-036 bash42-046
bash-2.05b-debuginfo.patch bash-4.1-examples.patch bash-4.2-enable-hyphened-fn-export.patch bash-4.2-missing_closes.patch bash-4.3-trapped-signals.patch bash-requires.patch bash42-007 bash42-017 bash42-027 bash42-037 bash42-052
bash-2.05b-manso.patch bash-4.1-trap.patch bash-4.2-env-inject.patch bash-4.2-noecho.patch bash-4.3-wshouldquote.patch bash-setlocale.patch bash42-008 bash42-018 bash42-028 bash42-038 bash42-053
bash-2.05b-pgrp_sync.patch bash-4.2-brace-expand.patch bash-4.2-extglob-man.patch bash-4.2-rc2-logout.patch bash-4.4-bracketed-paste.patch bash-tty-tests.patch bash42-009 bash42-019 bash42-029 bash42-039 dot-bash_logout
bash-2.05b-readline-oom.patch bash-4.2-case-in-command-subst.patch bash-4.2-history-hang.patch bash-4.2-signal.patch bash-4.4-cve-2019-9924.patch bash.spec bash42-010 bash42-020 bash42-030 bash42-040 dot-bash_profile
bash-2.05b-xcc.patch bash-4.2-check-debugger.patch bash-4.2-ifs-in-temp-env.patch bash-4.2-size_type.patch bash-4.4-param-expansion.patch bash42-001 bash42-011 bash42-021 bash42-031 bash42-041 dot-bashrc
bash-3.2-audit.patch bash-4.2-coverity.patch bash-4.2-leak-compound.patch bash-4.2.tar.gz bash-4.4-pipeline-pgrp.patch bash42-002 bash42-012 bash42-022 bash42-032 bash42-042 fix-shopt-lastpipe-mode-crash.patch
There is a tgz file bash-4.2.tar.gz which is the original bash source code and lots of patch files.
How to patch these files to the original source code? If my steps are wrong, is there a simple way to solve my question?
After reading the Rebuild a Source RPM, I found an approach to solve the problem.
Firstly, use the yumdownloader to download a source package:
yumdownloader --source bash
Then, use the rpmbuild to rebuild the package without build and dependency check:
rpmbuild --nobuild --nodeps --rebuild bash-4.2.46-35.el7_9.src.rpm
rpmbuild will help you deal with all the things. Then the source code is here: $HOME/rpmbuild/BUILD/bash-4.2/:
[root#984f0a6b263e data]# ls /root/rpmbuild/BUILD/bash-4.2/
ABOUT-NLS aclocal.m4.pgrp_sync bashtypes.h configure execute_cmd.c.026 hashlib.c parse.y.005 patchlevel.h.006 patchlevel.h.027 pathexp.c.014 shell.h.053 subst.c.double-alloc variables.c.006
AUTHORS alias.c bracecomp.c configure.in execute_cmd.c.coverity hashlib.h parse.y.012 patchlevel.h.007 patchlevel.h.028 pathexp.h sig.c subst.c.leak-compound variables.c.7169-1
CHANGES alias.h braces.c configure.in.audit execute_cmd.c.fix-shopt-lastpipe-mode include parse.y.016 patchlevel.h.008 patchlevel.h.029 pathnames.h.in sig.c.008 subst.c.noecho variables.c.cve-2016-7543
COMPAT array.c braces.c.expand configure.in.check-debugger execute_cmd.c.interpreter input.c parse.y.034 patchlevel.h.009 patchlevel.h.030 pcomplete.c sig.h subst.c.param-expansion variables.c.cve-2019-9924
COPYING array.h builtins configure.in.interpreter execute_cmd.c.nobits input.h parse.y.042 patchlevel.h.010 patchlevel.h.031 pcomplete.h sig.h.signal subst.c.pipeline-pgrp variables.c.export
CWRU arrayfunc.c builtins.h conftypes.h execute_cmd.c.pipefd-leak jobs.c parse.y.053 patchlevel.h.011 patchlevel.h.032 pcomplib.c siglist.c subst.h variables.c.inject
ChangeLog arrayfunc.h builtins.h.requires copy_cmd.c execute_cmd.c.requires jobs.c.defer_sigchld_trap parse.y.7169-0 patchlevel.h.012 patchlevel.h.033 po siglist.h subst.h.001 variables.h
INSTALL assoc.c command.h copy_cmd.c.052 execute_cmd.h jobs.c.trapped-signals parse.y.7169-2 patchlevel.h.013 patchlevel.h.034 print_cmd.c stringlib.c subst.h.param-expansion variables.h.005
MANIFEST assoc.c.011 command.h.025 cross-build execute_cmd.h.requires jobs.h parse.y.command-subst patchlevel.h.014 patchlevel.h.035 print_cmd.c.010 subst.c support variables.h.size_type
MANIFEST.doc assoc.h config-bot.h dispose_cmd.c expr.c lib parse.y.cve-2016-0634 patchlevel.h.015 patchlevel.h.036 quit.h subst.c.001 syntax.h version.c
Makefile.in bashansi.h config-top.h dispose_cmd.h expr.c.015 list.c parse.y.noecho patchlevel.h.016 patchlevel.h.037 redir.c subst.c.004 test.c xmalloc.c
Makefile.in.xcc bashhist.c config-top.h.broken_pipe doc expr.c.039 locale.c parse.y.param-expansion patchlevel.h.017 patchlevel.h.038 redir.c.040 subst.c.007 test.h xmalloc.h
NEWS bashhist.c.syslog-history config-top.h.logout error.c externs.h mailcheck.c parse.y.security patchlevel.h.018 patchlevel.h.039 redir.c.045 subst.c.013 tests y.tab.c
NOTES bashhist.h config-top.h.paths error.c.023 findcmd.c mailcheck.h parser-built patchlevel.h.019 patchlevel.h.040 redir.c.temp-env subst.c.023 trap.c y.tab.c.cve-2016-0634
POSIX bashintl.h config-top.h.profile error.h findcmd.h make_cmd.c parser.h patchlevel.h.020 patchlevel.h.041 redir.h subst.c.025 trap.c.signal y.tab.c.param-expansion
RBASH bashjmp.h config-top.h.ssh_source_bash eval.c flags.c make_cmd.c.052 patchlevel.h patchlevel.h.021 patchlevel.h.042 shell.c subst.c.027 trap.c.trap y.tab.h
README bashline.c config-top.h.syslog-history eval.c.requires flags.h make_cmd.c.requires patchlevel.h.001 patchlevel.h.022 patchlevel.h.043 shell.c.bashbug subst.c.028 trap.h
Y2K bashline.c.029 config.h.in examples general.c make_cmd.h patchlevel.h.002 patchlevel.h.023 patchlevel.h.044 shell.c.check-debugger subst.c.032 unwind_prot.c
_distribution bashline.c.append-slash config.h.in.audit execute_cmd.c general.h mksyntax.c patchlevel.h.003 patchlevel.h.024 patchlevel.h.045 shell.c.requires subst.c.036 unwind_prot.h
_patchlevel bashline.h config.h.in.interpreter execute_cmd.c.018 hashcmd.c nojobs.c patchlevel.h.004 patchlevel.h.025 patchlevel.h.046 shell.h subst.c.041 variables.c
aclocal.m4 bashline.h.029 config.h.in.paths execute_cmd.c.025 hashcmd.h parse.y patchlevel.h.005 patchlevel.h.026 pathexp.c shell.h.012 subst.c.046 variables.c.005

What does "legacy fallback" mean when cabal is building packages?

When using cabal to build a Haskell package, it appears to mark some packages as legacy fallback:
$ cabal build
Resolving dependencies...
Build profile: -w ghc-9.0.1 -O1
In order, the following will be built (use -v for more details):
- appar-0.1.8 (lib:appar) (requires build)
- auto-update-0.1.6 (lib) (requires build)
- base-compat-0.11.2 (lib) (requires build)
...
Building base-orphans-0.8.4 (lib)
Building appar-0.1.8 (all, legacy fallback)
Downloaded memory-0.16.0
Downloading cryptonite-0.29
Installing base-orphans-0.8.4 (lib)
Downloaded cryptonite-0.29
Downloading some-1.0.3
...
You can see that for some libraries, they are specifically marked (lib), but other libraries are marked (all, legacy fallback).
What is the difference between these? What does legacy fallback mean?
I am using cabal-install version 3.4.0.0:
$ cabal --version
cabal-install version 3.4.0.0
compiled using version 3.4.0.0 of the Cabal library
I took a dive in the source code. The error message comes form here:
dispname = case elabPkgOrComp pkg of
ElabPackage _ -> prettyShow pkgid
++ " (all, legacy fallback)"
ElabComponent comp -> prettyShow pkgid
++ " (" ++ maybe "custom" prettyShow (compComponentName comp) ++ ")"
So I started looking for places where ElabPackage is constructed. I found this:
elaborateSolverToPackage
...
where
...
elab1 = elab0 {
elabUnitId = newSimpleUnitId pkgInstalledId,
elabComponentId = pkgInstalledId,
elabLinkedInstantiatedWith = Map.empty,
elabPkgOrComp = ElabPackage $ ElaboratedPackage {..},
elabModuleShape = modShape
}
This in turn is used here:
elaborateSolverToComponents mapDep spkg#(SolverPackage _ _ _ deps0 exe_deps0)
= case mkComponentsGraph (elabEnabledSpec elab0) pd of
Right g -> do
...
let not_per_component_reasons = why_not_per_component src_comps
if null not_per_component_reasons
then return comps
else do checkPerPackageOk comps not_per_component_reasons
return [elaborateSolverToPackage spkg g $
comps ++ maybeToList setupComponent]
Now the why_not_per_component is very interesting as that function determines when to use the legacy fallback. It is defined here:
-- You are eligible to per-component build if this list is empty
why_not_per_component g
= cuz_buildtype ++ cuz_spec ++ cuz_length ++ cuz_flag ++ cuz_coverage
There in the code right below that we can see that it can be caused by these reasons:
The build-type is Custom or Configure
The cabal-version is less than 1.8
There are no buildable components
You passed the --disable-per-component flag.
Program coverage is enabled
So for the appar library it is because the cabal-version is 1.6 which is lower than 1.8, see https://github.com/kazu-yamamoto/appar/blob/v0.1.8/appar.cabal#L10.

Stack build error: while building package aeson. (cabal) ExitFailure 1

When I run "stack build" I get an error:
-- While building package aeson-1.1.2.0 using:
/Users/kaspazza/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-osx/Cabal-1.24.2.0 build --ghc-options ""
Process exited with code: ExitFailure 1
My stack.yaml:
resolver: lts-9.10
packages:
- '.'
extra-deps: []
flags: {}
extra-package-dbs: []
command: stack exec -- which ghc
gives:
/Users/kaspazza/.stack/programs/x86_64-osx/ghc-8.0.2/bin/ghc
command: ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.8.3
command: stack build
aeson > configure
aeson > Configuring aeson-1.1.2.0...
aeson > build
aeson > Building aeson-1.1.2.0...
aeson > Preprocessing library aeson-1.1.2.0...
aeson > [ 1 of 21] Compiling Data.Aeson.Types.Internal ( Data/Aeson/Types/Internal.hs, .stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/Data/Aeson/Types/Internal.o )
aeson > [ 2 of 21] Compiling Data.Aeson.Types.Generic ( Data/Aeson/Types/Generic.hs, .stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/Data/Aeson/Types/Generic.o )
aeson > [ 3 of 21] Compiling Data.Aeson.Parser.UnescapeFFI ( ffi/Data/Aeson/Parser/UnescapeFFI.hs, .stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/Data/Aeson/Parser/UnescapeFFI.o )
aeson > [ 4 of 21] Compiling Data.Aeson.Parser.Unescape ( Data/Aeson/Parser/Unescape.hs, .stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/Data/Aeson/Parser/Unescape.o )
aeson > [ 5 of 21] Compiling Data.Aeson.Parser.Internal ( Data/Aeson/Parser/Internal.hs, .stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/Data/Aeson/Parser/Internal.o )
aeson > <command line>: can't load .so/.DLL for: /Users/kaspazza/.stack/snapshots/x86_64-osx/8b5cff025076e7bab89d6dbb5e562716cf2b67bbcde1528460c4f36feefa23fb/8.0.2/lib/x86_64-osx-ghc-8.0.2/libHStime-locale-compat-0.1.1.3-KZ1jqNx8uhlHjmuPPj6V1Y-ghc8.0.2.dylib (dlopen(/Users/kaspazza/.stack/snapshots/x86_64-osx/8b5cff025076e7bab89d6dbb5e562716cf2b67bbcde1528460c4f36feefa23fb/8.0.2/lib/x86_64-osx-ghc-8.0.2/libHStime-locale-compat-0.1.1.3-KZ1jqNx8uhlHjmuPPj6V1Y-ghc8.0.2.dylib, 5): REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB has segment 2 which is not a writable segment (__LINKEDIT) in /Users/kaspazza/.stack/snapshots/x86_64-osx/8b5cff025076e7bab89d6dbb5e562716cf2b67bbcde1528460c4f36feefa23fb/8.0.2/lib/x86_64-osx-ghc-8.0.2/libHStime-locale-compat-0.1.1.3-KZ1jqNx8uhlHjmuPPj6V1Y-ghc8.0.2.dylib)
-- While building package aeson-1.1.2.0 using:
/Users/kaspazza/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-osx/Cabal-1.24.2.0 build --ghc-options ""
Process exited with code: ExitFailure 1
Progress 1/2
command: cabal install
cabal: Could not resolve dependencies:
[__0] trying: duckling-0.1.6.1 (user goal)
[__1] next goal: snap-server (dependency of duckling)
[__1] rejecting: snap-server-1.1.1.1 (conflict: duckling =>
snap-server>=1.0.1.1 && <1.1)
[__1] skipping: snap-server-1.1.1.0, snap-server-1.1.0.0 (has the same
characteristics that caused the previous version to fail: excluded by
constraint '>=1.0.1.1 && <1.1' from 'duckling')
[__1] trying: snap-server-1.0.3.3
[__2] next goal: base (dependency of duckling)
[__2] rejecting: base-4.13.0.0/installed-4.13.0.0 (conflict: snap-server =>
base>=4 && <4.11)
[__2] skipping: base-4.14.0.0, base-4.13.0.0, base-4.12.0.0, base-4.11.1.0,
base-4.11.0.0 (has the same characteristics that caused the previous version
to fail: excluded by constraint '>=4 && <4.11' from 'snap-server')
[__2] rejecting: base-4.10.1.0, base-4.10.0.0, base-4.9.1.0, base-4.9.0.0,
base-4.8.2.0, base-4.8.1.0, base-4.8.0.0, base-4.7.0.2, base-4.7.0.1,
base-4.7.0.0, base-4.6.0.1, base-4.6.0.0, base-4.5.1.0, base-4.5.0.0,
base-4.4.1.0, base-4.4.0.0, base-4.3.1.0, base-4.3.0.0, base-4.2.0.2,
base-4.2.0.1, base-4.2.0.0, base-4.1.0.0, base-4.0.0.0, base-3.0.3.2,
base-3.0.3.1 (constraint from non-upgradeable package requires installed
instance)
[__2] fail (backjumping, conflict set: base, duckling, snap-server)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: snap-server, duckling, base
(I'm on a mac, and I think the problem is with versions/dependencies of tools on my machine)
Any ideas why I get the error, or how can I debug it?
copy from my comment
Apparently this has been build also with ghc-8.6.3. Such a version of ghc is available in stack's snapshot 13.11. If you wish, change stack.yaml to set the resolver to lts-13.11. It'll download a different version of the compiler and libraries. Maybe it works
From your comment
as you've said, you have to add allow-newer: true so it can resolve dependencies properly

Fay can't find fay-base

I want to use Fay with Yesod, but can't get Fay typechecking to work.
Will appreciate any advice.
$ stack build
[ 9 of 11] Compiling Handler.Home ( src/Handler/Home.hs, .stack-work/dist/x86_64-linux-dkda49f7ca9b244180d3cfb1987cbc9743/Cabal-2.4.0.1/build/Handler/Home.o )
/home/user/code/myproject/src/Handler/Home.hs:121:13: error:
_ Exception when trying to run compile-time code:
ghc-pkg describe error:
Timestamp 2019-05-07 18:46:44 UTC for /opt/ghc/8.6.5/lib/ghc-8.6.5/package.conf.d/package.cache
ghc-pkg: cannot find package fay-base <- ########### Why?
GHC package manager version 8.6.5
using cache: /opt/ghc/8.6.5/lib/ghc-8.6.5/package.conf.d/package.cache
db stack: ["/opt/ghc/8.6.5/lib/ghc-8.6.5/package.conf.d"]
flag db stack: ["/opt/ghc/8.6.5/lib/ghc-8.6.5/package.conf.d"]
CallStack (from HasCallStack):
error, called at src/Fay/Compiler/Packages.hs:70:24 in fay-0.24.0.3-CdLcUWVJEOpLCiYHkNVTai:Fay.Compiler.Packages
Code: fayFile' (ConE 'StaticR) "HelloWorld"
_ In the untyped splice: $(fayFile' (ConE 'StaticR) "HelloWorld")
|
121 | $( fayFile' (ConE 'StaticR) "HelloWorld" )
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Fay packages are not yet in stackage, so I added them to stack.yaml as extra-deps:
extra-deps: - fay-0.24.0.3
- fay-base-0.21.1.1
- fay-dom-0.5.0.1
- fay-text-0.3.2.2
- yesod-fay-0.10.0
and to package.yaml as dependencies:
dependencies:
... more dependencies ...
- fay == 0.24.0.3
- fay-base == 0.21.1.1
- fay-dom == 0.5.0.1
- fay-text == 0.3.2.2
- yesod-fay == 0.10.0
Fay packages are in the local package database:
$ stack exec -- ghc-pkg list
/opt/ghc/8.6.5/lib/ghc-8.6.5/package.conf.d
Cabal-2.4.0.1
array-0.5.3.0
base-4.12.0.0
...
/home/user/.stack/snapshots/x86_64-linux-dkda49f7ca9b244180d3cfb1987cbc9743/lts-13.30/8.6.5/pkgdb
Cabal-2.4.1.0
Diff-0.3.4
HUnit-1.6.0.0
...
yesod-1.6.0
yesod-core-1.6.14
yesod-form-1.6.5
yesod-newsfeed-1.6.1.0
yesod-persistent-1.6.0.2
yesod-static-1.6.0.1
/home/user/code/myproject/.stack-work/install/x86_64-linux-dkda49f7ca9b244180d3cfb1987cbc9743/lts-13.30/8.6.5/pkgdb
fay-0.24.0.3
fay-base-0.21.1.1
fay-dom-0.5.0.1
fay-text-0.3.2.2
yesod-fay-0.10.0
However trying to set HASKELL_PACKAGE_SANDBOX to the local database as Fay Troubleshooting suggests doesn't work, because sandboxes containing the string .stack are ignored in yesod-fay.
If I remove that check from yesod-fay and force the --package-db to point to the local database, it still doesn't work, complains that fay-base can't find the fay package.
$ stack build
/home/user/code/myproject/src/Handler/Home.hs:121:13: error:
• Exception when trying to run compile-time code:
Unable to compile Fay module "HelloWorld":
ghc: <command line>: cannot satisfy -package fay-base-0.21.1.1:
fay-base-0.21.1.1-91eIy2f24Wa5OHg9LMre7 is unusable due to missing dependencies:
fay-0.24.0.3-CdLcUWVJEOpLCiYHkNVTai
(use -v for more information)
CallStack (from HasCallStack):
error, called at ./Yesod/Fay.hs:483:3 in yesod-fay-0.10.9999-CzTT9fyZ6636pi0gIof7Ge:Yesod.Fay
Code: fayFile' (ConE 'StaticR) "HelloWorld"
• In the untyped splice: $(fayFile' (ConE 'StaticR) "HelloWorld")
|
121 | $( fayFile' (ConE 'StaticR) "HelloWorld" )
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Update: not using satck or cabal and using packages that are installed system-wide, this error doesn't occur. I guess the problem is in my local stack package database (the one in .stack-work)
I concluded that fay doesn't work with stack.

Haskell - Packaging cabal package with custom preprocessors

I've implemented a custom preprocessor which creates *.hs files form *.tpl files. It is specified in Setup.hs by using a Build-Type: Custom. Everything works fine, but I can't create tar.gz package from it (using cabal sdist).
Cabal complains, that it can not find the exposed modules which are generated by the preprocessor. The error message is
cabal: Error: Could not find module with any
suffix: ["gc","chs","hsc","x","y","ly","cpphs","hs","lhs"]
How can I make Cabal aware of the fact that the module is not missing, or maybe add tpl to the known file extensions, or something?
This is a known issue with cabal sdist. Use ./dist/setup/setup sdist instead.
Here's an example:
$ cat preprocessor-test.cabal
name: preprocessor-test
version: 0.1.0.0
build-type: Custom
cabal-version: >=1.10
extra-source-files: PreprocessorTest/*.prepro
library
exposed-modules: PreprocessorTest.PreprocessorTest
build-depends: base ==4.5.*
-- hs-source-dirs:
default-language: Haskell2010
$ cat Setup.hs
#!/usr/bin/env runhaskell
import Distribution.Simple
import Distribution.Simple.PreProcess
import Distribution.Simple.Utils
import Distribution.PackageDescription
import Distribution.Simple.LocalBuildInfo
import System.Cmd (rawSystem)
import System.FilePath ((</>))
main = let hooks = simpleUserHooks
dummy = ("prepro", dummyPreprocessor)
in defaultMainWithHooks hooks
{ hookedPreProcessors = dummy:knownSuffixHandlers }
dummyPreprocessor :: BuildInfo -> LocalBuildInfo -> PreProcessor
dummyPreprocessor build local = PreProcessor {
platformIndependent = True,
runPreProcessor =
mkSimplePreProcessor $ \inFile outFile verbosity -> do
notice verbosity (inFile ++ " is being preprocessed to " ++ outFile)
rawSystem "cp" [inFile, outFile]
return ()
}
$ cat PreprocessorTest/PreprocessorTest.prepro
module PreprocessorTest.PreprocessorTest
where
preprocessorTest :: Int
preprocessorTest = 1
$ cabal configure
Resolving dependencies...
[1 of 1] Compiling Main ( Setup.hs, dist/setup/Main.o )
Linking ./dist/setup/setup ...
Configuring preprocessor-test-0.1.0.0...
$ cabal build
Building preprocessor-test-0.1.0.0...
Preprocessing library preprocessor-test-0.1.0.0...
PreprocessorTest/PreprocessorTest.prepro is being preprocessed to
dist/build/PreprocessorTest/PreprocessorTest.hs
[1 of 1] Compiling PreprocessorTest.PreprocessorTest ( dist/build/PreprocessorTest/PreprocessorTest.hs, dist/build/PreprocessorTest/PreprocessorTest.o )
Registering preprocessor-test-0.1.0.0...
$ ./dist/setup/setup sdist
Distribution quality errors:
No 'synopsis' or 'description' field.
The 'license' field is missing or specified as AllRightsReserved.
Distribution quality warnings:
No 'category' field.
No 'maintainer' field.
Note: the public hackage server would reject this package.
Building source dist for preprocessor-test-0.1.0.0...
Preprocessing library preprocessor-test-0.1.0.0...
PreprocessorTest/PreprocessorTest.prepro is being preprocessed to
dist/src/sdist.-6767/preprocessor-test-0.1.0.0/dist/build/PreprocessorTest/PreprocessorTest.hs
Source tarball created: dist/preprocessor-test-0.1.0.0.tar.gz
$ tar tzf dist/preprocessor-test-0.1.0.0.tar.gz
preprocessor-test-0.1.0.0/
preprocessor-test-0.1.0.0/dist/
preprocessor-test-0.1.0.0/dist/build/
preprocessor-test-0.1.0.0/dist/build/PreprocessorTest/
preprocessor-test-0.1.0.0/dist/build/PreprocessorTest/PreprocessorTest.hs
preprocessor-test-0.1.0.0/Setup.hs
preprocessor-test-0.1.0.0/PreprocessorTest/
preprocessor-test-0.1.0.0/PreprocessorTest/PreprocessorTest.prepro
preprocessor-test-0.1.0.0/preprocessor-test.cabal

Resources