Cannot install Yesod Haskell web framework on Mac OSX - macos

I've no idea how to fix this. Does anybody have any ideas?
I'm getting the following error messages when I try:
~ >>> cabal install yesod
Resolving dependencies...
Configuring aeson-0.5.0.0...
Preprocessing library aeson-0.5.0.0...
Preprocessing test suites for aeson-0.5.0.0...
Building aeson-0.5.0.0...
[ 1 of 10] Compiling Data.Aeson.Types.Internal ( Data/Aeson/Types/Internal.hs, dist/build/Data/Aeson/Types/Internal.o )
[ 2 of 10] Compiling Data.Aeson.Functions ( Data/Aeson/Functions.hs, dist/build/Data/Aeson/Functions.o )
[ 3 of 10] Compiling Data.Aeson.Types.Class ( Data/Aeson/Types/Class.hs, dist/build/Data/Aeson/Types/Class.o )
[ 4 of 10] Compiling Data.Aeson.Types ( Data/Aeson/Types.hs, dist/build/Data/Aeson/Types.o )
[ 5 of 10] Compiling Data.Aeson.Parser.Internal ( Data/Aeson/Parser/Internal.hs, dist/build/Data/Aeson/Parser/Internal.o )
SpecConstr
Function `$j_sqbP{v} [lid]'
has two call patterns, but the limit is 1
Use -fspec-constr-count=n to set the bound
Use -dppr-debug to see specialisations
SpecConstr
Function `$j_sqbP{v} [lid]'
has two call patterns, but the limit is 1
Use -fspec-constr-count=n to set the bound
Use -dppr-debug to see specialisations
SpecConstr
Function `$j_sqbT{v} [lid]'
has two call patterns, but the limit is 1
Use -fspec-constr-count=n to set the bound
Use -dppr-debug to see specialisations
SpecConstr
Function `$j_sqbP{v} [lid]'
has two call patterns, but the limit is 1
Use -fspec-constr-count=n to set the bound
Use -dppr-debug to see specialisations
SpecConstr
Function `$j_sqbT{v} [lid]'
has two call patterns, but the limit is 1
Use -fspec-constr-count=n to set the bound
Use -dppr-debug to see specialisations
SpecConstr
Function `$j_sqbP{v} [lid]'
has two call patterns, but the limit is 1
Use -fspec-constr-count=n to set the bound
Use -dppr-debug to see specialisations
SpecConstr
Function `$j_sqbT{v} [lid]'
has two call patterns, but the limit is 1
Use -fspec-constr-count=n to set the bound
Use -dppr-debug to see specialisations
SpecConstr
Function `$j_sqc0{v} [lid]'
has two call patterns, but the limit is 1
Use -fspec-constr-count=n to set the bound
Use -dppr-debug to see specialisations
SpecConstr
Function `ks3{v sqhn} [lid]'
has one call pattern, but the limit is 0
Use -fspec-constr-count=n to set the bound
Use -dppr-debug to see specialisations
[ 6 of 10] Compiling Data.Aeson.Parser ( Data/Aeson/Parser.hs, dist/build/Data/Aeson/Parser.o )
[ 7 of 10] Compiling Data.Aeson.Encode ( Data/Aeson/Encode.hs, dist/build/Data/Aeson/Encode.o )
[ 8 of 10] Compiling Data.Aeson.Generic ( Data/Aeson/Generic.hs, dist/build/Data/Aeson/Generic.o )
[ 9 of 10] Compiling Data.Aeson ( Data/Aeson.hs, dist/build/Data/Aeson.o )
[10 of 10] Compiling Data.Aeson.TH ( Data/Aeson/TH.hs, dist/build/Data/Aeson/TH.o )
Data/Aeson/Generic.hs:31:8:
Could not find module `Control.Monad.State.Strict':
Perhaps you haven't installed the profiling libraries for package `mtl-2.0.1.0'?
Use -v to see a list of the files searched for.
Configuring control-monad-attempt-0.3.0.1...
Preprocessing library control-monad-attempt-0.3.0.1...
Building control-monad-attempt-0.3.0.1...
[1 of 1] Compiling Control.Monad.Attempt ( Control/Monad/Attempt.hs, dist/build/Control/Monad/Attempt.o )
[1 of 1] Compiling Control.Monad.Attempt ( Control/Monad/Attempt.hs, dist/build/Control/Monad/Attempt.p_o )
Control/Monad/Attempt.hs:33:1:
Failed to load interface for `Control.Monad.Trans.Class':
Perhaps you haven't installed the profiling libraries for package `transformers-0.2.2.0'?
Use -v to see a list of the files searched for.
Configuring email-validate-0.2.7...
Preprocessing library email-validate-0.2.7...
Building email-validate-0.2.7...
[1 of 1] Compiling Text.Email.Validate ( Text/Email/Validate.hs, dist/build/Text/Email/Validate.o )
Text/Email/Validate.hs:11:8:
Could not find module `Text.Parsec.Char':
Perhaps you haven't installed the profiling libraries for package `parsec-3.1.1'?
Use -v to see a list of the files searched for.
Configuring enumerator-0.4.18...
Preprocessing library enumerator-0.4.18...
Building enumerator-0.4.18...
[ 1 of 10] Compiling Data.Enumerator.Util ( lib/Data/Enumerator/Util.hs, dist/build/Data/Enumerator/Util.o )
[ 2 of 10] Compiling Data.Enumerator.Internal ( lib/Data/Enumerator/Internal.hs, dist/build/Data/Enumerator/Internal.o )
[ 3 of 10] Compiling Data.Enumerator.List[boot] ( lib/Data/Enumerator/List.hs-boot, dist/build/Data/Enumerator/List.o-boot )
[ 4 of 10] Compiling Data.Enumerator.Compatibility ( lib/Data/Enumerator/Compatibility.hs, dist/build/Data/Enumerator/Compatibility.o )
[ 5 of 10] Compiling Data.Enumerator ( lib/Data/Enumerator.hs, dist/build/Data/Enumerator.o )
lib/Data/Enumerator.hs:63:11:
Warning: `Enumerator' is exported by `module Data.Enumerator.Internal' and `Enumerator'
lib/Data/Enumerator.hs:63:11:
Warning: `Iteratee' is exported by `module Data.Enumerator.Internal' and `Iteratee'
lib/Data/Enumerator.hs:63:11:
Warning: `Enumeratee' is exported by `module Data.Enumerator.Internal' and `Enumeratee'
lib/Data/Enumerator.hs:63:11:
Warning: `>>==' is exported by `module Data.Enumerator.Internal' and `(>>==)'
lib/Data/Enumerator.hs:63:11:
Warning: `==<<' is exported by `module Data.Enumerator.Internal' and `(==<<)'
lib/Data/Enumerator.hs:63:11:
Warning: `$$' is exported by `module Data.Enumerator.Internal' and `($$)'
lib/Data/Enumerator.hs:63:11:
Warning: `>==>' is exported by `module Data.Enumerator.Internal' and `(>==>)'
lib/Data/Enumerator.hs:63:11:
Warning: `<==<' is exported by `module Data.Enumerator.Internal' and `(<==<)'
[ 6 of 10] Compiling Data.Enumerator.List ( lib/Data/Enumerator/List.hs, dist/build/Data/Enumerator/List.o )
[ 7 of 10] Compiling Data.Enumerator.Binary ( lib/Data/Enumerator/Binary.hs, dist/build/Data/Enumerator/Binary.o )
lib/Data/Enumerator/Binary.hs:721:25:
Warning: This binding for `eof' shadows the existing binding
bound at lib/Data/Enumerator/Binary.hs:716:29
lib/Data/Enumerator/Binary.hs:788:17:
Warning: This binding for `rem' shadows the existing binding
imported from Prelude at lib/Data/Enumerator/Binary.hs:98:1-92
[ 8 of 10] Compiling Data.Enumerator.IO ( lib/Data/Enumerator/IO.hs, dist/build/Data/Enumerator/IO.o )
[ 9 of 10] Compiling Data.Enumerator.Text ( lib/Data/Enumerator/Text.hs, dist/build/Data/Enumerator/Text.o )
SpecConstr
Function `$j_sn5C{v} [lid]'
has five call patterns, but the limit is 3
Use -fspec-constr-count=n to set the bound
Use -dppr-debug to see specialisations
lib/Data/Enumerator/Text.hs:744:25:
Warning: This binding for `eof' shadows the existing binding
bound at lib/Data/Enumerator/Text.hs:739:29
[10 of 10] Compiling Data.Enumerator.Trans ( lib/Data/Enumerator/Trans.hs, dist/build/Data/Enumerator/Trans.o )
lib/Data/Enumerator.hs:80:18:
Could not find module `Data.Functor.Identity':
Perhaps you haven't installed the profiling libraries for package `transformers-0.2.2.0'?
Use -v to see a list of the files searched for.
Configuring shakespeare-0.10.2...
Preprocessing library shakespeare-0.10.2...
Building shakespeare-0.10.2...
[1 of 2] Compiling Text.Shakespeare.Base ( Text/Shakespeare/Base.hs, dist/build/Text/Shakespeare/Base.o )
[2 of 2] Compiling Text.Shakespeare ( Text/Shakespeare.hs, dist/build/Text/Shakespeare.o )
Text/Shakespeare.hs:20:8:
Could not find module `Text.ParserCombinators.Parsec':
Perhaps you haven't installed the profiling libraries for package `parsec-3.1.1'?
Use -v to see a list of the files searched for.
Configuring simple-sendfile-0.2.0...
Preprocessing library simple-sendfile-0.2.0...
Building simple-sendfile-0.2.0...
[1 of 3] Compiling Network.Sendfile.Types ( Network/Sendfile/Types.hs, dist/build/Network/Sendfile/Types.o )
[2 of 3] Compiling Network.Sendfile.MacOS ( dist/build/Network/Sendfile/MacOS.hs, dist/build/Network/Sendfile/MacOS.o )
[3 of 3] Compiling Network.Sendfile ( Network/Sendfile.hs, dist/build/Network/Sendfile.o )
Network/Sendfile/MacOS.hsc:19:8:
Could not find module `Network.Socket':
Perhaps you haven't installed the profiling libraries for package `network-2.3.0.2'?
Use -v to see a list of the files searched for.
Configuring transformers-base-0.4.1...
Preprocessing library transformers-base-0.4.1...
Building transformers-base-0.4.1...
[1 of 1] Compiling Control.Monad.Base ( src/Control/Monad/Base.hs, dist/build/Control/Monad/Base.o )
src/Control/Monad/Base.hs:63:10:
Warning: orphan instance: instance Applicative (L.ST s)
src/Control/Monad/Base.hs:67:10:
Warning: orphan instance: instance Applicative (S.ST s)
src/Control/Monad/Base.hs:28:8:
Could not find module `Control.Monad.Trans.Cont':
Perhaps you haven't installed the profiling libraries for package `transformers-0.2.2.0'?
Use -v to see a list of the files searched for.
Configuring xss-sanitize-0.3.1...
Preprocessing library xss-sanitize-0.3.1...
Preprocessing test suites for xss-sanitize-0.3.1...
Building xss-sanitize-0.3.1...
[1 of 2] Compiling Text.HTML.SanitizeXSS.Css ( Text/HTML/SanitizeXSS/Css.hs, dist/build/Text/HTML/SanitizeXSS/Css.o )
[2 of 2] Compiling Text.HTML.SanitizeXSS ( Text/HTML/SanitizeXSS.hs, dist/build/Text/HTML/SanitizeXSS.o )
Text/HTML/SanitizeXSS.hs:19:8:
Could not find module `Network.URI':
Perhaps you haven't installed the profiling libraries for package `network-2.3.0.2'?
Use -v to see a list of the files searched for.
cabal: Error: some packages failed to install:
aeson-0.5.0.0 failed during the building phase. The exception was:
ExitFailure 1
asn1-data-0.6.1.2 depends on enumerator-0.4.18 which failed to install.
attoparsec-enumerator-0.3 depends on enumerator-0.4.18 which failed to
install.
authenticate-0.10.4 depends on transformers-base-0.4.1 which failed to
install.
blaze-builder-enumerator-0.2.0.3 depends on enumerator-0.4.18 which failed to
install.
certificate-1.0.1 depends on enumerator-0.4.18 which failed to install.
conduit-0.0.4 depends on transformers-base-0.4.1 which failed to install.
control-monad-attempt-0.3.0.1 failed during the building phase. The exception
was:
ExitFailure 1
data-object-yaml-0.3.4 depends on transformers-base-0.4.1 which failed to
install.
email-validate-0.2.7 failed during the building phase. The exception was:
ExitFailure 1
enumerator-0.4.18 failed during the building phase. The exception was:
ExitFailure 1
hamlet-0.10.7.1 depends on shakespeare-0.10.2 which failed to install.
http-enumerator-0.7.2.5 depends on transformers-base-0.4.1 which failed to
install.
lifted-base-0.1.0.2 depends on transformers-base-0.4.1 which failed to
install.
monad-control-0.3.1 depends on transformers-base-0.4.1 which failed to
install.
persistent-0.6.4.4 depends on transformers-base-0.4.1 which failed to install.
persistent-template-0.6.3.1 depends on transformers-base-0.4.1 which failed to
install.
pool-0.1.2 depends on transformers-base-0.4.1 which failed to install.
shakespeare-0.10.2 failed during the building phase. The exception was:
ExitFailure 1
shakespeare-css-0.10.6 depends on shakespeare-0.10.2 which failed to install.
shakespeare-i18n-0.0.0 depends on shakespeare-0.10.2 which failed to install.
shakespeare-js-0.10.4 depends on shakespeare-0.10.2 which failed to install.
shakespeare-text-0.10.3 depends on shakespeare-0.10.2 which failed to install.
simple-sendfile-0.2.0 failed during the building phase. The exception was:
ExitFailure 1
tls-0.8.5 depends on enumerator-0.4.18 which failed to install.
tls-extra-0.4.2 depends on enumerator-0.4.18 which failed to install.
transformers-base-0.4.1 failed during the building phase. The exception was:
ExitFailure 1
wai-0.4.3 depends on enumerator-0.4.18 which failed to install.
wai-extra-0.4.6 depends on enumerator-0.4.18 which failed to install.
wai-logger-0.1.2 depends on enumerator-0.4.18 which failed to install.
warp-0.4.6.3 depends on simple-sendfile-0.2.0 which failed to install.
xml-enumerator-0.4.4.1 depends on enumerator-0.4.18 which failed to install.
xss-sanitize-0.3.1 failed during the building phase. The exception was:
ExitFailure 1
yaml-0.5.1.2 depends on transformers-base-0.4.1 which failed to install.
yesod-0.9.4.1 depends on xss-sanitize-0.3.1 which failed to install.
yesod-auth-0.7.9 depends on xss-sanitize-0.3.1 which failed to install.
yesod-core-0.9.4.1 depends on transformers-base-0.4.1 which failed to install.
yesod-form-0.3.4.2 depends on xss-sanitize-0.3.1 which failed to install.
yesod-json-0.2.3 depends on transformers-base-0.4.1 which failed to install.
yesod-persistent-0.2.2 depends on transformers-base-0.4.1 which failed to
install.
zlib-enum-0.2.1 depends on enumerator-0.4.18 which failed to install.

