haskell-hvr / uuid

A Haskell library for creating, printing and parsing UUIDs
http://hackage.haskell.org/package/uuid
61 stars 38 forks source link

Can't install uuid on macOS #71

Closed nsadeh closed 2 years ago

nsadeh commented 2 years ago

When I install uuid by adding uuid to my stack package.yaml, I get the following error:

tohash-md5-0.11.101.0/In file included from /var/folders/cz/bh5dm65s0_lf7_0pb1v27v200000gn/T/ghc27215_0/ghc_16.c:4:0: error:
cryptohash-md5 >
cryptohash-md5 >
cryptohash-md5 > In file included from /Users/nsadeh/.stack/programs/aarch64-osx/ghc-9.0.2/lib/ghc-9.0.2/lib/../lib/aarch64-osx-ghc-9.0.2/rts-1.0.2/include/ffi.h:66:0: error:
cryptohash-md5 >
cryptohash-md5 >
cryptohash-md5 > /Users/nsadeh/.stack/programs/aarch64-osx/ghc-9.0.2/lib/ghc-9.0.2/lib/../lib/aarch64-osx-ghc-9.0.2/rts-1.0.2/include/ffitarget.h:6:10: error:
cryptohash-md5 >      fatal error: 'ffitarget_arm64.h' file not found
cryptohash-md5 >   |
cryptohash-md5 > 6 | #include "ffitarget_arm64.h"
cryptohash-md5 >   |          ^
cryptohash-md5 > #include "ffitarget_arm64.h"
cryptohash-md5 >          ^~~~~~~~~~~~~~~~~~~
cryptohash-md5 > 1 error generated.
cryptohash-md5 > `gcc' failed in phase `C Compiler'. (Exit code: 1)
cryptohash-sha1> build
entropy        > configure
cryptohash-sha1> Preprocessing library for cryptohash-sha1-0.11.101.0..
cryptohash-sha1> Building library for cryptohash-sha1-0.11.101.0..
entropy        > [1 of 2] Compiling Main             ( /private/var/folders/cz/bh5dm65s0_lf7_0pb1v27v200000gn/T/stack-69879577c11930dd/entropy-0.4.1.10/Setup.hs, /private/var/folders/cz/bh5dm65s0_lf7_0pb1v27v200000gn/T/stack-69879577c11930dd/entropy-0.4.1.10/.stack-work/dist/aarch64-osx/Cabal-3.4.1.0/setup/Main.o )
cryptohash-sha1> [1 of 3] Compiling Compat
cryptohash-sha1> [2 of 3] Compiling Crypto.Hash.SHA1.FFI
cryptohash-sha1>
cryptohash-sha1> /private/var/folders/cz/bh5dm65s0_lf7_0pb1v27v200000gn/T/stack-69879577c11930dd/cryptohash-sha1-0.11.101.0/In file included from /var/folders/cz/bh5dm65s0_lf7_0pb1v27v200000gn/T/ghc27406_0/ghc_16.c:4:0: error:
cryptohash-sha1>
cryptohash-sha1>
cryptohash-sha1> In file included from /Users/nsadeh/.stack/programs/aarch64-osx/ghc-9.0.2/lib/ghc-9.0.2/lib/../lib/aarch64-osx-ghc-9.0.2/rts-1.0.2/include/ffi.h:66:0: error:
cryptohash-sha1>
cryptohash-sha1>
cryptohash-sha1> /Users/nsadeh/.stack/programs/aarch64-osx/ghc-9.0.2/lib/ghc-9.0.2/lib/../lib/aarch64-osx-ghc-9.0.2/rts-1.0.2/include/ffitarget.h:6:10: error:
cryptohash-sha1>      fatal error: 'ffitarget_arm64.h' file not found
cryptohash-sha1>   |
cryptohash-sha1> 6 | #include "ffitarget_arm64.h"
cryptohash-sha1>   |          ^
cryptohash-sha1> #include "ffitarget_arm64.h"
cryptohash-sha1>          ^~~~~~~~~~~~~~~~~~~
cryptohash-sha1> 1 error generated.
cryptohash-sha1> `gcc' failed in phase `C Compiler'. (Exit code: 1)
entropy        > [2 of 2] Compiling StackSetupShim   ( /Users/nsadeh/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /private/var/folders/cz/bh5dm65s0_lf7_0pb1v27v200000gn/T/stack-69879577c11930dd/entropy-0.4.1.10/.stack-work/dist/aarch64-osx/Cabal-3.4.1.0/setup/StackSetupShim.o )
entropy        > Linking /private/var/folders/cz/bh5dm65s0_lf7_0pb1v27v200000gn/T/stack-69879577c11930dd/entropy-0.4.1.10/.stack-work/dist/aarch64-osx/Cabal-3.4.1.0/setup/setup ...
entropy        > Configuring entropy-0.4.1.10...
entropy        > build
hashable       > configure
entropy        >
entropy        > /private/var/folders/cz/bh5dm65s0_lf7_0pb1v27v200000gn/T/stack-69879577c11930dd/entropy-0.4.1.10/testRDRAND-27943/testRDRAND.c:6:24: error:
entropy        >      error: invalid output constraint '=qm' in asm
entropy        >          : "=r" (therand), "=qm" (err));
entropy        >                            ^
entropy        >   |
entropy        > 6 |      : "=r" (therand), "=qm" (err));
entropy        >   |                        ^
entropy        > 1 error generated.
entropy        > `gcc' failed in phase `C Compiler'. (Exit code: 1)
entropy        > Result of RDRAND Test: False
entropy        >
entropy        > /private/var/folders/cz/bh5dm65s0_lf7_0pb1v27v200000gn/T/stack-69879577c11930dd/entropy-0.4.1.10/testLibcGetrandom-27943/testLibcGetrandom.c:7:12: error:
entropy        >      error: implicit declaration of function 'getrandom' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
entropy        >         return getrandom(&tmp, sizeof(tmp), GRND_NONBLOCK) != -1;
entropy        >                ^
entropy        >   |
entropy        > 7 |     return getrandom(&tmp, sizeof(tmp), GRND_NONBLOCK) != -1;
entropy        >   |            ^
entropy        >
entropy        > /private/var/folders/cz/bh5dm65s0_lf7_0pb1v27v200000gn/T/stack-69879577c11930dd/entropy-0.4.1.10/testLibcGetrandom-27943/testLibcGetrandom.c:7:41: error:
entropy        >      error: use of undeclared identifier 'GRND_NONBLOCK'
entropy        >         return getrandom(&tmp, sizeof(tmp), GRND_NONBLOCK) != -1;
entropy        >                                             ^
entropy        >   |
entropy        > 7 |     return getrandom(&tmp, sizeof(tmp), GRND_NONBLOCK) != -1;
entropy        >   |                                         ^
entropy        > 2 errors generated.
entropy        > `gcc' failed in phase `C Compiler'. (Exit code: 1)
entropy        > Result of libc getrandom() Test: False
entropy        >
entropy        > /private/var/folders/cz/bh5dm65s0_lf7_0pb1v27v200000gn/T/stack-69879577c11930dd/entropy-0.4.1.10/testSyscallGetrandom-27943/testSyscallGetrandom.c:6:10: error:
entropy        >      fatal error: 'linux/random.h' file not found
entropy        >   |
entropy        > 6 | #include <linux/random.h>
entropy        >   |          ^
entropy        > #include <linux/random.h>
entropy        >          ^~~~~~~~~~~~~~~~
entropy        > 1 error generated.
entropy        > `gcc' failed in phase `C Compiler'. (Exit code: 1)
entropy        > Result of syscall getrandom() Test: False
entropy        >
entropy        > /private/var/folders/cz/bh5dm65s0_lf7_0pb1v27v200000gn/T/stack-69879577c11930dd/entropy-0.4.1.10/testGetentropy-27943/testGetentropy.c:6:12: error:
entropy        >      error: implicit declaration of function 'getentropy' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
entropy        >         return getentropy(&tmp, sizeof(tmp));
entropy        >                ^
entropy        >   |
entropy        > 6 |     return getentropy(&tmp, sizeof(tmp));
entropy        >   |            ^
entropy        > 1 error generated.
entropy        > `gcc' failed in phase `C Compiler'. (Exit code: 1)
entropy        > Result of getentropy() Test: False
entropy        > Preprocessing library for entropy-0.4.1.10..
entropy        > Building library for entropy-0.4.1.10..
hashable       > Configuring hashable-1.3.5.0...
entropy        > [1 of 2] Compiling System.EntropyNix
hashable       > build
network-info   > configure
hashable       > Preprocessing library for hashable-1.3.5.0..
hashable       > Building library for hashable-1.3.5.0..
entropy        >
entropy        > /private/var/folders/cz/bh5dm65s0_lf7_0pb1v27v200000gn/T/stack-69879577c11930dd/entropy-0.4.1.10/In file included from /var/folders/cz/bh5dm65s0_lf7_0pb1v27v200000gn/T/ghc28066_0/ghc_7.c:4:0: error:
entropy        >
entropy        >
entropy        > In file included from /Users/nsadeh/.stack/programs/aarch64-osx/ghc-9.0.2/lib/ghc-9.0.2/lib/../lib/aarch64-osx-ghc-9.0.2/rts-1.0.2/include/ffi.h:66:0: error:
entropy        >
entropy        >
entropy        > /Users/nsadeh/.stack/programs/aarch64-osx/ghc-9.0.2/lib/ghc-9.0.2/lib/../lib/aarch64-osx-ghc-9.0.2/rts-1.0.2/include/ffitarget.h:6:10: error:
entropy        >      fatal error: 'ffitarget_arm64.h' file not found
entropy        >   |
entropy        > 6 | #include "ffitarget_arm64.h"
entropy        >   |          ^
entropy        > #include "ffitarget_arm64.h"
entropy        >          ^~~~~~~~~~~~~~~~~~~
entropy        > 1 error generated.
entropy        > `gcc' failed in phase `C Compiler'. (Exit code: 1)
hashable       > [1 of 7] Compiling Data.Hashable.Imports
hashable       >
hashable       > /private/var/folders/cz/bh5dm65s0_lf7_0pb1v27v200000gn/T/stack-69879577c11930dd/hashable-1.3.5.0/src/Data/Hashable/Imports.hs:1:1: warning: [-Wmissing-safe-haskell-mode]
hashable       >     Data.Hashable.Imports is missing Safe Haskell mode
hashable       >   |
hashable       > 1 | -- | This module exists to avoid conditional imports
hashable       >   | ^
hashable       > [2 of 7] Compiling Data.Hashable.LowLevel
network-info   > Configuring network-info-0.2.1...
hashable       >
hashable       > /private/var/folders/cz/bh5dm65s0_lf7_0pb1v27v200000gn/T/stack-69879577c11930dd/hashable-1.3.5.0/In file included from /var/folders/cz/bh5dm65s0_lf7_0pb1v27v200000gn/T/ghc28232_0/ghc_20.c:4:0: error:
hashable       >
hashable       >
hashable       > In file included from /Users/nsadeh/.stack/programs/aarch64-osx/ghc-9.0.2/lib/ghc-9.0.2/lib/../lib/aarch64-osx-ghc-9.0.2/rts-1.0.2/include/ffi.h:66:0: error:
hashable       >
hashable       >
hashable       > /Users/nsadeh/.stack/programs/aarch64-osx/ghc-9.0.2/lib/ghc-9.0.2/lib/../lib/aarch64-osx-ghc-9.0.2/rts-1.0.2/include/ffitarget.h:6:10: error:
hashable       >      fatal error: 'ffitarget_arm64.h' file not found
hashable       >   |
hashable       > 6 | #include "ffitarget_arm64.h"
hashable       >   |          ^
hashable       > #include "ffitarget_arm64.h"
hashable       >          ^~~~~~~~~~~~~~~~~~~
hashable       > 1 error generated.
hashable       > `gcc' failed in phase `C Compiler'. (Exit code: 1)
network-info   > build
splitmix       > configure
network-info   > Preprocessing library for network-info-0.2.1..
network-info   > Building library for network-info-0.2.1..
network-info   > [1 of 1] Compiling Network.Info
splitmix       > Configuring splitmix-0.1.0.4...
network-info   >
network-info   > /private/var/folders/cz/bh5dm65s0_lf7_0pb1v27v200000gn/T/stack-69879577c11930dd/network-info-0.2.1/src/Network/Info.hsc:46:10: warning: [-Wmissing-methods]
network-info   >     • No explicit implementation for
network-info   >         either ‘poke’ or ‘pokeElemOff’ or ‘pokeByteOff’
network-info   >     • In the instance declaration for ‘Storable NetworkInterface’
network-info   >    |
network-info   > 46 | instance Storable NetworkInterface where
network-info   >    |          ^^^^^^^^^^^^^^^^^^^^^^^^^
splitmix       > build
splitmix       > Preprocessing library for splitmix-0.1.0.4..
splitmix       > Building library for splitmix-0.1.0.4..
network-info   >
network-info   > /private/var/folders/cz/bh5dm65s0_lf7_0pb1v27v200000gn/T/stack-69879577c11930dd/network-info-0.2.1/In file included from /var/folders/cz/bh5dm65s0_lf7_0pb1v27v200000gn/T/ghc28602_0/ghc_3.c:4:0: error:
network-info   >
network-info   >
network-info   > In file included from /Users/nsadeh/.stack/programs/aarch64-osx/ghc-9.0.2/lib/ghc-9.0.2/lib/../lib/aarch64-osx-ghc-9.0.2/rts-1.0.2/include/ffi.h:66:0: error:
network-info   >
network-info   >
network-info   > /Users/nsadeh/.stack/programs/aarch64-osx/ghc-9.0.2/lib/ghc-9.0.2/lib/../lib/aarch64-osx-ghc-9.0.2/rts-1.0.2/include/ffitarget.h:6:10: error:
network-info   >      fatal error: 'ffitarget_arm64.h' file not found
network-info   >   |
network-info   > 6 | #include "ffitarget_arm64.h"
network-info   >   |          ^
network-info   > #include "ffitarget_arm64.h"
network-info   >          ^~~~~~~~~~~~~~~~~~~
network-info   > 1 error generated.
network-info   > `gcc' failed in phase `C Compiler'. (Exit code: 1)
splitmix       > [1 of 4] Compiling Data.Bits.Compat
splitmix       > [2 of 4] Compiling System.Random.SplitMix.Init
splitmix       >
splitmix       > /private/var/folders/cz/bh5dm65s0_lf7_0pb1v27v200000gn/T/stack-69879577c11930dd/splitmix-0.1.0.4/In file included from /var/folders/cz/bh5dm65s0_lf7_0pb1v27v200000gn/T/ghc28664_0/ghc_22.c:4:0: error:
splitmix       >
splitmix       >
splitmix       > In file included from /Users/nsadeh/.stack/programs/aarch64-osx/ghc-9.0.2/lib/ghc-9.0.2/lib/../lib/aarch64-osx-ghc-9.0.2/rts-1.0.2/include/ffi.h:66:0: error:
splitmix       >
splitmix       >
splitmix       > /Users/nsadeh/.stack/programs/aarch64-osx/ghc-9.0.2/lib/ghc-9.0.2/lib/../lib/aarch64-osx-ghc-9.0.2/rts-1.0.2/include/ffitarget.h:6:10: error:
splitmix       >      fatal error: 'ffitarget_arm64.h' file not found
splitmix       >   |
splitmix       > 6 | #include "ffitarget_arm64.h"
splitmix       >   |          ^
splitmix       > #include "ffitarget_arm64.h"
splitmix       >          ^~~~~~~~~~~~~~~~~~~
splitmix       > 1 error generated.
splitmix       > `gcc' failed in phase `C Compiler'. (Exit code: 1)
Progress 6/10

