facebook / duckling

Language, engine, and tooling for expressing, testing, and evaluating composable language rules on input strings.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error building on MacOS with M1 Pro

j6e opened this issue · comments

I've been trying to build this project but it fails on my mac M1 Pro. I'm not a Haskell user so I'm not really sure how to fix the error, I've tried but couldn't figure it out.

This is the log output of the stack build.

➜ stack build
constraints-extras> configure
constraints-extras> Configuring constraints-extras-0.3.1.0...
constraints-extras> build
regex-pcre        > configure
constraints-extras> Preprocessing library for constraints-extras-0.3.1.0..
constraints-extras> Building library for constraints-extras-0.3.1.0..
constraints-extras> [1 of 4] Compiling Data.Constraint.Compose
constraints-extras> [2 of 4] Compiling Data.Constraint.Flip
constraints-extras> [3 of 4] Compiling Data.Constraint.Extras
regex-pcre        > Configuring regex-pcre-0.95.0.0...
constraints-extras> [4 of 4] Compiling Data.Constraint.Extras.TH
regex-pcre        > Cabal-simple_SvXsv1f__3.0.1.0_ghc-8.8.4: The program 'pkg-config' version
regex-pcre        > >=0.9.0 is required but it could not be found.
regex-pcre        >
lifted-base       > configure
constraints-extras> ld: warning: -undefined dynamic_lookup may not work with chained fixups
constraints-extras> Preprocessing executable 'readme' for constraints-extras-0.3.1.0..
constraints-extras> Building executable 'readme' for constraints-extras-0.3.1.0..
constraints-extras> [1 of 1] Compiling Main
lifted-base       > Configuring lifted-base-0.2.3.12...
lifted-base       > build
text-show         > configure
lifted-base       > Preprocessing library for lifted-base-0.2.3.12..
lifted-base       > Building library for lifted-base-0.2.3.12..
lifted-base       > [1 of 9] Compiling Control.Concurrent.Chan.Lifted
text-show         > Configuring text-show-3.8.5...
lifted-base       > [2 of 9] Compiling Control.Concurrent.MVar.Lifted
lifted-base       > [3 of 9] Compiling Control.Concurrent.QSem.Lifted
text-show         > build
zlib-bindings     > configure
lifted-base       > [4 of 9] Compiling Control.Concurrent.QSemN.Lifted
text-show         > Preprocessing library for text-show-3.8.5..
text-show         > Building library for text-show-3.8.5..
lifted-base       > [5 of 9] Compiling Control.Exception.Lifted
lifted-base       > [6 of 9] Compiling Control.Concurrent.Lifted
lifted-base       > [7 of 9] Compiling Data.IORef.Lifted
lifted-base       > [8 of 9] Compiling Foreign.Marshal.Utils.Lifted
zlib-bindings     > Configuring zlib-bindings-0.1.1.5...
lifted-base       > [9 of 9] Compiling System.Timeout.Lifted
zlib-bindings     > build
lifted-base       > ld: warning: -undefined dynamic_lookup may not work with chained fixups
zlib-bindings     > Preprocessing library for zlib-bindings-0.1.1.5..
zlib-bindings     > Building library for zlib-bindings-0.1.1.5..
lifted-base       > copy/register
zlib-bindings     > [1 of 2] Compiling Codec.Zlib.Lowlevel
lifted-base       > Installing library in /Users/user/.stack/snapshots/x86_64-osx/b2c2f138509de2ae74303af9e3604403e116a9665fb486f57f9e1932cd6aa07b/8.8.4/lib/x86_64-osx-ghc-8.8.4/lifted-base-0.2.3.12-296QF91KsdW7Eo15BTfQrE
lifted-base       > Registering library for lifted-base-0.2.3.12..
constraints-extras> Linking .stack-work/dist/x86_64-osx/Cabal-3.0.1.0/build/readme/readme ...
zlib-bindings     > [2 of 2] Compiling Codec.Zlib
constraints-extras> copy/register
text-show         > [ 1 of 66] Compiling TextShow.Data.OldTypeable
constraints-extras> Installing library in /Users/user/.stack/snapshots/x86_64-osx/b2c2f138509de2ae74303af9e3604403e116a9665fb486f57f9e1932cd6aa07b/8.8.4/lib/x86_64-osx-ghc-8.8.4/constraints-extras-0.3.1.0-141mYY2M9935H4MyEKh12I
constraints-extras> Installing executable readme in /Users/user/.stack/snapshots/x86_64-osx/b2c2f138509de2ae74303af9e3604403e116a9665fb486f57f9e1932cd6aa07b/8.8.4/bin
zlib-bindings     >
zlib-bindings     > /private/var/folders/14/t5x6b2kn43129npz43r1cs6w0000gp/T/stack-40ad9630c124948d/zlib-bindings-0.1.1.5/c/helper.c:32:45: error:
zlib-bindings     >      warning: passing 'const char *' to parameter of type 'const Bytef *' (aka 'const unsigned char *') converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
zlib-bindings     >             return inflateSetDictionary(stream, dictionary, dictLength);
zlib-bindings     >                                                 ^~~~~~~~~~
zlib-bindings     >    |
zlib-bindings     > 32 |         return inflateSetDictionary(stream, dictionary, dictLength);
zlib-bindings     >    |                                             ^
zlib-bindings     >
zlib-bindings     > /private/var/folders/14/t5x6b2kn43129npz43r1cs6w0000gp/T/stack-40ad9630c124948d/zlib-bindings-0.1.1.5//Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/zlib.h:892:59: error:
zlib-bindings     >      note: passing argument to parameter 'dictionary' here
zlib-bindings     >                                                  const Bytef *dictionary,
zlib-bindings     >                                                               ^
zlib-bindings     >     |
zlib-bindings     > 892 |                                              const Bytef *dictionary,
zlib-bindings     >     |                                                           ^
zlib-bindings     >
zlib-bindings     > /private/var/folders/14/t5x6b2kn43129npz43r1cs6w0000gp/T/stack-40ad9630c124948d/zlib-bindings-0.1.1.5/c/helper.c:37:45: error:
zlib-bindings     >      warning: passing 'const char *' to parameter of type 'const Bytef *' (aka 'const unsigned char *') converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
zlib-bindings     >             return deflateSetDictionary(stream, dictionary, dictLength);
zlib-bindings     >                                                 ^~~~~~~~~~
zlib-bindings     >    |
zlib-bindings     > 37 |         return deflateSetDictionary(stream, dictionary, dictLength);
zlib-bindings     >    |                                             ^
zlib-bindings     >
zlib-bindings     > /private/var/folders/14/t5x6b2kn43129npz43r1cs6w0000gp/T/stack-40ad9630c124948d/zlib-bindings-0.1.1.5//Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/zlib.h:617:59: error:
zlib-bindings     >      note: passing argument to parameter 'dictionary' here
zlib-bindings     >                                                  const Bytef *dictionary,
zlib-bindings     >                                                               ^
zlib-bindings     >     |
zlib-bindings     > 617 |                                              const Bytef *dictionary,
zlib-bindings     >     |                                                           ^
zlib-bindings     >
zlib-bindings     > /private/var/folders/14/t5x6b2kn43129npz43r1cs6w0000gp/T/stack-40ad9630c124948d/zlib-bindings-0.1.1.5/c/helper.c:48:18: error:
zlib-bindings     >      warning: assigning to 'Bytef *' (aka 'unsigned char *') from 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
zlib-bindings     >             stream->next_in = buff;
zlib-bindings     >                             ^ ~~~~
zlib-bindings     >    |
zlib-bindings     > 48 |         stream->next_in = buff;
zlib-bindings     >    |                  ^
zlib-bindings     >
zlib-bindings     > /private/var/folders/14/t5x6b2kn43129npz43r1cs6w0000gp/T/stack-40ad9630c124948d/zlib-bindings-0.1.1.5/c/helper.c:54:19: error:
zlib-bindings     >      warning: assigning to 'Bytef *' (aka 'unsigned char *') from 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
zlib-bindings     >             stream->next_out = buff;
zlib-bindings     >                              ^ ~~~~
zlib-bindings     >    |
zlib-bindings     > 54 |         stream->next_out = buff;
zlib-bindings     >    |                   ^
zlib-bindings     >
zlib-bindings     > /private/var/folders/14/t5x6b2kn43129npz43r1cs6w0000gp/T/stack-40ad9630c124948d/zlib-bindings-0.1.1.5/c/helper.c:75:9: error:
zlib-bindings     >      warning: returning 'Bytef *' (aka 'unsigned char *') from a function with result type 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
zlib-bindings     >             return stream->next_in;
zlib-bindings     >                    ^~~~~~~~~~~~~~~
zlib-bindings     >    |
zlib-bindings     > 75 |         return stream->next_in;
zlib-bindings     >    |         ^
zlib-bindings     > 5 warnings generated.
text-show         > [ 2 of 66] Compiling TextShow.GHC.Conc.Windows
constraints-extras> Registering library for constraints-extras-0.3.1.0..
text-show         > [ 3 of 66] Compiling TextShow.GHC.Stats
text-show         > [ 4 of 66] Compiling TextShow.Options
zlib-bindings     >
zlib-bindings     > /private/var/folders/14/t5x6b2kn43129npz43r1cs6w0000gp/T/stack-40ad9630c124948d/zlib-bindings-0.1.1.5/c/helper.c:32:45: error:
zlib-bindings     >      warning: passing 'const char *' to parameter of type 'const Bytef *' (aka 'const unsigned char *') converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
zlib-bindings     >             return inflateSetDictionary(stream, dictionary, dictLength);
zlib-bindings     >                                                 ^~~~~~~~~~
zlib-bindings     >    |
zlib-bindings     > 32 |         return inflateSetDictionary(stream, dictionary, dictLength);
zlib-bindings     >    |                                             ^
zlib-bindings     >
zlib-bindings     > /private/var/folders/14/t5x6b2kn43129npz43r1cs6w0000gp/T/stack-40ad9630c124948d/zlib-bindings-0.1.1.5//Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/zlib.h:892:59: error:
zlib-bindings     >      note: passing argument to parameter 'dictionary' here
zlib-bindings     >                                                  const Bytef *dictionary,
zlib-bindings     >                                                               ^
zlib-bindings     >     |
zlib-bindings     > 892 |                                              const Bytef *dictionary,
zlib-bindings     >     |                                                           ^
zlib-bindings     >
zlib-bindings     > /private/var/folders/14/t5x6b2kn43129npz43r1cs6w0000gp/T/stack-40ad9630c124948d/zlib-bindings-0.1.1.5/c/helper.c:37:45: error:
zlib-bindings     >      warning: passing 'const char *' to parameter of type 'const Bytef *' (aka 'const unsigned char *') converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
zlib-bindings     >             return deflateSetDictionary(stream, dictionary, dictLength);
zlib-bindings     >                                                 ^~~~~~~~~~
zlib-bindings     >    |
zlib-bindings     > 37 |         return deflateSetDictionary(stream, dictionary, dictLength);
zlib-bindings     >    |                                             ^
zlib-bindings     >
zlib-bindings     > /private/var/folders/14/t5x6b2kn43129npz43r1cs6w0000gp/T/stack-40ad9630c124948d/zlib-bindings-0.1.1.5//Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/zlib.h:617:59: error:
zlib-bindings     >      note: passing argument to parameter 'dictionary' here
zlib-bindings     >                                                  const Bytef *dictionary,
zlib-bindings     >                                                               ^
zlib-bindings     >     |
zlib-bindings     > 617 |                                              const Bytef *dictionary,
zlib-bindings     >     |                                                           ^
zlib-bindings     >
zlib-bindings     > /private/var/folders/14/t5x6b2kn43129npz43r1cs6w0000gp/T/stack-40ad9630c124948d/zlib-bindings-0.1.1.5/c/helper.c:48:18: error:
zlib-bindings     >      warning: assigning to 'Bytef *' (aka 'unsigned char *') from 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
zlib-bindings     >             stream->next_in = buff;
zlib-bindings     >                             ^ ~~~~
zlib-bindings     >    |
zlib-bindings     > 48 |         stream->next_in = buff;
zlib-bindings     >    |                  ^
zlib-bindings     >
zlib-bindings     > /private/var/folders/14/t5x6b2kn43129npz43r1cs6w0000gp/T/stack-40ad9630c124948d/zlib-bindings-0.1.1.5/c/helper.c:54:19: error:
zlib-bindings     >      warning: assigning to 'Bytef *' (aka 'unsigned char *') from 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
zlib-bindings     >             stream->next_out = buff;
zlib-bindings     >                              ^ ~~~~
zlib-bindings     >    |
zlib-bindings     > 54 |         stream->next_out = buff;
zlib-bindings     >    |                   ^
zlib-bindings     >
zlib-bindings     > /private/var/folders/14/t5x6b2kn43129npz43r1cs6w0000gp/T/stack-40ad9630c124948d/zlib-bindings-0.1.1.5/c/helper.c:75:9: error:
zlib-bindings     >      warning: returning 'Bytef *' (aka 'unsigned char *') from a function with result type 'char *' converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
zlib-bindings     >             return stream->next_in;
zlib-bindings     >                    ^~~~~~~~~~~~~~~
zlib-bindings     >    |
zlib-bindings     > 75 |         return stream->next_in;
zlib-bindings     >    |         ^
zlib-bindings     > 5 warnings generated.
zlib-bindings     > ld: warning: -undefined dynamic_lookup may not work with chained fixups
zlib-bindings     > copy/register
zlib-bindings     > Installing library in /Users/user/.stack/snapshots/x86_64-osx/b2c2f138509de2ae74303af9e3604403e116a9665fb486f57f9e1932cd6aa07b/8.8.4/lib/x86_64-osx-ghc-8.8.4/zlib-bindings-0.1.1.5-INKLkAMD2GrHs50h4GdnVw
text-show         > [ 5 of 66] Compiling TextShow.TH.Names
zlib-bindings     > Registering library for zlib-bindings-0.1.1.5..
text-show         > [ 6 of 66] Compiling TextShow.Utils
text-show         > [ 7 of 66] Compiling TextShow.Classes
text-show         > [ 8 of 66] Compiling TextShow.TH.Internal
text-show         > [ 9 of 66] Compiling TextShow.Data.Tuple
text-show         > ld: warning: -undefined dynamic_lookup may not work with chained fixups
text-show         > [10 of 66] Compiling TextShow.Data.Maybe
text-show         > [11 of 66] Compiling TextShow.Data.Semigroup
text-show         > [12 of 66] Compiling TextShow.Data.Either
text-show         > [13 of 66] Compiling TextShow.Data.Bool
text-show         > [14 of 66] Compiling TextShow.Functions
text-show         > [15 of 66] Compiling TextShow.FromStringTextShow
text-show         > [16 of 66] Compiling TextShow.Data.Void
text-show         > [17 of 66] Compiling TextShow.Data.Typeable.Utils
text-show         > [18 of 66] Compiling TextShow.Data.Typeable
text-show         > [19 of 66] Compiling TextShow.Data.Type.Equality
text-show         > [20 of 66] Compiling TextShow.Data.Type.Coercion
text-show         > [21 of 66] Compiling TextShow.Data.Proxy
text-show         > [22 of 66] Compiling TextShow.Data.Ord
text-show         > [23 of 66] Compiling TextShow.Data.Monoid
text-show         > [24 of 66] Compiling TextShow.Data.Integral
text-show         > [25 of 66] Compiling TextShow.System.IO
text-show         > [26 of 66] Compiling TextShow.System.Exit
text-show         > [27 of 66] Compiling TextShow.Numeric.Natural
text-show         > [28 of 66] Compiling TextShow.GHC.Fingerprint
text-show         > [29 of 66] Compiling TextShow.Foreign.Ptr
text-show         > [30 of 66] Compiling TextShow.Data.Ratio
text-show         > [31 of 66] Compiling TextShow.Data.Functor.Sum
text-show         > [32 of 66] Compiling TextShow.Data.Functor.Product
text-show         > [33 of 66] Compiling TextShow.Data.Functor.Identity
text-show         > [34 of 66] Compiling TextShow.Data.Functor.Compose
text-show         > [35 of 66] Compiling TextShow.Data.Floating
text-show         > [36 of 66] Compiling TextShow.Foreign.C.Types
text-show         > [37 of 66] Compiling TextShow.System.Posix.Types
text-show         > [38 of 66] Compiling TextShow.GHC.Event
text-show         > ld: warning: -undefined dynamic_lookup may not work with chained fixups
text-show         > [39 of 66] Compiling TextShow.Data.Fixed
text-show         > [40 of 66] Compiling TextShow.Data.Dynamic
text-show         > [41 of 66] Compiling TextShow.Data.Complex
text-show         > [42 of 66] Compiling TextShow.Data.Char
text-show         > [43 of 66] Compiling TextShow.GHC.TypeLits
text-show         > [44 of 66] Compiling TextShow.GHC.Generics
text-show         > [45 of 66] Compiling TextShow.Data.List
text-show         > [46 of 66] Compiling TextShow.Text.Read
text-show         > [47 of 66] Compiling TextShow.GHC.StaticPtr
text-show         > [48 of 66] Compiling TextShow.GHC.Stack
text-show         > [49 of 66] Compiling TextShow.GHC.RTS.Flags
text-show         > [50 of 66] Compiling TextShow.Data.Version
text-show         > [51 of 66] Compiling TextShow.Data.List.NonEmpty
text-show         > [52 of 66] Compiling TextShow.Data.Data
text-show         > [53 of 66] Compiling TextShow.Data.ByteString
text-show         > [54 of 66] Compiling TextShow.Data.Text
text-show         > [55 of 66] Compiling TextShow.Data.Array
text-show         > [56 of 66] Compiling TextShow.Control.Monad.ST
text-show         > [57 of 66] Compiling TextShow.Control.Exception
text-show         > [58 of 66] Compiling TextShow.Control.Concurrent
text-show         > [59 of 66] Compiling TextShow.Control.Applicative
text-show         > [60 of 66] Compiling TextShow.Instances
text-show         > [61 of 66] Compiling TextShow.TH
text-show         > [62 of 66] Compiling TextShow.Generic
text-show         > [63 of 66] Compiling TextShow.Debug.Trace
text-show         > [64 of 66] Compiling TextShow.Debug.Trace.TH
text-show         > [65 of 66] Compiling TextShow.Debug.Trace.Generic
text-show         > [66 of 66] Compiling TextShow
text-show         > ld: warning: -undefined dynamic_lookup may not work with chained fixups
text-show         > copy/register
text-show         > Installing library in /Users/user/.stack/snapshots/x86_64-osx/b2c2f138509de2ae74303af9e3604403e116a9665fb486f57f9e1932cd6aa07b/8.8.4/lib/x86_64-osx-ghc-8.8.4/text-show-3.8.5-H2zt3JFuths7rykoP8XoFy
text-show         > Registering library for text-show-3.8.5..
Progress 5/11