You're trying to build Yesod, and all of its dependencies, with profiling libraries, but the existing packages you have installed — mtl, parsec, and so on — don't have the profiling libraries installed. If you want to compile a package with profiling libraries, all of its dependencies must have the profiling libraries installed too. Presumably, you turned on profiling in your ~/.cabal/config at some point after having already installed packages.
One solution would be to explicitly cabal install --reinstall each package it's complaining about, but it's probably easier to cabal install --reinstall world (or save your ~/.cabal/config, rm -r ~/.cabal ~/.ghc and start over).
If you don't really care that much about profiling libraries, just comment out the library-profiling: True line in your ~/.cabal/config.

Related

Weird Haskell 'stack' error: "can't load .so/.DLL" "not a writable segment"

I am trying to install ghc-mod so that I can use ide-haskell in Atom.
The instructions say to use stack build ghc-mod. It seems that GHC 8.2+ is not supported by ghc-mod, so I set my resolver to lts-9.21.
When running stack build ghc-mod, I keep getting this error (emphasis mine; not using code formatting because line wrap helps readability):
aeson > : can't load .so/.DLL for: /Users/timoffex/.stack/snapshots/x86_64-osx/db354248ca37308313a93487c93190e1d5b819629b60b38b68871c9a691e52b9/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/timoffex/.stack/snapshots/x86_64-osx/db354248ca37308313a93487c93190e1d5b819629b60b38b68871c9a691e52b9/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/timoffex/.stack/snapshots/x86_64-osx/db354248ca37308313a93487c93190e1d5b819629b60b38b68871c9a691e52b9/8.0.2/lib/x86_64-osx-ghc-8.0.2/libHStime-locale-compat-0.1.1.3-KZ1jqNx8uhlHjmuPPj6V1Y-ghc8.0.2.dylib)
... (later)
-- While building package aeson-1.1.2.0 using:
/Users/timoffex/.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/4
Here's a snippet from the above that looks weird to me:
REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB has segment 2 which is not a writable segment
I am running macOS Catalina 10.15.3.
I can't find any mention of this online except for this open GitHub issue: https://github.com/facebook/duckling/issues/446
I also tried lts-7.24. I get the exact same error, except it happens while building profunctors.
What could be the problem? Where can I file a bug?
I had the same error in a project using resolver: lts-9.17.
What fixed it for me is to update stack.yaml and use this line:
resolver: lts-10.9

