Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a configured locale is required to build hledger #420

Closed
daniel-vainsencher opened this issue Oct 20, 2016 · 11 comments · Fixed by #849
Closed

a configured locale is required to build hledger #420

daniel-vainsencher opened this issue Oct 20, 2016 · 11 comments · Fixed by #849
Labels
A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. docs Documentation-related. tools hledger developer tools, scripts, processes..

Comments

@daniel-vainsencher
Copy link

daniel-vainsencher commented Oct 20, 2016

Before:
[danielv@dvflair hledger]$ stack install hledger hledger-ui hledger-web -j1
hledger-0.28: build
Progress: 0/34
-- While building package hledger-0.28 using:
/home/danielv/.stack/setup-exe-cache/x86_64-linux-ncurses6/setup-Simple-Cabal-1.22.5.0-ghc-7.10.3 --builddir=.stack-work/dist/x86_64-linux-ncurses6/Cabal-1.22.5.0 build lib:hledger exe:hledger --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
Logs have been written to: /home/danielv/private/local/hledger/.stack-work/logs/hledger-0.28.log

Preprocessing library hledger-0.28...
[ 4 of 22] Compiling Hledger.Cli.DocFiles ( Hledger/Cli/DocFiles.hs, .stack-work/dist/x86_64-linux-ncurses6/Cabal-1.22.5.0/build/Hledger/Cli/DocFiles.o )

/home/danielv/private/local/hledger/hledger/Hledger/Cli/DocFiles.hs:37:8:
    Exception when trying to run compile-time code:
      /home/danielv/private/local/hledger/hledger/doc/hledger.1: hGetContents: invalid argument (invalid byte sequence)
    Code: (>>=) makeRelativeToProject "doc/hledger.1" embedStringFile
    In the splice:
      $(makeRelativeToProject "doc/hledger.1" >>= embedStringFile)

After doing
export LANG=en_US.utf8
Building works just fine. Some utf requiring data in the docs, I presume?

I guess there is a general good reason to depend on the platform locale, but is it ever useful to hledger users specifically? if so, please give error messages that clarify the problem.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@simonmichael
Copy link
Owner

Thanks for the report.

It's very unfortunate, but any GHC-compiled haskell program encountering a non-ascii string, when there is no system locale configured, dies with unhelpful errors like this one. http://hledger.org/manual.html#troubleshooting and the man page BUGS sections mention this for users.

As you point out, it can be an issue during installation too. I suppose we must have some non-ascii in the docs, and these are now embedded into the haskell code at compile time. I'm having trouble reproducing it though. I did unset LANG, stack clean, ./Shake.hs docs, stack build hledger without problem.

@simonmichael simonmichael added A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. docs Documentation-related. tools hledger developer tools, scripts, processes.. labels Oct 20, 2016
@simonmichael
Copy link
Owner

Could you try stack --stack-yaml=stack-ghc8.yaml install hledger also. Perhaps GHC 8 will give a better error, revealing which tool it's coming from.

@daniel-vainsencher
Copy link
Author

Added --verbose to that, think I got something that might be useful, see
the bottom.

About

It's very unfortunate, but any GHC-compiled haskell program encountering
a non-ascii string, when there is no
system locale configured, dies with unhelpful errors like this one.
How about using functions from [1] like getLocaleEncoding, which seems to
test for UTF. Then two options are:

  • Quit if locale is not UTF (but some might be sure enough all data is
    encoded in something their own local can deal with)
  • Give a warning message when program starts up that "locale is , will
    fail with message on non-conforming data".
    A third possibility (also imperfect) is to use setLocaleEncoding to just
    always work in UTF. I know GHC used to do that and stopped, but a policy
    that is too strong for system libraries might be reasonable for an
    application. Is UTF ever a bad choice for hledger?

http://hledger.org/manual.html#troubleshooting and the man page BUGS
sections mention this for users.
I had no problem understanding what is happening exactly because I'd run
across these before, but IMO informative error messages are much more
friendly than out-of-band documentation.

Daniel

[1]
https://hackage.haskell.org/package/base-4.8.0.0/docs/GHC-IO-Encoding.html

danielv@dvflair ~/private/local/hledger-orig master $ stack
--stack-yaml=stack-ghc8.yaml install hledger --verbose
Version 1.2.0 x86_64
Compiled with:

  • Cabal-1.24.0.0
  • Glob-0.7.11
  • HUnit-1.3.1.2
  • MonadRandom-0.4.2.3
  • QuickCheck-2.9.2
  • SHA-1.6.4.2
  • StateVar-1.1.0.4
  • aeson-0.11.2.0
  • aeson-compat-0.3.6
  • annotated-wl-pprint-0.7.0
  • ansi-terminal-0.6.2.3
  • ansi-wl-pprint-0.6.7.3
  • array-0.5.1.1
  • asn1-encoding-0.9.4
  • asn1-parse-0.9.4
  • asn1-types-0.3.2
  • async-2.1.0
  • attoparsec-0.13.1.0
  • auto-update-0.1.4
  • base-4.9.0.0
  • base-compat-0.9.1
  • base-orphans-0.5.4
  • base16-bytestring-0.1.1.6
  • base64-bytestring-1.0.0.1
  • bifunctors-5.4.1
  • binary-0.8.3.0
  • binary-tagged-0.1.4.0
  • blaze-builder-0.4.0.2
  • blaze-html-0.8.1.2
  • blaze-markup-0.7.1.0
  • byteable-0.1.1
  • bytestring-0.10.8.1
  • case-insensitive-1.2.0.7
  • cereal-0.5.3.0
  • clock-0.7.2
  • comonad-5
  • conduit-1.2.8
  • conduit-extra-1.1.13.3
  • connection-0.2.6
  • constraints-0.8
  • containers-0.5.7.1
  • contravariant-1.4
  • cookie-0.4.2.1
  • cryptohash-0.11.9
  • cryptohash-conduit-0.1.1
  • cryptonite-0.20
  • data-default-class-0.1.2.0
  • deepseq-1.4.2.0
  • digest-0.0.1.2
  • directory-1.2.6.2
  • distributive-0.5.0.2
  • dlist-0.8.0.2
  • easy-file-0.2.1
  • edit-distance-0.2.2.1
  • either-4.4.1.1
  • enclosed-exceptions-1.0.2
  • errors-2.1.2
  • exceptions-0.8.3
  • extra-1.5
  • fast-logger-2.4.7
  • filelock-0.1.0.1
  • filepath-1.4.1.0
  • free-4.12.4
  • fsnotify-0.2.1
  • generic-deriving-1.11.1
  • generics-sop-0.2.2.0
  • ghc-boot-th-8.0.1
  • ghc-prim-0.5.0.0
  • gitrev-1.2.0
  • hashable-1.2.4.0
  • hastache-0.6.1
  • hinotify-0.3.8.1
  • hit-0.6.3
  • hourglass-0.2.10
  • hpack-0.15.0
  • hpc-0.6.0.3
  • hspec-2.2.4
  • hspec-core-2.2.4
  • hspec-discover-2.2.4
  • hspec-expectations-0.7.2
  • hspec-smallcheck-0.4.1
  • http-api-data-0.3.1
  • http-client-0.5.3.2
  • http-client-tls-0.3.3
  • http-conduit-2.2.2.1
  • http-types-0.9.1
  • ieee754-0.7.6
  • integer-gmp-1.0.0.1
  • lifted-async-0.9.0
  • lifted-base-0.2.3.8
  • logict-0.6.0.2
  • memory-0.13
  • microlens-0.4.7.0
  • mime-types-0.1.0.7
  • mmorph-1.0.6
  • monad-control-1.0.1.0
  • monad-logger-0.3.19
  • monad-loops-0.4.3
  • monad-unlift-0.2.0
  • mono-traversable-1.0.1
  • mtl-2.2.1
  • network-2.6.3.1
  • network-uri-2.6.1.0
  • old-locale-1.0.0.7
  • old-time-1.1.0.3
  • open-browser-0.2.1.0
  • optparse-applicative-0.13.0.0
  • optparse-simple-0.0.3
  • parsec-3.1.11
  • path-0.5.9
  • path-io-1.2.0
  • path-pieces-0.2.1
  • patience-0.1.1
  • pem-0.2.2
  • persistent-2.6
  • persistent-sqlite-2.6
  • persistent-template-2.5.1.6
  • prelude-extras-0.4.0.3
  • pretty-1.1.3.3
  • primitive-0.6.1.0
  • process-1.4.2.0
  • profunctors-5.2
  • project-template-0.2.0
  • quickcheck-io-0.1.3
  • random-1.1
  • regex-applicative-0.3.3
  • regex-applicative-text-0.1.0.1
  • resource-pool-0.2.3.2
  • resourcet-1.1.7.5
  • retry-0.7.4.1
  • rts-1.0
  • safe-0.3.9
  • scientific-0.3.4.9
  • semigroupoids-5.1
  • semigroups-0.18.2
  • setenv-0.1.1.3
  • silently-1.2.5
  • smallcheck-1.1.1
  • socks-0.5.5
  • split-0.2.3.1
  • stm-2.4.4.1
  • stm-chans-3.0.0.4
  • store-0.2.1.2
  • store-core-0.2.0.2
  • streaming-commons-0.1.16
  • syb-0.6
  • system-fileio-0.3.16.3
  • system-filepath-0.4.13.4
  • tagged-0.8.5
  • tar-0.5.0.3
  • template-haskell-2.11.0.0
  • temporary-1.2.0.4
  • text-1.2.2.1
  • text-binary-0.2.1.1
  • tf-random-0.5
  • th-expand-syns-0.4.0.0
  • th-lift-0.7.6
  • th-lift-instances-0.1.10
  • th-orphans-0.13.2
  • th-reify-many-0.1.6
  • th-utilities-0.2.0.1
  • time-1.6.0.1
  • time-locale-compat-0.1.1.1
  • tls-1.3.8
  • transformers-0.5.2.0
  • transformers-base-0.4.4
  • transformers-compat-0.5.1.4
  • unexceptionalio-0.3.0
  • unicode-transforms-0.1.0.1
  • unix-2.7.2.0
  • unix-compat-0.4.2.0
  • unix-time-0.3.7
  • unordered-containers-0.2.7.1
  • uri-bytestring-0.2.2.0
  • utf8-string-1.0.1.1
  • uuid-types-1.0.3
  • vector-0.11.0.0
  • vector-algorithms-0.7.0.1
  • vector-binary-instances-0.2.3.2
  • void-0.7.1
  • x509-1.6.4
  • x509-store-1.6.1
  • x509-system-1.6.3
  • x509-validation-1.6.4
  • yaml-0.8.18.7
  • zip-archive-0.3.0.5
  • zlib-0.6.1.1
  • zlib-bindings-0.1.1.5