Error: [S-7282]
       Stack failed to execute the build plan.

       While executing the build plan, Stack encountered the following errors:

       [S-7011]
       While building package regex-pcre-0.95.0.0 (scroll up to its section to
       see the error) using:
       /Users/user/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_SvXsv1f__3.0.1.0_ghc-8.8.4 --verbose=1 --builddir=.stack-work/dist/x86_64-osx/Cabal-3.0.1.0 configure --with-ghc=/Users/user/.stack/programs/x86_64-osx/ghc-8.8.4/bin/ghc-8.8.4 --with-ghc-pkg=/Users/user/.stack/programs/x86_64-osx/ghc-8.8.4/bin/ghc-pkg-8.8.4 --user --package-db=clear --package-db=global --package-db=/Users/user/.stack/snapshots/x86_64-osx/b2c2f138509de2ae74303af9e3604403e116a9665fb486f57f9e1932cd6aa07b/8.8.4/pkgdb --libdir=/Users/user/.stack/snapshots/x86_64-osx/b2c2f138509de2ae74303af9e3604403e116a9665fb486f57f9e1932cd6aa07b/8.8.4/lib --bindir=/Users/user/.stack/snapshots/x86_64-osx/b2c2f138509de2ae74303af9e3604403e116a9665fb486f57f9e1932cd6aa07b/8.8.4/bin --datadir=/Users/user/.stack/snapshots/x86_64-osx/b2c2f138509de2ae74303af9e3604403e116a9665fb486f57f9e1932cd6aa07b/8.8.4/share --libexecdir=/Users/user/.stack/snapshots/x86_64-osx/b2c2f138509de2ae74303af9e3604403e116a9665fb486f57f9e1932cd6aa07b/8.8.4/libexec --sysconfdir=/Users/user/.stack/snapshots/x86_64-osx/b2c2f138509de2ae74303af9e3604403e116a9665fb486f57f9e1932cd6aa07b/8.8.4/etc --docdir=/Users/user/.stack/snapshots/x86_64-osx/b2c2f138509de2ae74303af9e3604403e116a9665fb486f57f9e1932cd6aa07b/8.8.4/doc/regex-pcre-0.95.0.0 --htmldir=/Users/user/.stack/snapshots/x86_64-osx/b2c2f138509de2ae74303af9e3604403e116a9665fb486f57f9e1932cd6aa07b/8.8.4/doc/regex-pcre-0.95.0.0 --haddockdir=/Users/user/.stack/snapshots/x86_64-osx/b2c2f138509de2ae74303af9e3604403e116a9665fb486f57f9e1932cd6aa07b/8.8.4/doc/regex-pcre-0.95.0.0 --dependency=array=array-0.5.4.0 --dependency=base=base-4.13.0.0 --dependency=bytestring=bytestring-0.10.10.1 --dependency=containers=containers-0.6.2.1 --dependency=regex-base=regex-base-0.94.0.0