how to use CPACK_NSIS_WELCOME_TITLE and CPACK_NSIS_FINISH_TITLE?

Using CPack and NSIS to package my application. Everything works well, with the exception of the following: I cannot figure out how to use CPACK_NSIS_WELCOME_TITLE and CPACK_NSIS_FINISH_TITLE.
All of my CPack options/customizations are in 1 place, just prior to calling INCLUDE (CPack). Here are examples of what I've tried:
SET ( CPACK_NSIS_WELCOME_TITLE "afasfasf asfafasf test!!!" )
SET ( CPACK_NSIS_FINISH_TITLE "blah blah blah testing" )
I've also tried the "3LINES" versions like this:
SET ( CPACK_NSIS_WELCOME_TITLE_3LINES "This is the title line.\nMore text.\nThird line." )
SET ( CPACK_NSIS_FINISH_TITLE_3LINES "afaf afafaf afasfaf affaf test test test afafasf afasfasf" )
While the installer is created without error, I don't see any of this text appearing anywhere on the welcome screen, the finish screen, or any other screen.
This is the version of cmake/cpack I'm using:
C:\src\Project\build64>"\Program Files\CMake\bin\cpack.exe" --version
cpack version 3.16.0-rc3
The end of the console output it generates seems to indicate there were no problems:
...
CPack: Create package using NSIS
CPack: Install projects
CPack: - Install project: Project [Debug]
CPack: Create package
CPack: - package: C:/src/Project/build64/project_v1.0.1.exe generated.
FinalizeBuildStatus:
Deleting file "x64\Debug\PACKAGE\PACKAGE.tlog\unsuccessfulbuild".
Touching "x64\Debug\PACKAGE\PACKAGE.tlog\PACKAGE.lastbuildstate".
Done Building Project "C:\src\Project\build64\PACKAGE.vcxproj" (default targets).
Build succeeded.
0 Warning(s)
0 Error(s)
According to the documentation (3.16.4 and 3.17.0-rc1) the variables you mention (CPACK_NSIS_WELCOME_TITLE, CPACK_NSIS_FINISH_TITLE, CPACK_NSIS_WELCOME_TITLE_3LINES, CPACK_NSIS_FINISH_TITLE_3LINES) have been introduced only recently in CMake 3.17.0-rc1. As you are using CMake version 3.16.0-rc3 you need to upgrade.

Resolving dependency issue while installing keter vis stack

I am trying to install the keter executable to the implicit "global-project" of stack. I use stack install keter from the directory to do this. When I do so, I get the error.
In the dependencies for keter-1.4.3.2:
http-reverse-proxy-0.5.0.1 from stack configuration does not match >=0.4.2 && <0.5 (latest matching version is 0.4.5)
unix-compat-0.5.0.1 from stack configuration does not match >=0.3 && <0.5 (latest matching version is 0.4.3.1)
needed since keter is a build target.
Some different approaches to resolving this:
* Set 'allow-newer: true' in <$HOME>/.stack/config.yaml to ignore all version constraints and build anyway.
* Consider trying 'stack solver', which uses the cabal-install solver to attempt to find some working build configuration. This can be convenient when dealing with many complicated
constraint errors, but results may be unpredictable.
* Recommended action: try adding the following to your extra-deps in <$HOME>/.stack/global-project/stack.yaml:
http-reverse-proxy-0.4.5#sha256:7f2a181ec848e8fdc0bdb4d6e775e488897957ee7ae0a2b82a623360168ccf96
unix-compat-0.4.3.1#sha256:a291f209e9c9723204c49c978ed2c53997dbc9666e53fe7bf7a3548b2c8bb22c
When I follow the recommended action, (i.e., I add the following to /.stack/global-project/stack.yaml):
extra-deps:
- http-reverse-proxy-0.4.5#sha256:7f2a181ec848e8fdc0bdb4d6e775e488897957ee7ae0a2b82a623360168ccf96
- unix-compat-0.4.3.1#sha256:a291f209e9c9723204c49c978ed2c53997dbc9666e53fe7bf7a3548b2c8bb22c
I get a different error when I do stack install keter a second time.
Completed 8 action(s).
-- While building package keter-1.4.3.2 using:
/.stack/setup-exe-cache/x86_64-linux-tinfo6/Cabal-simple_mPHDZzAJ_2.0.1.0_ghc-8.2.2 --builddir=.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0 build --ghc-options " -ddump-hi -ddump-to-file -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
Logs have been written to: /.stack/global-project/.stack-work/logs/keter-1.4.3.2.log
Configuring keter-1.4.3.2...
Preprocessing library for keter-1.4.3.2..
Building library for keter-1.4.3.2..
[ 1 of 18] Compiling Codec.Archive.TempTarball ( Codec/Archive/TempTarball.hs, .stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build/Codec/Archive/TempTarball.o )
[ 2 of 18] Compiling Data.Conduit.LogFile ( Data/Conduit/LogFile.hs, .stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build/Data/Conduit/LogFile.o )
[ 3 of 18] Compiling Data.Conduit.Process.Unix ( Data/Conduit/Process/Unix.hs, .stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build/Data/Conduit/Process/Unix.o )
/tmp/stack2837/keter-1.4.3.2/Data/Conduit/Process/Unix.hs:65:20: error:
• The constructor ‘ProcessHandle’ should have 3 arguments, but has been given 2
• In the pattern: ProcessHandle m _
In an equation for ‘processHandleMVar’:
processHandleMVar (ProcessHandle m _) = m
|
65 | processHandleMVar (ProcessHandle m _) = m
| ^^^^^^^^^^^^^^^^^
My guess is that keter still ends up trying to use the 0.5* versions when building, which have different signatures and so the build breaks. Any ideas on how to correctly install keter?
Here is some debug information:
`stack exec -- ghc -v`
Glasgow Haskell Compiler, Version 8.2.2, stage 2 booted by GHC version 8.0.2
Using binary package database: <$HOME>/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/lib/ghc-8.2.2/package.conf.d/package.cache
Using binary package database: <$HOME>/.stack/snapshots/x86_64-linux-tinfo6/lts-11.5/8.2.2/pkgdb/package.cache
Using binary package database: <$HOME>/.stack/global-project/.stack-work/install/x86_64-linux-tinfo6/lts-11.5/8.2.2/pkgdb/package.cache
package flags []
loading package database <$HOME>/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/lib/ghc-8.2.2/package.conf.d
loading package database <$HOME>/.stack/snapshots/x86_64-linux-tinfo6/lts-11.5/8.2.2/pkgdb
loading package database <$HOME>/.stack/global-project/.stack-work/install/x86_64-linux-tinfo6/lts-11.5/8.2.2/pkgdb
wired-in package ghc-prim mapped to ghc-prim-0.5.1.1
wired-in package integer-gmp mapped to integer-gmp-1.0.1.0
wired-in package base mapped to base-4.10.1.0
wired-in package rts mapped to rts
wired-in package template-haskell mapped to template-haskell-2.12.0.0
wired-in package ghc mapped to ghc-8.2.2
wired-in package dph-seq not found.
wired-in package dph-par not found.
*** Deleting temp files:
Deleting:
*** Deleting temp dirs:
Deleting:
ghc: no input files
Usage: For basic information, try the `--help' option.
stack --version
Version 1.9.1, Git revision f9d0042c141660e1d38f797e1d426be4a99b2a3c (6168 commits) x86_64 hpack-0.31.0

Julia Error Building Mongo.jl Package on Windows 10

I installed Julia v0.6.2 on Windows 10.
Every other package was installed without a problem, but Mongo.jl give me this error while building it.
Pkg.build("Mongo")
INFO: Building LibBSON
===============================[ ERROR: LibBSON ]===============================
LoadError: None of the selected providers can install dependency libbson.
Use BinDeps.debug(package_name) to see available providers
while loading C:\Users\"user"\.julia\v0.6\LibBSON\deps\build.jl, in expression starting on line 27
================================================================================
INFO: Building Mongo
================================[ ERROR: Mongo ]================================
LoadError: None of the selected providers can install dependency libmongoc.
Use BinDeps.debug(package_name) to see available providers
while loading C:\Users\"user"\.julia\v0.6\Mongo\deps\build.jl, in expression starting on line 26
================================================================================
================================[ BUILD ERRORS ]================================
WARNING: LibBSON and Mongo had build errors.
- packages with build errors remain installed in C:\Users\ciko9\.julia\v0.6
- build the package(s) and all dependencies with Pkg.build("LibBSON", "Mongo")
- build a single package by running its deps/build.jl script
================================================================================
I already opened an issue on github, but I'd like to fix it asap. Any idea on how to solve this problem?
The solution is first to install manually the mongo c drivers.
Second, to copy the mongo-c-drivers folder to the mongo e libbson folder inside julia, then make a new file deps.jl for each package and write this:
# Macro to load a library
macro checked_lib(libname, path)
((VERSION >= v"0.4.0-dev+3844" ? Base.Libdl.dlopen_e : Base.dlopen_e)(path) == C_NULL) && error("Unable to load \n\n$libname ($path)\n\nPlease re-run Pkg.build(package), and restart Julia.")
quote const $(esc(libname)) = $path end
end
# Load dependencies
#checked_lib libbson "C:\\Users\\"userName"\\.julia\\v0.6\\LibBSON\\mongo-c-driver\\bin\\libbson-1.0.dll"
# Load-hooks

GHC :: Linking agains sqlite3 fails on Windows

I created simple application, which uses sqlite3 as it's datastore back-end. I faced no problems when building and running it on Linux, but after I tried to build it on Windows, I see weird linking error:
Linking dist\build\hnotes\hnotes.exe ...
C:\Documents and Settings\Admin\Application Data\cabal\sqlite-0.5.2.2\ghc-7.0.4/libHSsqlite-0.5.2.2.
a(sqlite3-local.o):sqlite3-local.c:(.text+0x21): undefined reference to `sqlite3_temp_directory'
C:\Documents and Settings\Admin\Application Data\cabal\sqlite-0.5.2.2\ghc-7.0.4/libHSsqlite-0.5.2.2.
a(sqlite3-local.o):sqlite3-local.c:(.text+0x40): undefined reference to `sqlite3_temp_directory'
collect2: v ld 1
cabal.EXE: Error: some packages failed to install:
hnotes-0.1 failed during the building phase. The exception was:
ExitFailure 1
What may be wrong there? I suspect that qalite3.dll has to be added to linking stage, but have no idea how to do that. Adding --extra-lib-dirs=path-to-sqlite-dll doesn't help either (perhaps because I need to update my cabal file somehow, to support this?).
Not sure if It's a bug or not, but the error comes from the sqlite3.h include of the sqlite package.
A look in the file shows this
/*
** CAPI3REF: Name Of The Folder Holding Temporary Files {H10310} <S20000>
**
** If this global variable is made to point to a string which is
** the name of a folder (a.k.a. directory), then all temporary files
** created by SQLite will be placed in that directory. If this variable
** is a NULL pointer, then SQLite performs a search for an appropriate
** temporary file directory.
**
** It is not safe to modify this variable once a [database connection]
** has been opened. It is intended that this variable be set once
** as part of process initialization and before any SQLite interface
** routines have been call and remain unchanged thereafter.
*/
SQLITE_EXTERN char *sqlite3_temp_directory;
so it's declared as an extern. So simple test:
module Main where
import Database.SQLite
main
= do hwd <- openConnection "test"
closeConnection hwd
putStrLn "done"
This crashes during linking as expected with the error you have above.
So I created a small C test file foo.c
#include "sqlite-0.5.2.2\\include\\sqlite3-local.h"
char* sqlite3_temp_directory = "C:\\test2";
So I'm defining a temp_directory and then I pass the c file along during compilation of the haskell source
$ ghc test.hs foo.c
[1 of 1] Compiling Main ( test.hs, test.o )
Linking test.exe ...
and then running it also returns the expected result
$ ./test
done
So it seems that you just need to give a value for the sqlite3_temp_directory, which if you set it to a NULL pointer will use the TMP/TEMP etc variables as defined in the SQLLITE manual.
edit, follow up on why it worked on Linux but not on windows
In the sqlite package, there's a file sqlite3.c under the folder sqlite3.6. This provides a bunch of defaults for the sqlite package.
when on linux OS_UNIX is defined and when on linux it uses the defines under OS_WIN.
The function we're interested in is the function which sets the temporary directory. for unix this'll be unixGetTempname and for windows winGetTempname.
If you look at the implementation of both these functions, for the unix one it has list of directories that it'll try
static const char *azDirs[] = {
0,
"/var/tmp",
"/usr/tmp",
"/tmp",
".",
};
it tries to access them in order and the one it can write to it uses to generate a temporary folder in.
For windows however one of the first lines are:
if( sqlite3_temp_directory ){
sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", sqlite3_temp_directory);
}else if( isNT() ){
so for windows sqlite3_temp_directory is actually used. This is why it doesn't compile if It can't find it.

Resources