I am a beginner of Fortran and running a model written by Fortran. When I tried to compile it, I got an error message like:
libtool: link: (cd ".libs" && rm -f "libgrib_api_f77.so" && ln -s "libgrib_api_f77.so.1.0.0" "libgrib_api_f77.so")
libtool: link: ar cru .libs/libgrib_api_f77.a grib_fortran.o grib_f77.o
libtool: link: ranlib .libs/libgrib_api_f77.a
libtool: link: ( cd ".libs" && rm -f "libgrib_api_f77.la" && ln -s "../libgrib_api_f77.la" "libgrib_api_f77.la" )
gfortran -c -o same_int_long.o same_int_long.f90
same_int_long.f90:23:18:
17 | call check_long(x2(1),x2(2),ret)
| 2
......
23 | call check_long(x4(1),x4(2),ret)
| 1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(4)/INTEGER(2)).
same_int_long.f90:29:18:
17 | call check_long(x2(1),x2(2),ret)
| 2
......
29 | call check_long(x8(1),x8(2),ret)
| 1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(8)/INTEGER(2)).
same_int_long.f90:51:17:
45 | call check_int(x2(1),x2(2),ret)
| 2
......
51 | call check_int(x4(1),x4(2),ret)
| 1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(4)/INTEGER(2)).
same_int_long.f90:57:17:
45 | call check_int(x2(1),x2(2),ret)
| 2
......
57 | call check_int(x8(1),x8(2),ret)
| 1
Error: Type mismatch between actual argument at (1) and actual argument at (2) (INTEGER(8)/INTEGER(2)).
make[2]: *** [Makefile:546: same_int_long.o] Error 1
make[2]: Leaving directory '/gpfs/home3/eccei339/snellius_surfex/open_SURFEX_V8_1/src/LIB/grib_api-1.17.0-Source/fortran'
make[1]: *** [Makefile:604: all-recursive] Error 1
make[1]: Leaving directory '/gpfs/home3/eccei339/snellius_surfex/open_SURFEX_V8_1/src/LIB/grib_api-1.17.0-Source'
make: *** [Makefile:398: /home/eccei339/snellius_surfex/open_SURFEX_V8_1/src/LIB/grib_api-1.17.0-Source-LXgfortran/include/grib_api.mod] Error 2
What I did is basically following the installation of the model:
Step1
(base) [eccei339#int3 ~]$ mkdir snellius_surfex
(base) [eccei339#int3 ~]$ cp open_surfex_v8_1_20200107.tar-2.gz snellius_surfex/
(base) [eccei339#int3 ~]$ cd snellius_surfex/
(base) [eccei339#int3 snellius_surfex]$ tar zxvf open_surfex_v8_1_20200107.tar-2.gz
…(omit the tar zxvf logging information)
Step 2: some essential env variable
(base) [eccei339#int3 snellius_surfex]$ export VER_MPI="NOMPI"
(base) [eccei339#int3 snellius_surfex]$ export OMP_NUM_THREADS=1
(base) [eccei339#int3 snellius_surfex]$ module load 2021
(base) [eccei339#int3 snellius_surfex]$ module load GCC/10.3.0
(base) [eccei339#int3 snellius_surfex]$ ls
open_SURFEX_V8_1 open_surfex_v8_1_20200107.tar-2.gz
(here I exported some necessary envi var following the instructions of installation of the software)
Step 3: configure
(base) [eccei339#int3 snellius_surfex]$ cd open_SURFEX_V8_1/src/
(base) [eccei339#int3 src]$ ls
ASSIM Makefile Rules.bullXI15.mk Rules.MCgfortran.mk SURFEX
configure Makefile.SURFEX.mk Rules.bullXI16.mk Rules.SX8.mk
FORC OFFLIN Rules.LXgfortran.mk Rules.zgfortran.mk
include Rules.AIX64.mk Rules.LXifort.mk Rules.zifort.mk
LIB Rules.bgfortran.mk Rules.LXpgi.mk scripts
(base) [eccei339#int3 src]$ ./configure
(omit the long logging info of the “configure” command)
(base) [eccei339#int3 src]$ . ../conf/profile_surfex-LXgfortran-SFX-V8-1-1-NOMPI-OMP-O2-X0
(an essential step following the instructions of installation of the software)
Step 4: make the master
(base) [eccei339#int3 src]$ make
find: ‘/home/eccei339/snellius_surfex/open_SURFEX_V8_1/src/dir_obj-LXgfortran-SFX-V8-1-1-NOMPI-OMP-O2-X0/MASTER’: No such file or directory
cd /home/eccei339/snellius_surfex/open_SURFEX_V8_1/src/LIB/grib_api-1.17.0-Source && LDFLAGS= FCFLAGS= CPPFLAGS="" \
./configure --disable-jpeg --prefix=/home/eccei339/snellius_surfex/open_SURFEX_V8_1/src/LIB/grib_api-1.17.0-Source-LXgfortran FC="gfortran" && \
make -j 1 clean && \
make -j 1 && \
make -j 1 install && \
make -j 1 clean
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking how to print strings... printf
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
(omit the long logging information, and the final lines are the error message shown in the beginning of this question description.)
I searched the Internet that this could be due to the GCC 10 is more strict than older GCC (I compiled this model last year with older GCC and made it, but failed this time because our server is transferred to a new system, thus the GCC is upgraded from older version to a new version). Some information from Google said that I could add something like this:
export FCFLAGS="-w -fallow-argument-mismatch -O2"
export FFLAGS="-w -fallow-argument-mismatch -O2"
But I tried it in the step 2 where I export some essential environmental variables, it still does not work. So I am wondering is there anybody who can help me? Thanks a lot!
Updates: the source code of grib_api-1.17.0-Source/fortran/same_int_long.f90 from http://distfiles.macports.org/grib_api/ is as following:
! Copyright 2005-2016 ECMWF.
!
! This software is licensed under the terms of the Apache Licence Version 2.0
! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
!
! In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
! virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
integer function kind_of_long()
integer(2), dimension(2) :: x2 = (/1, 2/)
integer(4), dimension(2) :: x4 = (/1, 2/)
integer(8), dimension(2) :: x8 = (/1, 2/)
character(len=1) :: ret
kind_of_long=-1
call check_long(x2(1),x2(2),ret)
if (ret == 't') then
kind_of_long=2
return
endif
call check_long(x4(1),x4(2),ret)
if (ret == 't') then
kind_of_long=4
return
endif
call check_long(x8(1),x8(2),ret)
if (ret == 't') then
kind_of_long=8
return
endif
end function kind_of_long
integer function kind_of_int()
integer(2), dimension(2) :: x2 = (/1, 2/)
integer(4), dimension(2) :: x4 = (/1, 2/)
integer(8), dimension(2) :: x8 = (/1, 2/)
character(len=1) :: ret
kind_of_int=-1
call check_int(x2(1),x2(2),ret)
if (ret == 't') then
kind_of_int=2
return
endif
call check_int(x4(1),x4(2),ret)
if (ret == 't') then
kind_of_int=4
return
endif
call check_int(x8(1),x8(2),ret)
if (ret == 't') then
kind_of_int=8
return
endif
end function kind_of_int
program same_int_long
integer ki,kl
ki=kind_of_int()
kl=kind_of_long()
if (ki /= kl) then
write (*,'(i1)') 0
else
write (*,'(i1)') 1
endif
end program same_int_long
Here is the full log information of make: https://drive.google.com/file/d/14rkj2ay39Rv84QBL6UDiSdlIAfhuEt_z/view?usp=sharing
This appened to me with a MPI fortran code. The cause is a decision from gcc developpers on what should be «good interfaces» see here.
Two solutions in my case :
Tells gfortran to ignore this concerns with option -fallow-argument-mismatch.
Use modern fortran interface (use mpi instead of include mpif.h)
I chose the latter.
What you are instantiating as an INTEGER is getting its value assigned by another (variable or declaration) integer of a different "byte" memory storage size.
e.g. in other languages int is 4 bytes and long is 8 bytes. (note) Fortran also has pointers alike C/C++
https://docs.oracle.com/cd/E19957-01/805-4939/6j4m0vna5/index.html
nb: You did not show the code that has the problem , somewhere around line 29 char 18 in source file same_int_long.f90 ??
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)
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.
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>