Any ideas?

It's a bit unfortunate that stack can't repeat the failed section at the bottom, it's hard to find.

The relevant lines are right near the top:

regex-pcre        > Cabal-simple_SvXsv1f__3.0.1.0_ghc-8.8.4: The program 'pkg-config' version
regex-pcre        > >=0.9.0 is required but it could not be found.

The regex-pcre library needs you to have a system dependency (i.e. a C library not managed by stack).

You could get it from whatever package manager you use on your macos system, e.g. homebrew:
https://formulae.brew.sh/formula/pkg-config

thanks, it worked but now I get a different error:

Building all executables for `duckling' once. After a successful build of all of them, only specified executables will be rebuilt.
duckling> build (lib + exe)
Preprocessing library for duckling-0.2.0.0..
Building library for duckling-0.2.0.0..
ld: warning: -undefined dynamic_lookup may not work with chained fixups
ld: warning: ignoring file /opt/homebrew/Cellar/pcre/8.45/lib/libpcre.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
Preprocessing executable 'duckling-expensive' for duckling-0.2.0.0..
Building executable 'duckling-expensive' for duckling-0.2.0.0..
Linking .stack-work/dist/x86_64-osx/Cabal-3.0.1.0/build/duckling-expensive/duckling-expensive ...
ld: warning: ignoring file /opt/homebrew/Cellar/pcre/8.45/lib/libpcre.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
Undefined symbols for architecture x86_64:
  "_pcre_compile", referenced from:
      _LcclY_info in libHSregex-pcre-0.95.0.0-2ET47luPseYCyxUKIqxikm.a(Wrap.o)
  "_pcre_exec", referenced from:
      _LccBZ_info in libHSregex-pcre-0.95.0.0-2ET47luPseYCyxUKIqxikm.a(Wrap.o)
      _LccO3_info in libHSregex-pcre-0.95.0.0-2ET47luPseYCyxUKIqxikm.a(Wrap.o)
      _LccQr_info in libHSregex-pcre-0.95.0.0-2ET47luPseYCyxUKIqxikm.a(Wrap.o)
      _LccRN_info in libHSregex-pcre-0.95.0.0-2ET47luPseYCyxUKIqxikm.a(Wrap.o)
  "_pcre_fullinfo", referenced from:
      _LccA5_info in libHSregex-pcre-0.95.0.0-2ET47luPseYCyxUKIqxikm.a(Wrap.o)
      _LccLg_info in libHSregex-pcre-0.95.0.0-2ET47luPseYCyxUKIqxikm.a(Wrap.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`gcc' failed in phase `Linker'. (Exit code: 1)