2016-10-22 09:06:26.499409: [debug] Loading project config file
stack-ghc8.yaml
@(Stack/Config.hs:810:13)
2016-10-22 09:06:26.502421: [debug] Trying to decode
/home/danielv/.stack/build-plan-cache/x86_64-linux/lts-7.0.cache
@(Data/Store/VersionTagged.hs:68:5)
2016-10-22 09:06:26.512435: [debug] Success decoding
/home/danielv/.stack/build-plan-cache/x86_64-linux/lts-7.0.cache
@(Data/Store/VersionTagged.hs:72:13)
2016-10-22 09:06:26.517917: [debug] Getting system compiler version
@(Stack/Setup.hs:354:17)
2016-10-22 09:06:26.518241: [debug] Run process: /usr/bin/ghc --info
@(System/Process/Read.hs:277:3)
2016-10-22 09:06:26.575967: [debug] Process finished in 57 ms: /usr/bin/ghc
--info
@(System/Process/Read.hs:277:3)
2016-10-22 09:06:26.579359: [debug] Asking GHC for its version
@(Stack/Setup/Installed.hs:101:13)
2016-10-22 09:06:26.579645: [debug] Getting Cabal package version
@(Stack/GhcPkg.hs:171:5)
2016-10-22 09:06:26.579805: [debug] Getting global package database location
@(Stack/GhcPkg.hs:54:5)
2016-10-22 09:06:26.579906: [debug] Run process: /usr/bin/ghc
--numeric-version
@(System/Process/Read.hs:277:3)
2016-10-22 09:06:26.580468: [debug] Run process: /usr/bin/ghc-pkg
--no-user-package-db field --simple-output Cabal version
@(System/Process/Read.hs:277:3)
2016-10-22 09:06:26.581494: [debug] Run process: /usr/bin/ghc-pkg
--no-user-package-db list --global
@(System/Process/Read.hs:277:3)
2016-10-22 09:06:26.642963: [debug] Process finished in 62 ms: /usr/bin/ghc
--numeric-version
@(System/Process/Read.hs:277:3)
2016-10-22 09:06:26.654798: [debug] Process finished in 74 ms:
/usr/bin/ghc-pkg --no-user-package-db field --simple-output Cabal version
@(System/Process/Read.hs:277:3)
2016-10-22 09:06:26.695844: [debug] Process finished in 113 ms:
/usr/bin/ghc-pkg --no-user-package-db list --global
@(System/Process/Read.hs:277:3)
2016-10-22 09:06:26.696177: [debug] Resolving package entries
@(Stack/Setup.hs:234:5)
2016-10-22 09:06:26.698075: [debug] Starting to execute command inside
EnvConfig
@(Stack/Runners.hs:166:18)
2016-10-22 09:06:26.698204: [debug] Parsing the cabal files of the local
packages
@(Stack/Build/Source.hs:282:5)
2016-10-22 09:06:26.698378: [debug] Running hpack on
/home/danielv/private/local/hledger-orig/hledger-api/package.yaml
@(Stack/Package.hs:1179:9)
2016-10-22 09:06:26.710208: [debug] hpack output unchanged in
/home/danielv/private/local/hledger-orig/hledger-api/hledger-api.cabal
@(Stack/Package.hs:1186:38)
2016-10-22 09:06:26.713096: [debug] Running hpack on
/home/danielv/private/local/hledger-orig/hledger-lib/package.yaml
@(Stack/Package.hs:1179:9)
2016-10-22 09:06:26.759234: [debug] hpack output unchanged in
/home/danielv/private/local/hledger-orig/hledger-lib/hledger-lib.cabal
@(Stack/Package.hs:1186:38)
2016-10-22 09:06:26.766953: [debug] Running hpack on
/home/danielv/private/local/hledger-orig/hledger-ui/package.yaml
@(Stack/Package.hs:1179:9)
2016-10-22 09:06:26.788369: [debug] hpack output unchanged in
/home/danielv/private/local/hledger-orig/hledger-ui/hledger-ui.cabal
@(Stack/Package.hs:1186:38)
2016-10-22 09:06:26.792431: [debug] Running hpack on
/home/danielv/private/local/hledger-orig/hledger-web/package.yaml
@(Stack/Package.hs:1179:9)
2016-10-22 09:06:26.900442: [debug] hpack output unchanged in
/home/danielv/private/local/hledger-orig/hledger-web/hledger-web.cabal
@(Stack/Package.hs:1186:38)
2016-10-22 09:06:26.909441: [debug] Running hpack on
/home/danielv/private/local/hledger-orig/hledger/package.yaml
@(Stack/Package.hs:1179:9)
2016-10-22 09:06:27.022540: [debug] hpack output unchanged in
/home/danielv/private/local/hledger-orig/hledger/hledger.cabal
@(Stack/Package.hs:1186:38)
2016-10-22 09:06:27.030883: [debug] Parsing the targets
@(Stack/Build/Source.hs:219:5)
2016-10-22 09:06:27.090660: [debug] Exception ignored when attempting to
load
/home/danielv/private/local/hledger-orig/hledger-api/.stack-work/dist/x86_64-linux/Cabal-1.24.0.0/stack-build-cache:
/home/danielv/private/local/hledger-orig/hledger-api/.stack-work/dist/x86_64-linux/Cabal-1.24.0.0/stack-build-cache:
openBinaryFile: does not exist (No such file or directory)
@(Data/Store/VersionTagged.hs:86:9)
2016-10-22 09:06:27.410295: [debug] Exception ignored when attempting to
load
/home/danielv/private/local/hledger-orig/hledger-ui/.stack-work/dist/x86_64-linux/Cabal-1.24.0.0/stack-build-cache:
/home/danielv/private/local/hledger-orig/hledger-ui/.stack-work/dist/x86_64-linux/Cabal-1.24.0.0/stack-build-cache:
openBinaryFile: does not exist (No such file or directory)
@(Data/Store/VersionTagged.hs:86:9)
2016-10-22 09:06:27.430960: [debug] Exception ignored when attempting to
load
/home/danielv/private/local/hledger-orig/hledger-web/.stack-work/dist/x86_64-linux/Cabal-1.24.0.0/stack-build-cache:
/home/danielv/private/local/hledger-orig/hledger-web/.stack-work/dist/x86_64-linux/Cabal-1.24.0.0/stack-build-cache:
openBinaryFile: does not exist (No such file or directory)
@(Data/Store/VersionTagged.hs:86:9)
2016-10-22 09:06:27.530936: [debug] Finding out which packages are already
installed
@(Stack/Build/Installed.hs:73:5)
2016-10-22 09:06:27.531473: [debug] Run process: /usr/bin/ghc-pkg --global
--no-user-package-db dump --expand-pkgroot
@(System/Process/Read.hs:277:3)
2016-10-22 09:06:27.672843: [debug] Process finished in 141 ms:
/usr/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot
@(System/Process/Read.hs:277:3)
2016-10-22 09:06:27.690126: [debug] Ignoring package yaml due to wanting
version 0.8.18.6 instead of 0.8.18.7
@(Stack/Build/Installed.hs:196:5)
2016-10-22 09:06:27.690327: [debug] Ignoring package x509 due to wanting
version 1.6.3 instead of 1.6.4
@(Stack/Build/Installed.hs:196:5)
2016-10-22 09:06:27.690435: [debug] Ignoring package x509-validation due to
wanting version 1.6.3 instead of 1.6.4
@(Stack/Build/Installed.hs:196:5)
2016-10-22 09:06:27.690641: [debug] Ignoring package text-binary due to
wanting version 0.2.1 instead of 0.2.1.1
@(Stack/Build/Installed.hs:196:5)
2016-10-22 09:06:27.690748: [debug] Ignoring package streaming-commons due
to wanting version 0.1.15.5 instead of 0.1.16
@(Stack/Build/Installed.hs:196:5)
2016-10-22 09:06:27.690889: [debug] Ignoring package stack due to wanting
version 1.1.2 instead of 1.2.0
@(Stack/Build/Installed.hs:196:5)
2016-10-22 09:06:27.691015: [debug] Ignoring package QuickCheck due to
wanting version 2.8.2 instead of 2.9.2
@(Stack/Build/Installed.hs:196:5)
2016-10-22 09:06:27.691186: [debug] Ignoring package optparse-applicative
due to wanting version 0.12.1.0 instead of 0.13.0.0
@(Stack/Build/Installed.hs:196:5)
2016-10-22 09:06:27.691484: [debug] Ignoring package mono-traversable due
to wanting version 1.0.0.1 instead of 1.0.1
@(Stack/Build/Installed.hs:196:5)
2016-10-22 09:06:27.691639: [debug] Ignoring package http-conduit due to
wanting version 2.1.11 instead of 2.2.2.1
@(Stack/Build/Installed.hs:196:5)
2016-10-22 09:06:27.691749: [debug] Ignoring package http-client due to
wanting version 0.4.31.1 instead of 0.5.3.2
@(Stack/Build/Installed.hs:196:5)
2016-10-22 09:06:27.691854: [debug] Ignoring package http-client-tls due to
wanting version 0.2.4.1 instead of 0.3.3
@(Stack/Build/Installed.hs:196:5)
2016-10-22 09:06:27.691958: [debug] Ignoring package http-api-data due to
wanting version 0.2.4 instead of 0.3.1
@(Stack/Build/Installed.hs:196:5)
2016-10-22 09:06:27.692069: [debug] Ignoring package hspec due to wanting
version 2.2.3 instead of 2.2.4
@(Stack/Build/Installed.hs:196:5)
2016-10-22 09:06:27.692188: [debug] Ignoring package hspec-discover due to
wanting version 2.2.3 instead of 2.2.4
@(Stack/Build/Installed.hs:196:5)
2016-10-22 09:06:27.692294: [debug] Ignoring package hspec-core due to
wanting version 2.2.3 instead of 2.2.4
@(Stack/Build/Installed.hs:196:5)
2016-10-22 09:06:27.692395: [debug] Ignoring package hpack due to wanting
version 0.14.1 instead of 0.15.0
@(Stack/Build/Installed.hs:196:5)
2016-10-22 09:06:27.692523: [debug] Ignoring package fast-logger due to
wanting version 2.4.6 instead of 2.4.7
@(Stack/Build/Installed.hs:196:5)
2016-10-22 09:06:27.692777: [debug] Ignoring package cryptonite due to
wanting version 0.19 instead of 0.20
@(Stack/Build/Installed.hs:196:5)
2016-10-22 09:06:27.692927: [debug] Ignoring package conduit due to wanting
version 1.2.7 instead of 1.2.8
@(Stack/Build/Installed.hs:196:5)
2016-10-22 09:06:27.693043: [debug] Ignoring package conduit-extra due to
wanting version 1.1.13.2 instead of 1.1.13.3
@(Stack/Build/Installed.hs:196:5)
2016-10-22 09:06:27.693167: [debug] Ignoring package attoparsec due to
wanting version 0.13.0.2 instead of 0.13.1.0
@(Stack/Build/Installed.hs:196:5)
2016-10-22 09:06:27.693287: [debug] Ignoring package aeson due to wanting
version 0.11.2.1 instead of 0.11.2.0
@(Stack/Build/Installed.hs:196:5)
2016-10-22 09:06:27.693502: [debug] Ignoring package extra due to wanting
version 1.4.10 instead of 1.5
@(Stack/Build/Installed.hs:196:5)
2016-10-22 09:06:27.693788: [debug] Ignoring package time-locale-compat due
to wanting version 0.1.1.3 instead of 0.1.1.1
@(Stack/Build/Installed.hs:196:5)
2016-10-22 09:06:27.694359: [debug] Ignoring package ieee754 due to wanting
version 0.7.8 instead of 0.7.6
@(Stack/Build/Installed.hs:196:5)
2016-10-22 09:06:27.694893: [debug] Run process: /usr/bin/ghc-pkg --user
--no-user-package-db --package-db
/home/danielv/.stack/snapshots/x86_64-linux/lts-7.0/8.0.1/pkgdb dump
--expand-pkgroot
@(System/Process/Read.hs:277:3)
2016-10-22 09:06:27.791334: [debug] Process finished in 96 ms:
/usr/bin/ghc-pkg --user --no-user-package-db --package-db
/home/danielv/.stack/snapshots/x86_64-linux/lts-7.0/8.0.1/pkgdb dump
--expand-pkgroot
@(System/Process/Read.hs:277:3)
2016-10-22 09:06:27.792816: [debug] Run process: /usr/bin/ghc-pkg --user
--no-user-package-db --package-db
/home/danielv/private/local/hledger-orig/.stack-work/install/x86_64-linux/lts-7.0/8.0.1/pkgdb
dump --expand-pkgroot
@(System/Process/Read.hs:277:3)
2016-10-22 09:06:27.855749: [debug] Process finished in 62 ms:
/usr/bin/ghc-pkg --user --no-user-package-db --package-db
/home/danielv/private/local/hledger-orig/.stack-work/install/x86_64-linux/lts-7.0/8.0.1/pkgdb
dump --expand-pkgroot
@(System/Process/Read.hs:277:3)
2016-10-22 09:06:27.856652: [debug] Constructing the build plan
@(Stack/Build/ConstructPlan.hs:157:5)
2016-10-22 09:06:27.864137: [debug] Checking if we are going to build
multiple executables with the same name
@(Stack/Build.hs:174:5)
2016-10-22 09:06:27.864445: [debug] Executing the build plan
@(Stack/Build/Execute.hs:359:5)
2016-10-22 09:06:27.864816: [debug] Getting global package database location
@(Stack/GhcPkg.hs:54:5)
2016-10-22 09:06:27.864928: [debug] Run process: /usr/bin/ghc-pkg
--no-user-package-db list --global
@(System/Process/Read.hs:277:3)
2016-10-22 09:06:27.935506: [debug] Process finished in 70 ms:
/usr/bin/ghc-pkg --no-user-package-db list --global
@(System/Process/Read.hs:277:3)
2016-10-22 09:06:27.938755: [debug] Encoding
/home/danielv/private/local/hledger-orig/hledger/.stack-work/dist/x86_64-linux/Cabal-1.24.0.0/stack-build-cache
@(Data/Store/VersionTagged.hs:51:5)
2016-10-22 09:06:27.952924: [debug] Finished writing
/home/danielv/private/local/hledger-orig/hledger/.stack-work/dist/x86_64-linux/Cabal-1.24.0.0/stack-build-cache
@(Data/Store/VersionTagged.hs:55:5)
2016-10-22 09:06:27.953095: [info] hledger-0.28: build
@(Stack/Build/Execute.hs:740:23)
2016-10-22 09:06:27.953384: [debug] Run process:
/home/danielv/.stack/setup-exe-cache/x86_64-linux/setup-Simple-Cabal-1.24.0.0-ghc-8.0.1
--builddir=.stack-work/dist/x86_64-linux/Cabal-1.24.0.0 build lib:hledger
exe:hledger --ghc-options " -ddump-hi -ddump-to-file"
@(System/Process/Read.hs:277:3)
2016-10-22 09:06:28.065265: [info] Preprocessing library hledger-0.28...
@(Stack/Build/Execute.hs:920:67)
2016-10-22 09:06:28.660017: [info] [ 4 of 22] Compiling
Hledger.Cli.DocFiles ( Hledger/Cli/DocFiles.hs,
.stack-work/dist/x86_64-linux/Cabal-1.24.0.0/build/Hledger/Cli/DocFiles.o )
@(Stack/Build/Execute.hs:920:67)
2016-10-22 09:06:29.046456: [warn]
@(Stack/Build/Execute.hs:920:67)
2016-10-22 09:06:29.047149: [warn]
/home/danielv/private/local/hledger-orig/hledger/Hledger/Cli/DocFiles.hs:37:6:
error:
@(Stack/Build/Execute.hs:920:67)
2016-10-22 09:06:29.047364: [warn] * Exception when trying to run
compile-time code:
@(Stack/Build/Execute.hs:920:67)
2016-10-22 09:06:29.047516: [warn]
/home/danielv/private/local/hledger-orig/hledger/doc/hledger.1:
hGetContents: invalid argument (invalid byte sequence)
@(Stack/Build/Execute.hs:920:67)
2016-10-22 09:06:29.047660: [warn] Code: (>>=) makeRelativeToProject
"doc/hledger.1" embedStringFile
@(Stack/Build/Execute.hs:920:67)
2016-10-22 09:06:29.047786: [warn] * In the untyped splice:
@(Stack/Build/Execute.hs:920:67)
2016-10-22 09:06:29.047914: [warn] $(makeRelativeToProject
"doc/hledger.1" >>= embedStringFile)
@(Stack/Build/Execute.hs:920:67)
2016-10-22 09:06:29.179643: [debug] Encoding
/home/danielv/private/local/hledger-orig/hledger/.stack-work/dist/x86_64-linux/Cabal-1.24.0.0/stack-build-cache
@(Data/Store/VersionTagged.hs:51:5)
2016-10-22 09:06:29.203470: [debug] Finished writing
/home/danielv/private/local/hledger-orig/hledger/.stack-work/dist/x86_64-linux/Cabal-1.24.0.0/stack-build-cache
@(Data/Store/VersionTagged.hs:55:5)