--  While building package splitmix-0.1.0.4 (scroll up to its section to see the error) using:
      /Users/nsadeh/.stack/setup-exe-cache/aarch64-osx/Cabal-simple_mPHDZzAJ_3.4.1.0_ghc-9.0.2 --builddir=.stack-work/dist/aarch64-osx/Cabal-3.4.1.0 build --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1

--  While building package network-info-0.2.1 (scroll up to its section to see the error) using:
      /Users/nsadeh/.stack/setup-exe-cache/aarch64-osx/Cabal-simple_mPHDZzAJ_3.4.1.0_ghc-9.0.2 --builddir=.stack-work/dist/aarch64-osx/Cabal-3.4.1.0 build --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1

--  While building package hashable-1.3.5.0 (scroll up to its section to see the error) using:
      /Users/nsadeh/.stack/setup-exe-cache/aarch64-osx/Cabal-simple_mPHDZzAJ_3.4.1.0_ghc-9.0.2 --builddir=.stack-work/dist/aarch64-osx/Cabal-3.4.1.0 build --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1

--  While building package entropy-0.4.1.10 (scroll up to its section to see the error) using:
      /private/var/folders/cz/bh5dm65s0_lf7_0pb1v27v200000gn/T/stack-69879577c11930dd/entropy-0.4.1.10/.stack-work/dist/aarch64-osx/Cabal-3.4.1.0/setup/setup --builddir=.stack-work/dist/aarch64-osx/Cabal-3.4.1.0 build --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1

--  While building package cryptohash-sha1-0.11.101.0 (scroll up to its section to see the error) using:
      /Users/nsadeh/.stack/setup-exe-cache/aarch64-osx/Cabal-simple_mPHDZzAJ_3.4.1.0_ghc-9.0.2 --builddir=.stack-work/dist/aarch64-osx/Cabal-3.4.1.0 build --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1

--  While building package cryptohash-md5-0.11.101.0 (scroll up to its section to see the error) using:
      /Users/nsadeh/.stack/setup-exe-cache/aarch64-osx/Cabal-simple_mPHDZzAJ_3.4.1.0_ghc-9.0.2 --builddir=.stack-work/dist/aarch64-osx/Cabal-3.4.1.0 build --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1

Is there an incompatibility with Apple silicon? My machine is a Macbook Pro 13" M1 (2020).

nsadeh commented 2 years ago

Turns out this is a general Haskell issue on Mac silicon. I solved it by adding the following:

extra-include-dirs:
- /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/ffi
- /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/include/ffitarget

to my stack.yaml. Hopefully this helps someone.

Source: https://gitlab.haskell.org/ghc/ghc/-/issues/20592