Error: [S-7282]
       Stack failed to execute the build plan.

       While executing the build plan, Stack encountered the following errors:

       [S-7011]
       While building package duckling-0.2.0.0 (scroll up to its section to see the error) using:
       /Users/user/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_SvXsv1f__3.0.1.0_ghc-8.8.4 --verbose=1 --builddir=.stack-work/dist/x86_64-osx/Cabal-3.0.1.0 build lib:duckling exe:custom-dimension-example exe:duckling-example-exe exe:duckling-expensive exe:duckling-regen-exe exe:duckling-request-sample --ghc-options " -fdiagnostics-color=always"
       Process exited with code: ExitFailure 1

Hmm. I know what's happening here, but I'm unsure how to fix it:

  • It looks like brew installed an arm64 binary for libpcre, which makes sense on an M1
  • But stack is trying to build Haskell as x86_64. That also sort of makes sense, because an M1 can run intel binaries through an emulation layer. But we can't mix-and-match - the linker is unable to

The solutions are to either:

  • Get stack to build arm64. I'm unsure how to do that
  • Or, download an x86_64 libpcre and put it on the linker path

I might be able to work this out, but I'm not much of an expert on this layer of the stack so cc @chessai who might know the solution straightaway

I have managed to build the code! As you said I had to download the x86_64 version of libpcre.

arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
arch -x86_64 /usr/local/bin/brew install pcre
stack build

Thanks!