-- While building package hledger-0.28 using:

/home/danielv/.stack/setup-exe-cache/x86_64-linux/setup-Simple-Cabal-1.24.0.0-ghc-8.0.1
--builddir=.stack-work/dist/x86_64-linux/Cabal-1.24.0.0 build lib:hledger
exe:hledger --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1

On Fri, Oct 21, 2016 at 1:50 AM, Simon Michael [email protected]
wrote:

Could you try stack --stack-yaml=stack-ghc8.yaml install hledger also.
Perhaps GHC 8 will give a better error, revealing which tool it's coming
from.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#420 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABcrVqPZhsM2uflNv3Ht4wUeRhxKXro1ks5q1_AigaJpZM4KclR3
.

@simonmichael
Copy link
Owner

Those are great UX ideas for hledger, and I might have a wishlist issue open for it somewhere [nope, just a note].

For building hledger, those changes would need to be done in GHC and maybe other tools as well, right ?

@simonmichael
Copy link
Owner

PS what can you tell from the verbose log ? Is the error coming from GHC ?

@simonmichael
Copy link
Owner

@daniel-vainsencher did you ever figure out what was erroring ? Any idea what the resolution for this issue should be as far as hledger is concerned ?

@talex5
Copy link

talex5 commented Jul 23, 2018

