haskell / happy

The Happy parser generator for Haskell
Other
276 stars 84 forks source link

Build fails on OSX 10.15.7 #180

Closed capital-G closed 3 years ago

capital-G commented 3 years ago

Currently I am trying to learn Haskell via https://github.com/kowainik/learn4haskell which has happy as dependency for testing. When I try to run the tests I get the error message

Configuring executable 'happy' for happy-1.20.0..
Preprocessing executable 'happy' for happy-1.20.0..
Building executable 'happy' for happy-1.20.0..
[ 1 of 19] Compiling AbsSyn           ( src/AbsSyn.lhs, dist/build/happy/happy-tmp/AbsSyn.o )
[ 2 of 19] Compiling GenUtils         ( src/GenUtils.lhs, dist/build/happy/happy-tmp/GenUtils.o )
[ 3 of 19] Compiling NameSet          ( src/NameSet.hs, dist/build/happy/happy-tmp/NameSet.o )
[ 4 of 19] Compiling ParamRules       ( src/ParamRules.hs, dist/build/happy/happy-tmp/ParamRules.o )
[ 5 of 19] Compiling ParseMonad       ( src/ParseMonad.hs, dist/build/happy/happy-tmp/ParseMonad.o )
[ 6 of 19] Compiling Lexer            ( src/Lexer.lhs, dist/build/happy/happy-tmp/Lexer.o )
[ 7 of 19] Compiling AttrGrammar      ( src/AttrGrammar.lhs, dist/build/happy/happy-tmp/AttrGrammar.o )
[ 8 of 19] Compiling AttrGrammarParser ( src/AttrGrammarParser.hs, dist/build/happy/happy-tmp/AttrGrammarParser.o )
[ 9 of 19] Compiling Grammar          ( src/Grammar.lhs, dist/build/happy/happy-tmp/Grammar.o )
[10 of 19] Compiling LALR             ( src/LALR.lhs, dist/build/happy/happy-tmp/LALR.o )
[11 of 19] Compiling First            ( src/First.lhs, dist/build/happy/happy-tmp/First.o )
[12 of 19] Compiling Parser           ( src/Parser.hs, dist/build/happy/happy-tmp/Parser.o )
[13 of 19] Compiling Paths_happy      ( dist/build/happy/autogen/Paths_happy.hs, dist/build/happy/happy-tmp/Paths_happy.o )
[14 of 19] Compiling Info             ( src/Info.lhs, dist/build/happy/happy-tmp/Info.o )
[15 of 19] Compiling PrettyGrammar    ( src/PrettyGrammar.hs, dist/build/happy/happy-tmp/PrettyGrammar.o )
[16 of 19] Compiling ProduceGLRCode   ( src/ProduceGLRCode.lhs, dist/build/happy/happy-tmp/ProduceGLRCode.o )
[17 of 19] Compiling Target           ( src/Target.lhs, dist/build/happy/happy-tmp/Target.o )
[18 of 19] Compiling ProduceCode      ( src/ProduceCode.lhs, dist/build/happy/happy-tmp/ProduceCode.o )
[19 of 19] Compiling Main             ( src/Main.lhs, dist/build/happy/happy-tmp/Main.o )
Linking dist/build/happy/happy ...
Undefined symbols for architecture x86_64:
  "___darwin_check_fd_set_overflow", referenced from:
      _awaitEvent in libHSrts.a(Select.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`clang' failed in phase `Linker'. (Exit code: 1)

Here is the current setup I work with:

OSX 10.15.7 XCode 12.3

➜ clang --version
Apple clang version 12.0.0 (clang-1200.0.32.28)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
➜ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.10.1
➜ stack --version
Version 2.3.3 x86_64
Compiled with:
- Cabal-3.2.0.0
- Glob-0.10.1
- StateVar-1.2
- aeson-1.4.7.1
- annotated-wl-pprint-0.7.0
- ansi-terminal-0.10.3
- ansi-wl-pprint-0.6.9
- array-0.5.4.0
- asn1-encoding-0.9.6
- asn1-parse-0.9.5
- asn1-types-0.3.4
- async-2.2.2
- attoparsec-0.13.2.4
- attoparsec-iso8601-1.0.1.0
- auto-update-0.1.6
- base-4.14.0.0
- base-compat-0.11.1
- base-compat-batteries-0.11.1
- base-orphans-0.8.2
- base16-bytestring-0.1.1.7
- base64-bytestring-1.1.0.0
- basement-0.0.11
- bifunctors-5.5.7
- binary-0.8.8.0
- bitarray-0.0.1.1
- blaze-builder-0.4.1.0
- blaze-html-0.9.1.2
- blaze-markup-0.8.2.7
- bytestring-0.10.10.0
- casa-client-0.0.1
- casa-types-0.0.1
- case-insensitive-1.2.1.0
- cereal-0.5.8.1
- clock-0.8
- colour-2.3.5
- comonad-5.0.6
- conduit-1.3.2
- conduit-combinators-1.3.0
- conduit-extra-1.3.5
- connection-0.3.1
- containers-0.6.2.1
- contravariant-1.5.2
- cookie-0.4.5
- cryptohash-sha256-0.11.101.0
- cryptonite-0.27
- cryptonite-conduit-0.2.2
- data-default-class-0.1.2.0
- deepseq-1.4.4.0
- digest-0.0.1.2
- directory-1.3.6.0
- distributive-0.6.2
- dlist-0.8.0.8
- easy-file-0.2.2
- echo-0.1.3
- ed25519-0.0.5.0
- either-5.0.1.1
- exceptions-0.10.4
- extra-1.7.4
- fast-logger-3.0.1
- file-embed-0.0.13.0
- filelock-0.1.1.5
- filepath-1.4.2.1
- filtrable-0.1.5.0
- fsnotify-0.3.0.1
- generic-deriving-1.13.1
- ghc-boot-th-8.10.1
- ghc-prim-0.6.1
- githash-0.1.4.0
- hackage-security-0.6.0.1
- hashable-1.3.0.0
- hfsevents-0.1.6
- hi-file-parser-0.1.0.0
- hourglass-0.2.12
- hpack-0.34.2
- hpc-0.6.1.0
- http-api-data-0.4.1.1
- http-client-0.7.1
- http-client-tls-0.3.5.3
- http-conduit-2.3.7.3
- http-download-0.2.0.0
- http-types-0.12.3
- infer-license-0.2.0
- integer-gmp-1.0.3.0
- integer-logarithms-1.0.3
- libyaml-0.1.2
- lifted-base-0.2.3.12
- lukko-0.1.1.2
- megaparsec-8.0.0
- memory-0.15.0
- microlens-0.4.11.2
- microlens-mtl-0.2.0.1
- microlens-th-0.4.3.5
- mime-types-0.1.0.9
- mintty-0.1.2
- monad-control-1.0.2.3
- monad-logger-0.3.34
- monad-loops-0.4.3
- mono-traversable-1.0.15.1
- mtl-2.2.2
- mustache-2.3.1
- neat-interpolation-0.5.1.1
- network-3.1.2.0
- network-uri-2.6.3.0
- old-locale-1.0.0.7
- old-time-1.1.0.3
- open-browser-0.2.1.0
- optparse-applicative-0.15.1.0
- optparse-simple-0.1.1.2
- pantry-0.4.0.2
- parsec-3.1.14.0
- parser-combinators-1.2.1
- path-0.8.0
- path-io-1.6.0
- path-pieces-0.2.1
- pem-0.2.4
- persistent-2.10.5.2
- persistent-sqlite-2.10.6.2
- persistent-template-2.8.2.3
- pretty-1.1.3.6
- primitive-0.7.1.0
- process-1.6.8.2
- profunctors-5.5.2
- project-template-0.2.1.0
- random-1.2.0
- regex-applicative-0.3.4
- regex-applicative-text-0.1.0.1
- resource-pool-0.2.3.2
- resourcet-1.2.4.2
- retry-0.8.1.2
- rio-0.1.18.0
- rio-orphans-0.1.1.0
- rio-prettyprint-0.1.1.0
- rts-1.0
- safe-0.3.19
- safe-exceptions-0.1.7.0
- scientific-0.3.6.2
- semigroupoids-5.3.4
- semigroups-0.19.1
- silently-1.2.5.1
- socks-0.6.1
- split-0.2.3.4
- splitmix-0.1.0.1
- stm-2.5.0.0
- stm-chans-3.0.0.4
- streaming-commons-0.2.2.1
- syb-0.7.1
- tagged-0.8.6
- tar-0.5.1.1
- tar-conduit-0.3.2
- template-haskell-2.16.0.0
- temporary-1.3
- text-1.2.3.2
- text-metrics-0.3.0
- th-abstraction-0.3.2.0
- th-expand-syns-0.4.6.0
- th-lift-0.8.1
- th-lift-instances-0.1.17
- th-reify-many-0.1.9
- time-1.9.3
- time-compat-1.9.3
- tls-1.5.4
- transformers-0.5.6.2
- transformers-base-0.4.5.2
- transformers-compat-0.6.5
- typed-process-0.2.6.0
- unicode-transforms-0.3.6
- unix-2.7.2.2
- unix-compat-0.5.2
- unix-time-0.4.7
- unliftio-0.2.13
- unliftio-core-0.2.0.1
- unordered-containers-0.2.12.0
- uuid-types-1.0.3
- vector-0.12.1.2
- vector-algorithms-0.8.0.3
- x509-1.7.5
- x509-store-1.6.7
- x509-system-1.6.6
- x509-validation-1.6.11
- yaml-0.11.4.0
- zip-archive-0.4.1
- zlib-0.6.2.2

Warning: this is an unsupported build that may use different versions of
dependencies and GHC than the officially released binaries, and therefore may
not behave identically.  If you encounter problems, please try the latest
official build by running 'stack upgrade --force-download'.
➜ cabal --version
cabal-install version 3.2.0.0
compiled using version 3.2.0.0 of the Cabal library 

Building it from git also fails

~/github using ☁️  default/research
➜ git clone git@github.com:simonmar/happy.git                                                  
Cloning into 'happy'...
remote: Enumerating objects: 150, done.
remote: Counting objects: 100% (150/150), done.
remote: Compressing objects: 100% (88/88), done.
remote: Total 4430 (delta 83), reused 110 (delta 61), pack-reused 4280
Receiving objects: 100% (4430/4430), 2.06 MiB | 4.61 MiB/s, done.
Resolving deltas: 100% (2601/2601), done.

~/github using ☁️  default/research took 3s 
➜ cd happy              

happy on  master using ☁️  default/research
➜ cabal install                    
cabal: filepath wildcard 'HappyTemplate' does not match any files.

happy on  master using ☁️  default/research took 2s 
➜ make sdist && cabal install
happy  -agc src/Parser.ly -o src/Parser.hs
happy: /Users/xxx/.stack/snapshots/x86_64-osx/3a2c09d838a6e8198c5372d33d3fdf000d8e86db470cdd4211753548149a8db1/8.8.4/share/x86_64-osx-ghc-8.8.4/happy-1.19.12/HappyTemplate-arrays-coerce: openFile: does not exist (No such file or directory)
make: *** [sdist] Error 1

I am pretty new to Haskell so I don't know which infos are relevant and which aren't. If you need some further information, please ask! :)

Ericson2314 commented 3 years ago

This does not look like a happy-specific issue. I would try installing GHC with nixos.org/ on macOS. That has the advantage of being strictly reproducible, while whatever error you have looks quite hard to reproduce.

capital-G commented 3 years ago

Thanks for the quick advice! I got it working on my machine, see https://github.com/kowainik/learn4haskell/issues/373#issuecomment-751281882

I am unsure how to perceed here because as haskell novice I can't say what causes the bug - maybe its already fine that the error is written down here with a fix if anyone else has the problem.