Haskell tool stack upgrade not working - haskell

I'm trying to upgrade stack on my MacBook from v1.2.0 to the latest v1.4.0. When I try stack upgrade it ends with the following error. How can I get this to work?
stack-1.4.0: build
Preprocessing library stack-1.4.0...
[ 1 of 124] Compiling Text.PrettyPrint.Leijen.Extended ( src/Text/PrettyPrint/Leijen/Extended.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/Text/PrettyPrint/Leijen/Extended.o )
[ 2 of 124] Compiling Hackage.Security.Client.Repository.HttpLib.HttpClient ( src/Hackage/Security/Client/Repository/HttpLib/HttpClient.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/Hackage/Security/Client/Repository/HttpLib/HttpClient.o )
[ 3 of 124] Compiling Stack.Options.ScriptParser ( src/Stack/Options/ScriptParser.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/Stack/Options/ScriptParser.o )
[ 4 of 124] Compiling Stack.Ghci.Script ( src/Stack/Ghci/Script.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/Stack/Ghci/Script.o )
[ 5 of 124] Compiling Stack.FileWatch ( src/Stack/FileWatch.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/Stack/FileWatch.o )
[ 6 of 124] Compiling System.Process.PagerEditor ( src/System/Process/PagerEditor.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/System/Process/PagerEditor.o )
[ 7 of 124] Compiling System.Process.Log ( src/System/Process/Log.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/System/Process/Log.o )
[ 8 of 124] Compiling Paths_stack ( .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen/Paths_stack.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/Paths_stack.o )
[ 9 of 124] Compiling Path.Find ( src/Path/Find.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/Path/Find.o )
[ 10 of 124] Compiling Path.Extra ( src/Path/Extra.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/Path/Extra.o )
[ 11 of 124] Compiling System.Process.Read ( src/System/Process/Read.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/System/Process/Read.o )
ghc: panic! (the 'impossible' happened)
(GHC version 7.10.3 for x86_64-apple-darwin):
Loading temp shared object failed: dlopen(/var/folders/x3/y7dgvx7j0lx1clp5vsrlt3p40000gn/T/ghc61111_0/libghc_68.dylib, 5): no suitable image found. Did find:
/var/folders/x3/y7dgvx7j0lx1clp5vsrlt3p40000gn/T/ghc61111_0/libghc_68.dylib: malformed mach-o: load commands size (49368) > 32768
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
Completed 26 action(s).
-- While building package stack-1.4.0 using:
/private/var/folders/x3/y7dgvx7j0lx1clp5vsrlt3p40000gn/T/stack-upgrade57904/stack-1.4.0/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/setup/setup --builddir=.stack-work/dist/x86_64-osx/Cabal-1.22.5.0 build lib:stack exe:stack --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
Update: #Sibi suggested I try stack upgrade --binary-only:
$ stack upgrade --binary-only
Invalid option `--binary-only'
Usage: stack upgrade [--git] [--git-repo ARG] [--help]
Upgrade to the latest stack (experimental)

Related

Threepenny GUI build fail

So I've been trying to install Threepenny GUI for a Haskell college assignment the last few hours without any avail. When stack attemps to build the 'snap-core' dependency, I get the following error:
snap-core > configure
snap-core > Configuring snap-core-1.0.5.0...
snap-core > build
snap-core > Preprocessing library for snap-core-1.0.5.0..
snap-core > Building library for snap-core-1.0.5.0..
snap-core > [ 1 of 18] Compiling Snap.Internal.Debug
snap-core > [ 2 of 18] Compiling Snap.Types.Headers
snap-core > [ 3 of 18] Compiling Snap.Internal.Http.Types
snap-core >
snap-core > src\Snap\Internal\Http\Types.hs:1285:11: error:
snap-core > * Variable not in scope:
snap-core > parseTime :: TimeLocale -> t0 -> String -> Maybe UTCTime
snap-core > * Perhaps you meant `parseTimeM' (imported from Data.Time.Format)
snap-core > |
snap-core > 1285 | prs = parseTime defaultTimeLocale "%a, %d %b %Y %H:%M:%S GMT"
snap-core > | ^^^^^^^^^
Progress 1/4
-- While building package snap-core-1.0.5.0 (scroll up to its section to see the error) using:
C:\Users\User\AppData\Roaming\stack\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_3.6.3.0_ghc-9.2.5.exe --verbose=1 --builddir=.stack-work\dist\8a54c84f build --ghc-options " -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
I have tried building the dependencies of snap-core with 'stack build --dependencies-only snap-core' with no avail. I've also tried to build the 'time' package on it's own with no avail either. My stack version is up to date also. Any ideas..?

atom won't work with .cabal file