This is easily reproduced with Docker. Do docker run -it fedora:28 bash then run the install script from http://hledger.org/download.html

hledger-1.10: configure
hledger-1.10: build

--  While building custom Setup.hs for package hledger-1.10 using:
      /root/.stack/setup-exe-cache/x86_64-linux-tinfo6/Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.3 --builddir=.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.2.0.1 build --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1
    Logs have been written to: /root/.stack/global-project/.stack-work/logs/hledger-1.10.log

    Configuring hledger-1.10...
    Preprocessing library for hledger-1.10..
    Building library for hledger-1.10..
    [ 1 of 30] Compiling Hledger.Cli.DocFiles ( Hledger/Cli/DocFiles.hs, .stack-work/dist/x86_64-linux-tinfo6/Cabal-2.2.0.1/build/Hledger/Cli/DocFiles.o )
    
    /tmp/stack69/hledger-1.10/Hledger/Cli/DocFiles.hs:38:6: error:
        * Exception when trying to run compile-time code:
            /tmp/stack69/hledger-1.10/embeddedfiles/hledger.1: hGetContents: invalid argument (invalid byte sequence)
          Code: makeRelativeToProject "embeddedfiles/hledger.1"
                  >>= embedStringFile
        * In the untyped splice:
            $(makeRelativeToProject "embeddedfiles/hledger.1"
                >>= embedStringFile)
       |
    38 |     ($(makeRelativeToProject "embeddedfiles/hledger.1" >>= embedStringFile)
       |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
Failed to install hledger-1.10 hledger-lib-1.10

@simonmichael simonmichael added easy? good-first-issue If you're a new contributor, this might be a good one for you. labels Jul 23, 2018
@simonmichael
Copy link
Owner

Thanks. This is a well known issue with haskell tools and applications built with GHC. Since hledger-install.sh is supposed to work around all known issues, I guess it should be setting LANG to something that can handle the hledger docs if it is unset. Like the Makefile does:

# GHC-compiled executables require a locale (and not just C) or they
# will die on encountering non-ascii data. Set LANG to something if not already set.
export LANG?=en_US.UTF-8

Maybe that syntax works in hledger-install.sh too ?

@simonmichael
Copy link
Owner

Do we also need to explain this in the b2, b3 and c steps on the download page ? On the downside, whenever we try to document every possible breakage the instructions become huge and unreadable.

@zarybnicky
Copy link
Contributor

@simonmichael I think it's best to fix this issue in the code itself, instead of trying to cover all possible ways stack/cabal could be called. The way to do this would be to simply hSetEncoding on all files-to-be-embedded via a custom version of embedStringFile - they should all be in UTF-8, right?

Instead of the file-embed's version\

embedStringFile :: FilePath -> Q Exp
embedStringFile fp =
#if MIN_VERSION_template_haskell(2,7,0)
    qAddDependentFile fp >>
#endif
  (runIO $ P.readFile fp) >>= strToExp

replace the last line with

runIO $ do
  h <- openFile fp ReadMode 
  hSetEncoding h utf8_bom
  strToExp <$> hGetContents inputHandle

(Not tested, might open a PR after I get some desperately needed sleep...)

AFAIK, this should fix all problems compiling with LANG=POSIX or similar.

@simonmichael
Copy link
Owner

That sounds interesting. I have sometimes tried too hard to paper over tooling/ecosystem issues and regretted it; it can be more fragile and cost more than it's worth. Let us know if you try it.

@simonmichael simonmichael removed easy? good-first-issue If you're a new contributor, this might be a good one for you. labels Aug 2, 2018
@simonmichael simonmichael changed the title UTF Locale required to build hledger configured locale required to build hledger Aug 24, 2018
@simonmichael simonmichael changed the title configured locale required to build hledger a configured locale is required to build hledger Aug 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. docs Documentation-related. tools hledger developer tools, scripts, processes..
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants