eashanhatti/peridot

Linker error

yairchu opened this issue · 0 comments

I tried to build and got a linker error in building konna_editor.

There's no build instructions to follow, so I'll describe what I did.

I created a stack.yaml file:

packages:
- '.'
resolver: lts-18.20
allow-newer: true
extra-deps:
- fused-effects-1.1.1.1@sha256:c029c5fb0b2154281221a71ff25709d2a11347fe061fa8c2398e7fe52a16008d,4932
- syz-0.2.0.0@sha256:7307acb8f6ae7720e7e235c974281ecee912703c1394ebcac19caf83d70bb492,2345

(note that the extra-deps section is verbatim what stack suggests adding when it fails without them)

Then I run

% stack test
...
WARNING: Ignoring konna's bounds on base (>=4.15.0.0 && <4.16); using base-4.14.3.0.
Reason: allow-newer enabled.
base-compat                > using precompiled package
base-orphans               > using precompiled package
...
[12 of 12] Compiling Main
Linking .stack-work/dist/x86_64-osx/Cabal-3.2.1.0/build/konna_compiler/konna_compiler ...
Preprocessing executable 'konna_editor' for konna-0.1.0.0..
Building executable 'konna_editor' for konna-0.1.0.0..
[ 1 of 12] Compiling Elaboration.Error[boot]
[ 2 of 12] Compiling Etc
[ 3 of 12] Compiling Norm[boot]
[ 4 of 12] Compiling Surface
[ 5 of 12] Compiling Parsing
[ 6 of 12] Compiling Var
[ 7 of 12] Compiling Core
[ 8 of 12] Compiling Norm
[ 9 of 12] Compiling Unification
[10 of 12] Compiling Elaboration.Error
[11 of 12] Compiling Elaboration
[12 of 12] Compiling Main
Linking .stack-work/dist/x86_64-osx/Cabal-3.2.1.0/build/konna_editor/konna_editor ...
Undefined symbols for architecture x86_64:
  "_getch", referenced from:
      _Lc2tK3_info in Main.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)
                     
Warning: There were multiple candidates for the Cabal entry Main.hs 
         * /Users/yairchu/dev/src/konna/editor/Main.hs
         * /Users/yairchu/dev/src/konna/compiler/Main.hs 
         picking: /Users/yairchu/dev/src/konna/editor/Main.hs
Completed 27 action(s).

--  While building package konna-0.1.0.0 (scroll up to its section to see the error) using:
      /Users/yairchu/.stack/setup-exe-cache/x86_64-osx/Cabal-simple_mPHDZzAJ_3.2.1.0_ghc-8.10.7 --builddir=.stack-work/dist/x86_64-osx/Cabal-3.2.1.0 build exe:konna_compiler exe:konna_editor --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1

Running on macOS 12.1 on an M1 MacBook Pro using stack v2.7.3.