I have been learning haskell using the atom editor on Windows 7. This has worked fine until I created a .cabal file. Now I continuously get red error messages.In fact it is so bad to be unusable as the error messages keep popping up faster than you can delete them. The haskell program is a trivial hello world.
module Main where
main :: IO ()
main = putStrLn "Hello from Haskell!"
The .cabal file is as follows:
-- Initial hello-haskell.cabal generated by cabal init. For further
-- documentation, see http://haskell.org/cabal/users-guide/
name: hello-haskell
version: 0.1.0.0
synopsis: Hello Haskell
description: Hello Haskell
license: BSD3
license-file: LICENSE
author: Tyrone Faulkner
maintainer: p75213#gmail.com
-- copyright:
category: None
build-type: Simple
extra-source-files: ChangeLog.md
cabal-version: >=1.10
executable hello-haskell
main-is: Main.hs
ghc-options: -Wall -fwarn-tabs
-- other-modules:
-- other-extensions:
build-depends: base >=4.8 && <4.9
hs-source-dirs: src
default-language: Haskell2010
The error message is as follows:
*[Enter steps to reproduce below:]
1. ...
2. ...
Atom Version: 1.8.0
System: Microsoft Windows 7 Professional
Thrown From: haskell-ghc-mod package, v1.17.2
Stack Trace
Haskell-ghc-mod: ghc-mod interactive command type failed with error ghc-modi crashed
At caps: {"version":[5,5,0,0],"fileMap":true,"quoteArgs":true,"optparse":true,"typeConstraints":false,"browseParents":false,"interactiveCaseSplit":false} URI: C:\Users\Tyrone\MyProjects\hello-haskell\src\Main.hs Args: --,1,1 message: log:
-2.884s: {}
-2.884s: "Trying to run ghc-modi in C:\\Users\\Tyrone\\MyProjects\\hello-haskell"
-2.884s: "Checking for ghc-modi in C:\\Users\\Tyrone\\MyProjects\\hello-haskell"
-2.884s: "Spawning new ghc-modi instance for C:\\Users\\Tyrone\\MyProjects\\hello-haskell with",{"cwd":"C:\\Users\\Tyrone\\MyProjects\\hello-haskell","env":{"ALLUSERSPROFILE":"C:\\ProgramData","APPDATA":"C:\\Users\\Tyrone\\AppData\\Roaming","ATOM_HOME":"C:\\Users\\Tyrone\\.atom","CommonProgramFiles":"C:\\Program Files\\Common Files","COMPUTERNAME":"TYRONE-PC","ComSpec":"C:\\Windows\\system32\\cmd.exe","FP_NO_HOST_CHECK":"NO","GHC":"c:\\users\\tyrone\\appdata\\local\\programs\\stack\\i386-windows\\ghc-7.10.3\\bin","GOOGLE_API_KEY":"AIzaSyAQfxPJiounkhOjODEO5ZieffeBv6yft2Q","HOMEDRIVE":"C:","HOMEPATH":"\\Users\\Tyrone","LOCALAPPDATA":"C:\\Users\\Tyrone\\AppData\\Local","LOGONSERVER":"\\\\TYRONE-PC","NUMBER_OF_PROCESSORS":"2","OS":"Windows_NT","Path":"C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Skype\\Phone\\;C:\\Program Files\\Support Tools\\;C:\\Program Files\\Git\\cmd;C:\\Users\\Tyrone\\AppData\\Roaming\\local\\bin;c:\\users\\tyrone\\appdata\\local\\atom\\bin;c:\\stack_root;c:\\users\\tyrone\\appdata\\local\\programs\\stack\\i386-windows\\ghc-7.10.3\\bin","PATHEXT":".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC","PROCESSOR_ARCHITECTURE":"x86","PROCESSOR_IDENTIFIER":"x86 Family 6 Model 15 Stepping 6, GenuineIntel","PROCESSOR_LEVEL":"6","PROCESSOR_REVISION":"0f06","ProgramData":"C:\\ProgramData","ProgramFiles":"C:\\Program Files","PSModulePath":"C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules\\","PUBLIC":"C:\\Users\\Public","ROOT_ATOM_DIRECTORY":"c:\\users\\tyrone\\appdata\\local\\atom\\bin","SESSIONNAME":"Console","skype":"C:\\Program Files\\Skype\\Phone\\","STACK_ROOT":"c:\\stack_root","SystemDrive":"C:","SystemRoot":"C:\\Windows","TEMP":"C:\\Users\\Tyrone\\AppData\\Local\\Temp","TMP":"C:\\Users\\Tyrone\\AppData\\Local\\Temp","USERDOMAIN":"Tyrone-PC","USERNAME":"Tyrone","USERPROFILE":"C:\\Users\\Tyrone","windir":"C:\\Windows","windows_tracing_flags":"3","windows_tracing_logfile":"C:\\BVTBin\\Tests\\installpackage\\csilogfile.log","NODE_PATH":"C:\\Users\\Tyrone\\AppData\\Local\\atom\\app-1.8.0\\resources\\app.asar\\exports","NODE_ENV":"production","PATH":"C:\\stack_root\\global-project\\.stack-work\\install\\6840de01\\bin;C:\\stack_root\\snapshots\\48375d44\\bin;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Skype\\Phone\\;C:\\Program Files\\Support Tools\\;C:\\Program Files\\Git\\cmd;C:\\Users\\Tyrone\\AppData\\Roaming\\local\\bin;c:\\users\\tyrone\\appdata\\local\\atom\\bin;c:\\stack_root;c:\\users\\tyrone\\appdata\\local\\programs\\stack\\i386-windows\\ghc-7.10.3\\bin"},"encoding":"utf-8","maxBuffer":null}
-2.884s: "Spawning new ghc-modi instance for C:\\Users\\Tyrone\\MyProjects\\hello-haskell with options = ",{"cwd":"C:\\Users\\Tyrone\\MyProjects\\hello-haskell","env":{"ALLUSERSPROFILE":"C:\\ProgramData","APPDATA":"C:\\Users\\Tyrone\\AppData\\Roaming","ATOM_HOME":"C:\\Users\\Tyrone\\.atom","CommonProgramFiles":"C:\\Program Files\\Common Files","COMPUTERNAME":"TYRONE-PC","ComSpec":"C:\\Windows\\system32\\cmd.exe","FP_NO_HOST_CHECK":"NO","GHC":"c:\\users\\tyrone\\appdata\\local\\programs\\stack\\i386-windows\\ghc-7.10.3\\bin","GOOGLE_API_KEY":"AIzaSyAQfxPJiounkhOjODEO5ZieffeBv6yft2Q","HOMEDRIVE":"C:","HOMEPATH":"\\Users\\Tyrone","LOCALAPPDATA":"C:\\Users\\Tyrone\\AppData\\Local","LOGONSERVER":"\\\\TYRONE-PC","NUMBER_OF_PROCESSORS":"2","OS":"Windows_NT","Path":"C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Skype\\Phone\\;C:\\Program Files\\Support Tools\\;C:\\Program Files\\Git\\cmd;C:\\Users\\Tyrone\\AppData\\Roaming\\local\\bin;c:\\users\\tyrone\\appdata\\local\\atom\\bin;c:\\stack_root;c:\\users\\tyrone\\appdata\\local\\programs\\stack\\i386-windows\\ghc-7.10.3\\bin","PATHEXT":".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC","PROCESSOR_ARCHITECTURE":"x86","PROCESSOR_IDENTIFIER":"x86 Family 6 Model 15 Stepping 6, GenuineIntel","PROCESSOR_LEVEL":"6","PROCESSOR_REVISION":"0f06","ProgramData":"C:\\ProgramData","ProgramFiles":"C:\\Program Files","PSModulePath":"C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules\\","PUBLIC":"C:\\Users\\Public","ROOT_ATOM_DIRECTORY":"c:\\users\\tyrone\\appdata\\local\\atom\\bin","SESSIONNAME":"Console","skype":"C:\\Program Files\\Skype\\Phone\\","STACK_ROOT":"c:\\stack_root","SystemDrive":"C:","SystemRoot":"C:\\Windows","TEMP":"C:\\Users\\Tyrone\\AppData\\Local\\Temp","TMP":"C:\\Users\\Tyrone\\AppData\\Local\\Temp","USERDOMAIN":"Tyrone-PC","USERNAME":"Tyrone","USERPROFILE":"C:\\Users\\Tyrone","windir":"C:\\Windows","windows_tracing_flags":"3","windows_tracing_logfile":"C:\\BVTBin\\Tests\\installpackage\\csilogfile.log","NODE_PATH":"C:\\Users\\Tyrone\\AppData\\Local\\atom\\app-1.8.0\\resources\\app.asar\\exports","NODE_ENV":"production","PATH":"C:\\stack_root\\global-project\\.stack-work\\install\\6840de01\\bin;C:\\stack_root\\snapshots\\48375d44\\bin;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Skype\\Phone\\;C:\\Program Files\\Support Tools\\;C:\\Program Files\\Git\\cmd;C:\\Users\\Tyrone\\AppData\\Roaming\\local\\bin;c:\\users\\tyrone\\appdata\\local\\atom\\bin;c:\\stack_root;c:\\users\\tyrone\\appdata\\local\\programs\\stack\\i386-windows\\ghc-7.10.3\\bin"},"encoding":"utf-8","maxBuffer":null}
-2.884s: "Started interactive action block in C:\\Users\\Tyrone\\MyProjects\\hello-haskell"
-2.884s: "Running ghc-modi command type","C:\\Users\\Tyrone\\MyProjects\\hello-haskell\\src\\Main.hs","--",1,1
-2.419s: "ghc-modi said: "
-2.419s: "ghc-modi said: on the commandline: Warning:"
-2.419s: "ghc-modi said: -package-conf=C:\\Users\\Tyrone\\AppData\\Roaming\\ghc-mod\\cabal-helper\\Cabal-1.24.0.0-db-7.10.3 is deprecated: Use -package-db instead"
-1.936s: "ghc-modi said: [1 of 5] Compiling CabalHelper.Types ( CabalHelper\\Types.hs, C:\\Users\\Tyrone\\AppData\\Roaming\\ghc-mod\\cabal-helper\\CabalHelper\\Types.o )"
-0.807s: "ghc-modi said: [2 of 5] Compiling CabalHelper.Common ( CabalHelper\\Common.hs, C:\\Users\\Tyrone\\AppData\\Roaming\\ghc-mod\\cabal-helper\\CabalHelper\\Common.o )"
-0.445s: "ghc-modi said: [3 of 5] Compiling CabalHelper.Sandbox ( CabalHelper\\Sandbox.hs, C:\\Users\\Tyrone\\AppData\\Roaming\\ghc-mod\\cabal-helper\\CabalHelper\\Sandbox.o )"
-0.228s: "ghc-modi said: [4 of 5] Compiling CabalHelper.Licenses ( CabalHelper\\Licenses.hs, C:\\Users\\Tyrone\\AppData\\Roaming\\ghc-mod\\cabal-helper\\CabalHelper\\Licenses.o )"
-0.071s: "ghc-modi said: "
-0.071s: "ghc-modi said: CabalHelper\\Licenses.hs:38:28:"
-0.071s: "ghc-modi said: Not in scope: `lookupComponentId'"
-0.07s: "ghc-modi said: Perhaps you meant one of these:"
-0.07s: "ghc-modi said: `lookupComponent' (imported from Distribution.Simple.LocalBuildInfo),"
-0.07s: "ghc-modi said: `localComponentId' (imported from Distribution.Simple.LocalBuildInfo)"
-0.07s: "ghc-modi said: "
-0.07s: "ghc-modi said: CabalHelper\\Licenses.hs:53:18:"
-0.07s: "ghc-modi said: Ambiguous occurrence `lookupInstalledPackageId'"
-0.07s: "ghc-modi said: It could refer to either `CabalHelper.Licenses.lookupInstalledPackageId',"
-0.07s: "ghc-modi said: defined at CabalHelper\\Licenses.hs:38:1"
-0.07s: "ghc-modi said: or `Distribution.Simple.PackageIndex.lookupInstalledPackageId',"
-0.07s: "ghc-modi said: imported from `Distribution.Simple.PackageIndex' at CabalHelper\\Licenses.hs:24:1-39"
-0.07s: "ghc-modi said: "
-0.07s: "ghc-modi said: CabalHelper\\Licenses.hs:74:10:"
-0.07s: "ghc-modi said: Ambiguous occurrence `lookupInstalledPackageId'"
-0.07s: "ghc-modi said: It could refer to either `CabalHelper.Licenses.lookupInstalledPackageId',"
-0.07s: "ghc-modi said: defined at CabalHelper\\Licenses.hs:38:1"
-0.07s: "ghc-modi said: or `Distribution.Simple.PackageIndex.lookupInstalledPackageId',"
-0.07s: "ghc-modi said: imported from `Distribution.Simple.PackageIndex' at CabalHelper\\Licenses.hs:24:1-39"
-0.012s: "ghc-modi said: ghc-mod: readCreateProcess: C:\\stack_root\\snapshots\\48375d44\\libexec\\cabal-helper-wrapper.exe \"--with-ghc=ghc\" \"--with-ghc-pkg=ghc-pkg\" \"--with-cabal=cabal\" \"C:\\\\Users\\\\Tyrone\\\\MyProjects\\\\hello-haskell\" \"C:\\\\Users\\\\Tyrone\\\\MyProjects\\\\hello-haskell\\\\dist\" \"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"
-0.001s: "ghc-modi for C:\\Users\\Tyrone\\MyProjects\\hello-haskell ended with 1"
-0.001s: "ghc-modi for C:\\Users\\Tyrone\\MyProjects\\hello-haskell ended with 1"
-0.001s: "Running ghc-modi command unmap-file","C:\\Users\\Tyrone\\MyProjects\\hello-haskell\\src\\Main.hs" 0s: {"name":"ghc-modi crashed"}
ghc-modi crashed
at module.exports.Util.mkError (file:///C:/Users/Tyrone/.atom/packages/haskell-ghc-mod/lib/util.coffee:225:15)
at ChildProcess.exitCallback (file:///C:/Users/Tyrone/.atom/packages/haskell-ghc-mod/lib/ghc-mod/interactive-process.coffee:77:20)
at emitTwo (events.js:92:20)
at ChildProcess.emit (events.js:172:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
Commands
-2:22.4.0 core:copy (atom-text-editor.editor.is-focused)
Config
json { "core": {
"automaticallyUpdate": false,
"themes": [
"atom-light-ui",
"atom-light-syntax"
] } }
Installed Packages
```coffee
User autocomplete-haskell, v0.6.6 haskell-ghc-mod, v1.17.2 ide-haskell, v1.8.1 ide-haskell-cabal, v1.6.4 ide-haskell-repl, v0.1.0 language-haskell, v1.9.7
Dev No dev packages ```*
a quick guess, without a computer to confirm this. did run into a similar situation and delete the build folder . this happend when I run yesod devel inside the project, and afterward did open the project folder in atom editor, usin ghc-mod on Windows 10. I'll update this answer when I'm back at a computer and learn how to format responses here on stackoverflow. don't delete the build folder if you want to use it later, I assume there is some configuration in the atom addon or in a configuration file for ghc-mod or maybe wrap the ghc-mod configuration to use spesific version of library.
I upgraded to ghc-mod-5.6.0.0. I also have ghc-mod installed in 3 places. As my PATH points to all 3 I have temporarily renamed those old exe files and only using the latest 5.6.0.0.

Cabal: Cryptonite failed to install

I tried to install Yesod with Cabal. Yesod depends on Cryptonite to work, however it failed to install. Here is the error message:
the-inquiry#the-inquiry-pc:~/workspace$ cabal install cryptonite
Resolving dependencies...
Configuring cryptonite-0.11...
Building cryptonite-0.11...
Failed to install cryptonite-0.11
Build log ( /home/the-inquiry/.cabal/logs/cryptonite-0.11.log ):
Configuring cryptonite-0.11...
Building cryptonite-0.11...
Preprocessing library cryptonite-0.11...
[ 1 of 101] Compiling Crypto.Internal.CompatPrim ( Crypto/Internal/CompatPrim.hs, dist/build/Crypto/Internal/CompatPrim.o )
[ 2 of 101] Compiling Crypto.Random.Entropy.Source ( Crypto/Random/Entropy/Source.hs, dist/build/Crypto/Random/Entropy/Source.o )
[ 3 of 101] Compiling Crypto.Random.Entropy.Unix ( Crypto/Random/Entropy/Unix.hs, dist/build/Crypto/Random/Entropy/Unix.o )
[ 4 of 101] Compiling Crypto.Internal.Words ( Crypto/Internal/Words.hs, dist/build/Crypto/Internal/Words.o )
[ 5 of 101] Compiling Crypto.Random.Entropy.Backend ( Crypto/Random/Entropy/Backend.hs, dist/build/Crypto/Random/Entropy/Backend.o )
[ 6 of 101] Compiling Crypto.Random.Entropy.Unsafe ( Crypto/Random/Entropy/Unsafe.hs, dist/build/Crypto/Random/Entropy/Unsafe.o )
[ 7 of 101] Compiling Crypto.PubKey.Internal ( Crypto/PubKey/Internal.hs, dist/build/Crypto/PubKey/Internal.o )
[ 8 of 101] Compiling Crypto.Number.Compat ( Crypto/Number/Compat.hs, dist/build/Crypto/Number/Compat.o )
[ 9 of 101] Compiling Crypto.Number.Basic ( Crypto/Number/Basic.hs, dist/build/Crypto/Number/Basic.o )
[ 10 of 101] Compiling Crypto.Number.ModArithmetic ( Crypto/Number/ModArithmetic.hs, dist/build/Crypto/Number/ModArithmetic.o )
[ 11 of 101] Compiling Crypto.Number.Serialize.Internal ( Crypto/Number/Serialize/Internal.hs, dist/build/Crypto/Number/Serialize/Internal.o )
[ 12 of 101] Compiling Crypto.Internal.DeepSeq ( Crypto/Internal/DeepSeq.hs, dist/build/Crypto/Internal/DeepSeq.o )
[ 13 of 101] Compiling Crypto.Data.Padding ( Crypto/Data/Padding.hs, dist/build/Crypto/Data/Padding.o )
[ 14 of 101] Compiling Crypto.Cipher.DES.Primitive ( Crypto/Cipher/DES/Primitive.hs, dist/build/Crypto/Cipher/DES/Primitive.o )
[ 15 of 101] Compiling Crypto.Internal.Compat ( Crypto/Internal/Compat.hs, dist/build/Crypto/Internal/Compat.o )
[ 16 of 101] Compiling Crypto.Internal.WordArray ( Crypto/Internal/WordArray.hs, dist/build/Crypto/Internal/WordArray.o )
[ 17 of 101] Compiling Crypto.Cipher.Blowfish.Box ( Crypto/Cipher/Blowfish/Box.hs, dist/build/Crypto/Cipher/Blowfish/Box.o )
[ 18 of 101] Compiling Crypto.Internal.ByteArray ( Crypto/Internal/ByteArray.hs, dist/build/Crypto/Internal/ByteArray.o )
[ 19 of 101] Compiling Crypto.Number.Serialize ( Crypto/Number/Serialize.hs, dist/build/Crypto/Number/Serialize.o )
[ 20 of 101] Compiling Crypto.Random.Entropy ( Crypto/Random/Entropy.hs, dist/build/Crypto/Random/Entropy.o )
[ 21 of 101] Compiling Crypto.Random.EntropyPool ( Crypto/Random/EntropyPool.hs, dist/build/Crypto/Random/EntropyPool.o )
[ 22 of 101] Compiling Crypto.Cipher.Types.Utils ( Crypto/Cipher/Types/Utils.hs, dist/build/Crypto/Cipher/Types/Utils.o )
[ 23 of 101] Compiling Crypto.Internal.Imports ( Crypto/Internal/Imports.hs, dist/build/Crypto/Internal/Imports.o )
[ 24 of 101] Compiling Crypto.Cipher.ChaCha ( Crypto/Cipher/ChaCha.hs, dist/build/Crypto/Cipher/ChaCha.o )
[ 25 of 101] Compiling Crypto.Cipher.RC4 ( Crypto/Cipher/RC4.hs, dist/build/Crypto/Cipher/RC4.o )
[ 26 of 101] Compiling Crypto.Cipher.Salsa ( Crypto/Cipher/Salsa.hs, dist/build/Crypto/Cipher/Salsa.o )
[ 27 of 101] Compiling Crypto.Random.Types ( Crypto/Random/Types.hs, dist/build/Crypto/Random/Types.o )
[ 28 of 101] Compiling Crypto.Error.Types ( Crypto/Error/Types.hs, dist/build/Crypto/Error/Types.o )
[ 29 of 101] Compiling Crypto.Number.F2m ( Crypto/Number/F2m.hs, dist/build/Crypto/Number/F2m.o )
[ 30 of 101] Compiling Crypto.Number.Generate ( Crypto/Number/Generate.hs, dist/build/Crypto/Number/Generate.o )
[ 31 of 101] Compiling Crypto.Hash.Types ( Crypto/Hash/Types.hs, dist/build/Crypto/Hash/Types.o )
[ 32 of 101] Compiling Crypto.Hash.IO ( Crypto/Hash/IO.hs, dist/build/Crypto/Hash/IO.o )
[ 33 of 101] Compiling Crypto.Hash.Blake2s ( Crypto/Hash/Blake2s.hs, dist/build/Crypto/Hash/Blake2s.o )
[ 34 of 101] Compiling Crypto.Hash.Blake2sp ( Crypto/Hash/Blake2sp.hs, dist/build/Crypto/Hash/Blake2sp.o )
[ 35 of 101] Compiling Crypto.Hash.Blake2b ( Crypto/Hash/Blake2b.hs, dist/build/Crypto/Hash/Blake2b.o )
[ 36 of 101] Compiling Crypto.Hash.Blake2bp ( Crypto/Hash/Blake2bp.hs, dist/build/Crypto/Hash/Blake2bp.o )
[ 37 of 101] Compiling Crypto.Hash.MD2 ( Crypto/Hash/MD2.hs, dist/build/Crypto/Hash/MD2.o )
[ 38 of 101] Compiling Crypto.Hash.MD4 ( Crypto/Hash/MD4.hs, dist/build/Crypto/Hash/MD4.o )
[ 39 of 101] Compiling Crypto.Hash.MD5 ( Crypto/Hash/MD5.hs, dist/build/Crypto/Hash/MD5.o )
[ 40 of 101] Compiling Crypto.Hash.SHA1 ( Crypto/Hash/SHA1.hs, dist/build/Crypto/Hash/SHA1.o )
[ 41 of 101] Compiling Crypto.Hash.SHA224 ( Crypto/Hash/SHA224.hs, dist/build/Crypto/Hash/SHA224.o )
[ 42 of 101] Compiling Crypto.Hash.SHA256 ( Crypto/Hash/SHA256.hs, dist/build/Crypto/Hash/SHA256.o )
[ 43 of 101] Compiling Crypto.Hash.SHA384 ( Crypto/Hash/SHA384.hs, dist/build/Crypto/Hash/SHA384.o )
[ 44 of 101] Compiling Crypto.Hash.SHA512 ( Crypto/Hash/SHA512.hs, dist/build/Crypto/Hash/SHA512.o )
[ 45 of 101] Compiling Crypto.Hash.SHA512t ( Crypto/Hash/SHA512t.hs, dist/build/Crypto/Hash/SHA512t.o )
[ 46 of 101] Compiling Crypto.Hash.SHA3 ( Crypto/Hash/SHA3.hs, dist/build/Crypto/Hash/SHA3.o )
[ 47 of 101] Compiling Crypto.Hash.Keccak ( Crypto/Hash/Keccak.hs, dist/build/Crypto/Hash/Keccak.o )
[ 48 of 101] Compiling Crypto.Hash.RIPEMD160 ( Crypto/Hash/RIPEMD160.hs, dist/build/Crypto/Hash/RIPEMD160.o )
[ 49 of 101] Compiling Crypto.Hash.Tiger ( Crypto/Hash/Tiger.hs, dist/build/Crypto/Hash/Tiger.o )
[ 50 of 101] Compiling Crypto.Hash.Skein256 ( Crypto/Hash/Skein256.hs, dist/build/Crypto/Hash/Skein256.o )
[ 51 of 101] Compiling Crypto.Hash.Skein512 ( Crypto/Hash/Skein512.hs, dist/build/Crypto/Hash/Skein512.o )
[ 52 of 101] Compiling Crypto.Hash.Whirlpool ( Crypto/Hash/Whirlpool.hs, dist/build/Crypto/Hash/Whirlpool.o )
[ 53 of 101] Compiling Crypto.Hash.Algorithms ( Crypto/Hash/Algorithms.hs, dist/build/Crypto/Hash/Algorithms.o )
[ 54 of 101] Compiling Crypto.Hash ( Crypto/Hash.hs, dist/build/Crypto/Hash.o )
[ 55 of 101] Compiling Crypto.Data.AFIS ( Crypto/Data/AFIS.hs, dist/build/Crypto/Data/AFIS.o )
[ 56 of 101] Compiling Crypto.MAC.HMAC ( Crypto/MAC/HMAC.hs, dist/build/Crypto/MAC/HMAC.o )
[ 57 of 101] Compiling Crypto.KDF.PBKDF2 ( Crypto/KDF/PBKDF2.hs, dist/build/Crypto/KDF/PBKDF2.o )
[ 58 of 101] Compiling Crypto.KDF.Scrypt ( Crypto/KDF/Scrypt.hs, dist/build/Crypto/KDF/Scrypt.o )
[ 59 of 101] Compiling Crypto.KDF.HKDF ( Crypto/KDF/HKDF.hs, dist/build/Crypto/KDF/HKDF.o )
[ 60 of 101] Compiling Crypto.PubKey.MaskGenFunction ( Crypto/PubKey/MaskGenFunction.hs, dist/build/Crypto/PubKey/MaskGenFunction.o )
[ 61 of 101] Compiling Crypto.PubKey.DSA ( Crypto/PubKey/DSA.hs, dist/build/Crypto/PubKey/DSA.o )
[ 62 of 101] Compiling Crypto.PubKey.ECC.Types ( Crypto/PubKey/ECC/Types.hs, dist/build/Crypto/PubKey/ECC/Types.o )
[ 63 of 101] Compiling Crypto.PubKey.RSA.Types ( Crypto/PubKey/RSA/Types.hs, dist/build/Crypto/PubKey/RSA/Types.o )
[ 64 of 101] Compiling Crypto.PubKey.RSA.Prim ( Crypto/PubKey/RSA/Prim.hs, dist/build/Crypto/PubKey/RSA/Prim.o )
[ 65 of 101] Compiling Crypto.Random.ChaChaDRG ( Crypto/Random/ChaChaDRG.hs, dist/build/Crypto/Random/ChaChaDRG.o )
[ 66 of 101] Compiling Crypto.Random.SystemDRG ( Crypto/Random/SystemDRG.hs, dist/build/Crypto/Random/SystemDRG.o )
[ 67 of 101] Compiling Crypto.Random ( Crypto/Random.hs, dist/build/Crypto/Random.o )
[ 68 of 101] Compiling Crypto.Random.Probabilistic ( Crypto/Random/Probabilistic.hs, dist/build/Crypto/Random/Probabilistic.o )
[ 69 of 101] Compiling Crypto.Number.Prime ( Crypto/Number/Prime.hs, dist/build/Crypto/Number/Prime.o )
[ 70 of 101] Compiling Crypto.PubKey.DH ( Crypto/PubKey/DH.hs, dist/build/Crypto/PubKey/DH.o )
[ 71 of 101] Compiling Crypto.PubKey.RSA ( Crypto/PubKey/RSA.hs, dist/build/Crypto/PubKey/RSA.o )
[ 72 of 101] Compiling Crypto.PubKey.RSA.PKCS15 ( Crypto/PubKey/RSA/PKCS15.hs, dist/build/Crypto/PubKey/RSA/PKCS15.o )
[ 73 of 101] Compiling Crypto.PubKey.RSA.PSS ( Crypto/PubKey/RSA/PSS.hs, dist/build/Crypto/PubKey/RSA/PSS.o )
[ 74 of 101] Compiling Crypto.PubKey.RSA.OAEP ( Crypto/PubKey/RSA/OAEP.hs, dist/build/Crypto/PubKey/RSA/OAEP.o )
[ 75 of 101] Compiling Crypto.PubKey.ECC.Prim ( Crypto/PubKey/ECC/Prim.hs, dist/build/Crypto/PubKey/ECC/Prim.o )
[ 76 of 101] Compiling Crypto.PubKey.ECC.ECDSA ( Crypto/PubKey/ECC/ECDSA.hs, dist/build/Crypto/PubKey/ECC/ECDSA.o )
[ 77 of 101] Compiling Crypto.PubKey.ECC.Generate ( Crypto/PubKey/ECC/Generate.hs, dist/build/Crypto/PubKey/ECC/Generate.o )
[ 78 of 101] Compiling Crypto.PubKey.ECC.DH ( Crypto/PubKey/ECC/DH.hs, dist/build/Crypto/PubKey/ECC/DH.o )
[ 79 of 101] Compiling Crypto.Cipher.Types.GF ( Crypto/Cipher/Types/GF.hs, dist/build/Crypto/Cipher/Types/GF.o )
[ 80 of 101] Compiling Crypto.PubKey.ElGamal ( Crypto/PubKey/ElGamal.hs, dist/build/Crypto/PubKey/ElGamal.o )
[ 81 of 101] Compiling Crypto.Error ( Crypto/Error.hs, dist/build/Crypto/Error.o )
[ 82 of 101] Compiling Crypto.Cipher.Blowfish.Primitive ( Crypto/Cipher/Blowfish/Primitive.hs, dist/build/Crypto/Cipher/Blowfish/Primitive.o )
[ 83 of 101] Compiling Crypto.KDF.BCrypt ( Crypto/KDF/BCrypt.hs, dist/build/Crypto/KDF/BCrypt.o )
[ 84 of 101] Compiling Crypto.Cipher.Camellia.Primitive ( Crypto/Cipher/Camellia/Primitive.hs, dist/build/Crypto/Cipher/Camellia/Primitive.o )
[ 85 of 101] Compiling Crypto.MAC.Poly1305 ( Crypto/MAC/Poly1305.hs, dist/build/Crypto/MAC/Poly1305.o )
[ 86 of 101] Compiling Crypto.Cipher.ChaChaPoly1305 ( Crypto/Cipher/ChaChaPoly1305.hs, dist/build/Crypto/Cipher/ChaChaPoly1305.o )
[ 87 of 101] Compiling Crypto.Cipher.Types.Base ( Crypto/Cipher/Types/Base.hs, dist/build/Crypto/Cipher/Types/Base.o )
[ 88 of 101] Compiling Crypto.Cipher.Types.AEAD ( Crypto/Cipher/Types/AEAD.hs, dist/build/Crypto/Cipher/Types/AEAD.o )
[ 89 of 101] Compiling Crypto.Cipher.Types.Block ( Crypto/Cipher/Types/Block.hs, dist/build/Crypto/Cipher/Types/Block.o )
[ 90 of 101] Compiling Crypto.Cipher.Types.Stream ( Crypto/Cipher/Types/Stream.hs, dist/build/Crypto/Cipher/Types/Stream.o )
[ 91 of 101] Compiling Crypto.Cipher.Types ( Crypto/Cipher/Types.hs, dist/build/Crypto/Cipher/Types.o )
[ 92 of 101] Compiling Crypto.Cipher.AES.Primitive ( Crypto/Cipher/AES/Primitive.hs, dist/build/Crypto/Cipher/AES/Primitive.o )
[ 93 of 101] Compiling Crypto.Cipher.Blowfish ( Crypto/Cipher/Blowfish.hs, dist/build/Crypto/Cipher/Blowfish.o )
[ 94 of 101] Compiling Crypto.Cipher.Camellia ( Crypto/Cipher/Camellia.hs, dist/build/Crypto/Cipher/Camellia.o )
[ 95 of 101] Compiling Crypto.Cipher.DES ( Crypto/Cipher/DES.hs, dist/build/Crypto/Cipher/DES.o )
[ 96 of 101] Compiling Crypto.Cipher.TripleDES ( Crypto/Cipher/TripleDES.hs, dist/build/Crypto/Cipher/TripleDES.o )
[ 97 of 101] Compiling Crypto.PubKey.Curve25519 ( Crypto/PubKey/Curve25519.hs, dist/build/Crypto/PubKey/Curve25519.o )
[ 98 of 101] Compiling Crypto.PubKey.ECC.P256 ( Crypto/PubKey/ECC/P256.hs, dist/build/Crypto/PubKey/ECC/P256.o )
[ 99 of 101] Compiling Crypto.PubKey.Ed25519 ( Crypto/PubKey/Ed25519.hs, dist/build/Crypto/PubKey/Ed25519.o )
[100 of 101] Compiling Crypto.PubKey.Ed448 ( Crypto/PubKey/Ed448.hs, dist/build/Crypto/PubKey/Ed448.o )
[101 of 101] Compiling Crypto.Cipher.AES ( Crypto/Cipher/AES.hs, dist/build/Crypto/Cipher/AES.o )
cbits/ed448/x448.c:21:9:
error: unknown type name ‘__uint128_t’
typedef __uint128_t decaf_dword_t;
^
cbits/ed448/x448.c:22:9:
error: unknown type name ‘__int128_t’
typedef __int128_t decaf_sdword_t;
^
cbits/ed448/x448.c: In function ‘gf_mul’:
cbits/ed448/x448.c:83:48:
warning: right shift count >= width of type [-Wshift-count-overflow]
accum[X448_LIMBS-1] += accum[X448_LIMBS-2] >> LBITS;
^
cbits/ed448/x448.c:85:48:
warning: right shift count >= width of type [-Wshift-count-overflow]
accum[X448_LIMBS/2] += accum[X448_LIMBS-1] >> LBITS;
^
cbits/ed448/x448.c:87:45:
warning: right shift count >= width of type [-Wshift-count-overflow]
accum[j] += accum[(j-1)%X448_LIMBS] >> LBITS;
^
cbits/ed448/x448.c:50:8:
note: in definition of macro ‘FOR_LIMB_U’
op;i++; op;i++; op;i++; op;i++; op;i++; op;i++; op;i++; op;i++; \
^
cbits/ed448/x448.c:87:45:
warning: right shift count >= width of type [-Wshift-count-overflow]
accum[j] += accum[(j-1)%X448_LIMBS] >> LBITS;
^
cbits/ed448/x448.c:50:16:
note: in definition of macro ‘FOR_LIMB_U’
op;i++; op;i++; op;i++; op;i++; op;i++; op;i++; op;i++; op;i++; \
^
cbits/ed448/x448.c:87:45:
warning: right shift count >= width of type [-Wshift-count-overflow]
accum[j] += accum[(j-1)%X448_LIMBS] >> LBITS;
^
cbits/ed448/x448.c:50:24:
note: in definition of macro ‘FOR_LIMB_U’
op;i++; op;i++; op;i++; op;i++; op;i++; op;i++; op;i++; op;i++; \
^
cbits/ed448/x448.c:87:45:
warning: right shift count >= width of type [-Wshift-count-overflow]
accum[j] += accum[(j-1)%X448_LIMBS] >> LBITS;
^
cbits/ed448/x448.c:50:32:
note: in definition of macro ‘FOR_LIMB_U’
op;i++; op;i++; op;i++; op;i++; op;i++; op;i++; op;i++; op;i++; \
^
cbits/ed448/x448.c:87:45:
warning: right shift count >= width of type [-Wshift-count-overflow]
accum[j] += accum[(j-1)%X448_LIMBS] >> LBITS;
^
cbits/ed448/x448.c:50:40:
note: in definition of macro ‘FOR_LIMB_U’
op;i++; op;i++; op;i++; op;i++; op;i++; op;i++; op;i++; op;i++; \
^
cbits/ed448/x448.c:87:45:
warning: right shift count >= width of type [-Wshift-count-overflow]
accum[j] += accum[(j-1)%X448_LIMBS] >> LBITS;
^
cbits/ed448/x448.c:50:48:
note: in definition of macro ‘FOR_LIMB_U’
op;i++; op;i++; op;i++; op;i++; op;i++; op;i++; op;i++; op;i++; \
^
cbits/ed448/x448.c:87:45:
warning: right shift count >= width of type [-Wshift-count-overflow]
accum[j] += accum[(j-1)%X448_LIMBS] >> LBITS;
^
cbits/ed448/x448.c:50:56:
note: in definition of macro ‘FOR_LIMB_U’
op;i++; op;i++; op;i++; op;i++; op;i++; op;i++; op;i++; op;i++; \
^
cbits/ed448/x448.c:87:45:
warning: right shift count >= width of type [-Wshift-count-overflow]
accum[j] += accum[(j-1)%X448_LIMBS] >> LBITS;
^
cbits/ed448/x448.c:50:64:
note: in definition of macro ‘FOR_LIMB_U’
op;i++; op;i++; op;i++; op;i++; op;i++; op;i++; op;i++; op;i++; \
^
cbits/ed448/x448.c: In function ‘gf_canon’:
cbits/ed448/x448.c:186:15:
warning: right shift count >= width of type [-Wshift-count-overflow]
carry >>= LBITS;
^
cbits/ed448/x448.c:64:76:
note: in definition of macro ‘FOR_LIMB’
#define FOR_LIMB(i,op) { unsigned int i=0; for (i=0; i<X448_LIMBS; i++) { op; }}
^
cbits/ed448/x448.c:196:15:
warning: right shift count >= width of type [-Wshift-count-overflow]
carry >>= LBITS;
^
cbits/ed448/x448.c:64:76:
note: in definition of macro ‘FOR_LIMB’
#define FOR_LIMB(i,op) { unsigned int i=0; for (i=0; i<X448_LIMBS; i++) { op; }}
^
cbits/ed448/x448.c: In function ‘gf_deser’:
cbits/ed448/x448.c:207:91:
warning: right shift count >= width of type [-Wshift-count-overflow]
for (bits += 8; (bits>=LBITS || i==X448_BYTES-1) && k<X448_LIMBS; bits-=LBITS, buf>>=LBITS) {
^
cbits/ed448/x448.c:213:59:
warning: right shift count >= width of type [-Wshift-count-overflow]
FOR_LIMB(i, accum = (accum + s->limb[i] - P->limb[i]) >> WBITS );
^
cbits/ed448/x448.c:64:76:
note: in definition of macro ‘FOR_LIMB’
#define FOR_LIMB(i,op) { unsigned int i=0; for (i=0; i<X448_LIMBS; i++) { op; }}
^
cabal: Error: some packages failed to install:
cryptonite-0.11 failed during the building phase. The exception was:
ExitFailure 1
I've already tried the following solution but it gave the same error message:
cabal dependency resolution fail for 'lens'
My OS is Ubuntu 15.10
Thank you
The relevant part seems to be the next:
cbits/ed448/x448.c:21:9:
error: unknown type name ‘__uint128_t’
typedef __uint128_t decaf_dword_t;
^
AFAIK __uint128_t is a gcc extension, so it is probably not available with your compiler. Try to contact package maintainer.
ADD: Are you using i686 architecture? Looks like the issue is already reported.

Doubts in running an Rcpp example

I'm trying to reproduce the examples of "Seamless R and C++ Integration with Rcpp" book, but some codes are not running. Specifically, it is on chapter 5, Section 5.2.3 and the code follows above:
#ifndef _mypackage_RCPP_HELLO_WORLD_H
#define _mypackage_RCPP_HELLO_WORLD_H
#include <Rcpp.h>
/*
* note : RcppExport is an alias to 'extern "C"' defined by Rcpp.
*
* It gives C calling convention to the rcpp_hello_world
* function so that it can be called from .Call in R.
* Otherwise, the C++ compiler mangles the
* name of the functioand .Call can’t find it.
* It is only useful to use RcppExport when the function
* is intended to be called by .Call. See the thread
* http://thread.gmane.org/gmane.comp.lang.r.rcpp/649/focus=672
* on Rcpp-devel for a misuse of RcppExport 19
*/
RcppExport SEXP rcpp_hello_world();
#endif
and the next is
#include "rcpp_hello_world.h"
SEXP rcpp_hello_world() {
using namespace Rcpp;
CharacterVector x = CharacterVector::create( "foo", "bar" ) ;
NumericVector y = NumericVector::create( 0.0, 1.0 ) ;
List z = List::create( x, y ) ;
return z ;
}
The error showed by R is
Error in .Call("rcpp_hello_world", PACKAGE = "mypackage") :
"rcpp_hello_world" not available for .Call() for package "mypackage"
Have anyone faced a problem like this?
Thanks in advance!
When I try to tip
R CMD check mypackage_1.0.tar.gz
I got an error like this
* using log directory ‘/Users/Marcos/Downloads/mypackage.Rcheck’
* using R version 3.0.2 (2013-09-25)
* using platform: x86_64-apple-darwin10.8.0 (64-bit)
* using session charset: UTF-8
* checking for file ‘mypackage/DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘mypackage’ version ‘1.0’
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘mypackage’ can be installed ... ERROR
Installation failed.
See ‘/Users/Marcos/Downloads/mypackage.Rcheck/00install.out’ for details.
In the file 00install.out, the first error is
* installing *source* package ‘mypackage’ ...
** libs
llvm-g++-4.2 -arch x86_64 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/include" -fPIC -mtune=core2 -g -O2 -c RcppExports.cpp -o RcppExports.o
In file included from /Library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/include/RcppCommon.h:28,
from /Library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/include/Rcpp.h:27,
from RcppExports.cpp:4:
/Library/Frameworks/R.framework/Versions/3.0/Resources/library/Rcpp/include/Rcpp/platform/compiler.h:93:17: error: cmath: No such file or directory
And then, I just got error messages.
Go to the terminal:
R CMD build mypackage
R CMD check mypackage_1.0.tar.gz
R CMD install mypackage
and in R:
library(mypackage)
rcpp_hello_world()
[[1]]
[1] "foo" "bar"
[[2]]
[1] 0 1
Now, I don't understand where to use the code written in "Listing 5.4", Do I need to write it or this is created automatically?
This example (and chapter) discusses how to build (and load) an entire package, here called mypackage.
Did you actually create, compile and load mypackage?
This works, as we do this each and every time the unit tests run.
Edit: Here is a full log for you
R> library(Rcpp)
R> Rcpp.package.skeleton("mypackage") ## page 66, Section 5.2.1
Creating directories ...
Creating DESCRIPTION ...
Creating NAMESPACE ...
Creating Read-and-delete-me ...
Saving functions and data ...
Making help files ...
Done.
Further steps are described in './mypackage/Read-and-delete-me'.
Adding Rcpp settings
>> added Depends: Rcpp
>> added LinkingTo: Rcpp
>> added useDynLib directive to NAMESPACE
>> added Makevars file with Rcpp settings
>> added Makevars.win file with Rcpp settings
>> added example src file using Rcpp attributes
>> compiled Rcpp attributes
>> added Rd file for rcpp_hello_world
R>
We can now build the tarball:
R> system("R CMD build mypackage")
* checking for file 'mypackage/DESCRIPTION' ... OK
* preparing 'mypackage':
* checking DESCRIPTION meta-information ... OK
* cleaning src
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* building 'mypackage_1.0.tar.gz'
R>
then we can install it: (and I am doing that on a Windows machine for a change)
R> system("R CMD INSTALL mypackage_1.0.tar.gz")
* installing to library 'c:/opt/R-library'
* installing *source* package 'mypackage' ...
** libs
*** arch - i386
g++ -m32 -I"c:/opt/R-CURR~1/include" -DNDEBUG -I"c:/opt/R-library/Rcpp/include" -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -mtune=core2 -c RcppExports.cpp -o RcppExports.o
g++ -m32 -I"c:/opt/R-CURR~1/include" -DNDEBUG -I"c:/opt/R-library/Rcpp/include" -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -mtune=core2 -c rcpp_hello_world.cpp -o rcpp_hello_world.o
g++ -m32 -shared -s -static-libgcc -o mypackage.dll tmp.def RcppExports.o rcpp_hello_world.o c:/opt/R-library/Rcpp/lib/i386/libRcpp.a -Ld:/RCompile/CRANpkg/extralibs64/local/lib/i386 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -Lc:/opt/R-CURR~1/bin/i386 -lR
installing to c:/opt/R-library/mypackage/libs/i386
*** arch - x64
g++ -m64 -I"c:/opt/R-CURR~1/include" -DNDEBUG -I"c:/opt/R-library/Rcpp/include" -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -mtune=core2 -c RcppExports.cpp -o RcppExports.o
g++ -m64 -I"c:/opt/R-CURR~1/include" -DNDEBUG -I"c:/opt/R-library/Rcpp/include" -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -mtune=core2 -c rcpp_hello_world.cpp -o rcpp_hello_world.o
g++ -m64 -shared -s -static-libgcc -o mypackage.dll tmp.def RcppExports.o rcpp_hello_world.o c:/opt/R-library/Rcpp/lib/x64/libRcpp.a -Ld:/RCompile/CRANpkg/extralibs64/local/lib/x64 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -Lc:/opt/R-CURR~1/bin/x64 -lR
installing to c:/opt/R-library/mypackage/libs/x64
** R
** preparing package for lazy loading
** help
Warning: C:/Users/deddelbuettel/AppData/Local/Temp/RtmpaiaZVk/R.INSTALL65481db46d2b/mypackage/man/mypackage-package.Rd:30: All text must be in a section
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
*** arch - x64
* DONE (mypackage)
R>
after which we can load and run it:
R> library(mypackage)
R> rcpp_hello_world()
[[1]]
[1] "foo" "bar"
[[2]]
[1] 0 1
R>
and finally remove it as it has no real use case besides demonstrating these mechanics:
R> remove.packages("mypackage")
Removing package from ‘c:/opt/R-library’
(as ‘lib’ is unspecified)
R>

Segmentation fault when running hs_init(0, 0) for ffi

I am trying to call Haskell functions from python.
I have the following make file:
GHC=ghc
GHC_RUNTIME_LINKER_FLAG=-lHSrts-ghc7.4.1
libffi-example.so: Example.o wrapper.o
$(GHC) -o $# -shared -dynamic -fPIC $^ $(GHC_RUNTIME_LINKER_FLAG)
Example_stub.h Example.o: Example.hs
$(GHC) -c -dynamic -fPIC Example.hs
wrapper.o: wrapper.c Example_stub.h
$(GHC) -c -dynamic -fPIC wrapper.c
clean:
rm -f *.hi *.o *_stub.[ch]
clean-all:
rm -f *.hi *.o *_stub.[ch] *.so
# Runs the example Python program
example: libffi-example.so
python program.py
The only thing wrapper.c does it creating wrappers for hs_init by calling hs_init(0,0);. The wrapper is called example_init
I get a segmentation fault when running make example, in example_init (ie when calling hs_init(0,0)).
Can someone tell me why this is and/or how to fix it?
Thanks!
It ought to work:
"Moreover, hs_init() may be called with NULL for both argc and argv, signalling the absence of command line arguments."
It seems to be a bug in ghc-7.2.1 to ghc-7.4.1:
RFib.hs:
{-# LANGUAGE ForeignFunctionInterface #-}
module RFib where
fib :: Int -> Int
fib n
| n >= 0 = go 0 1 n
| even n = -go 0 1 (-n)
| otherwise = go 0 1 (-n)
where
go a _ 0 = a
go a b k = go b (a+b) (k-1)
foreign export ccall "rfib" fib :: Int -> Int
rfib.c:
#include <stdio.h>
#include <HsFFI.h>
int rfib(int);
int main(void) {
hs_init(0,0);
printf("%d\n", rfib(35));
hs_exit();
return 0;
}
Compile and run:
$ rm rfib.o RFib.hi RFib.o a.out
$ ghc-7.0.2 -O2 -Wall -no-hs-main RFib.hs rfib.c && ./a.out
[1 of 1] Compiling RFib ( RFib.hs, RFib.o )
Linking a.out ...
9227465
$ rm rfib.o RFib.hi RFib.o a.out
$ ghc-7.0.4 -O2 -Wall -no-hs-main RFib.hs rfib.c && ./a.out
[1 of 1] Compiling RFib ( RFib.hs, RFib.o )
Linking a.out ...
9227465
$ rm rfib.o RFib.hi RFib.o a.out
$ ghc-7.2.1 -O2 -Wall -no-hs-main RFib.hs rfib.c && ./a.out
[1 of 1] Compiling RFib ( RFib.hs, RFib.o )
Linking a.out ...
Speicherzugriffsfehler
$ rm rfib.o RFib.hi RFib.o a.out
$ ghc-7.2.2 -O2 -Wall -no-hs-main RFib.hs rfib.c && ./a.out
[1 of 1] Compiling RFib ( RFib.hs, RFib.o )
Linking a.out ...
Speicherzugriffsfehler
$ rm rfib.o RFib.hi RFib.o a.out
$ ghc-7.4.1 -O2 -Wall -no-hs-main RFib.hs rfib.c && ./a.out
[1 of 1] Compiling RFib ( RFib.hs, RFib.o )
Linking a.out ...
Speicherzugriffsfehler
$ rm rfib.o RFib.hi RFib.o a.out
$ ghc-7.4.2 -O2 -Wall -no-hs-main RFib.hs rfib.c && ./a.out
[1 of 1] Compiling RFib ( RFib.hs, RFib.o )
Linking a.out ...
9227465
$ rm rfib.o RFib.hi RFib.o a.out
$ ghc -O2 -Wall -no-hs-main RFib.hs rfib.c && ./a.out
[1 of 1] Compiling RFib ( RFib.hs, RFib.o )
Linking a.out ...
9227465
Changing two lines in rfib.c:
int main(int argc, char *argv[]) {
hs_init(&argc,&argv);
it works with all versions (>= 7.0 that I have installed).
So to fix it
pass &argc and &argv
upgrade GHC
are the two most obvious ways.

Resources