Closed aleith closed 1 month ago
full compile output (error msg):
% cabal run module4
Build profile: -w ghc-9.4.8 -O1
In order, the following will be built (use -v for more details):
- hashable-1.4.7.0 (lib) (requires build)
- text-short-0.1.6 (lib) (requires build)
- time-compat-1.9.7 (lib) (requires build)
- these-1.2.1 (lib) (requires build)
- async-2.2.5 (lib) (requires build)
- scientific-0.3.8.0 (lib) (requires build)
- unordered-containers-0.2.20 (lib) (requires build)
- data-fix-0.3.4 (lib) (requires build)
- uuid-types-1.0.6 (lib) (requires build)
- text-iso8601-0.1.1 (lib) (requires build)
- strict-0.5.1 (lib) (requires build)
- semigroupoids-6.0.1 (lib) (requires build)
- indexed-traversable-instances-0.1.2 (lib) (requires build)
- witherable-0.5 (lib) (requires build)
- semialign-1.3.1 (lib) (requires build)
- aeson-2.2.3.0 (lib) (requires build)
- statistics-0.16.2.1 (lib) (requires build)
- module4-0.1.0.0 (exe:module4) (configuration changed)
Starting hashable-1.4.7.0 (lib)
Building hashable-1.4.7.0 (lib)
**Failed to build hashable-1.4.7.0**.
Build log (
/Users/alastairleith/.cabal/logs/ghc-9.4.8/hshbl-1.4.7.0-a403e1f9.log ):
Configuring library for hashable-1.4.7.0..
Preprocessing library for hashable-1.4.7.0..
Building library for hashable-1.4.7.0..
[ 1 of 10] Compiling Data.Hashable.FFI ( src/Data/Hashable/FFI.hs, dist/build/Data/Hashable/FFI.o, dist/build/Data/Hashable/FFI.dyn_o )
In file included from /var/folders/f6/vnpfs03j6sv6gk8ykrjb5yyc0000gn/T/ghc97374_0/ghc_10.c:4:0: error:
/Users/alastairleith/.ghcup/ghc/9.4.8/lib/ghc-9.4.8/lib/../lib/aarch64-osx-ghc-9.4.8/rts-1.0.2/include/rts/ghc_ffi.h:28:10: error:
fatal error: 'ffi.h' file not found
|
28 | #include "ffi.h"
| ^
#include "ffi.h"
^~~~~~~
1 error generated.
<no location info>: error:
`gcc' failed in phase `C Compiler'. (Exit code: 1)
[ 2 of 10] Compiling Data.Hashable.Imports ( src/Data/Hashable/Imports.hs, dist/build/Data/Hashable/Imports.o, dist/build/Data/Hashable/Imports.dyn_o )
[ 3 of 10] Compiling Data.Hashable.Mix ( src/Data/Hashable/Mix.hs, dist/build/Data/Hashable/Mix.o, dist/build/Data/Hashable/Mix.dyn_o )
Error: cabal: Failed to build hashable-1.4.7.0 (which is required by
exe:module4 from module4-0.1.0.0). See the build log above for details.
That's has nothing to do with statistics. As error messages indicates
fatal error: 'ffi.h' file not found
This is due to missing libffi
or because GHC looks for it in wrong place. I don't know whether GHC on macOS is distributed with libffi or expect system one. Maybe GHC installation is broken in some way
Thanks for the comment, @Shimuuar — I did realise it's due to the ffi library not being installed, my GHC installation is new, I nuked the old one and yet this build error persists.
I don't know if GHC installs the GCC compiler or if it's pre-installed on macOS but it would seem that ffi is part of GCC or needs to be for this package to work.
I don't know how to install this library on macOS, all the instructions for installation on the libffi Github repository and the email someone sent me on the list fr that library are for Linux distress and use a command "apt" which isn't on my Mac.
What can I do to solve this so I can use Statistics? I've reinstalled GHC, installed Xcode just incase that would do something… what else can I try?
installed libffi
using homebrew
and it resolved the issue.
my cabal file has:
and my codes simple:
My GHC is version 9.4.8 cabal is version 3.10.3.0
Error message includes the following: