You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We confirmed this to happen on two different Macs + Github CI for Mac.
Ways to fix it: rename executable to something else, or remove one of the two directories that have the same name as executable.
Expected
I expect project to compile, and it does on Linux, but it does not on Mac.
Actual
What actually happened.
If you suspect that a stack command misbehaved, please include the output of that command in --verbose mode.
If the output is larger than a page please paste the output in a Gist.
$ stack build
Building all executables for `waspc' once. After a successful build of all of them, only specified executables will be rebuilt.
waspc> configure (lib + exe)
Configuring waspc-0.2.2.2...
waspc> build (lib + exe)
Preprocessing library for waspc-0.2.2.2..
Building library for waspc-0.2.2.2..
[1 of 2] Compiling Paths_waspc
[2 of 2] Compiling Wasp.Wasp.Hi
Preprocessing executable 'wasp' for waspc-0.2.2.2..
Building executable 'wasp' for waspc-0.2.2.2..
[1 of 2] Compiling Main
[2 of 2] Compiling Paths_waspc
Linking .stack-work/dist/x86_64-osx/Cabal-3.2.1.0/build/wasp/wasp ...
ld: can't open output file for writing: .stack-work/dist/x86_64-osx/Cabal-3.2.1.0/build/wasp/wasp, errno=21
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`gcc' failed in phase `Linker'. (Exit code: 1)
-- While building package waspc-0.2.2.2 (scroll up to its section to see the error) using:
/Users/matija/.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 lib:waspc exe:wasp --ghc-options " -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
$ stack build --verbose
...
2021-11-11 19:18:19.774230: [info] Preprocessing library for waspc-0.0.0.1..
2021-11-11 19:18:19.774365: [info] Building library for waspc-0.0.0.1..
2021-11-11 19:18:20.387682: [info] Preprocessing executable 'wasp' for waspc-0.0.0.1..
2021-11-11 19:18:20.387790: [info] Building executable 'wasp' for waspc-0.0.0.1..
2021-11-11 19:18:20.876276: [info] Linking .stack-work/dist/x86_64-osx/Cabal-3.2.1.0/build/wasp/wasp ...
2021-11-11 19:18:21.280408: [warn] ld: can't open output file for writing: .stack-work/dist/x86_64-osx/Cabal-3.2.1.0/build/wasp/wasp, errno=21
2021-11-11 19:18:21.285690: [warn] clang: error: linker command failed with exit code 1 (use -v to see invocation)
2021-11-11 19:18:21.287545: [warn] gcc' failed in phase Linker'. (Exit code: 1)
2021-11-11 19:18:21.319877: [debug] Start: getPackageFiles /Users/matija/git/wasp-lang/wasp/waspc/waspc.cabal
2021-11-11 19:18:21.322401: [debug] Failed to decode module interface: /Users/matija/git/wasp-lang/wasp/waspc/.stack-work/dist/x86_64-osx/Cabal-3.2.1.0/build/Paths_waspc.hi Decoding failure: Invalid magic: e49ceb0f
2021-11-11 19:18:21.322555: [debug] Failed to decode module interface: /Users/matija/git/wasp-lang/wasp/waspc/.stack-work/dist/x86_64-osx/Cabal-3.2.1.0/build/Wasp/Wasp/Hi.hi Decoding failure: Invalid magic: e49ceb0f
2021-11-11 19:18:21.323939: [debug] Failed to decode module interface: /Users/matija/git/wasp-lang/wasp/waspc/.stack-work/dist/x86_64-osx/Cabal-3.2.1.0/build/wasp/wasp-tmp/Paths_waspc.hi Decoding failure: Invalid magic: e49ceb0f
2021-11-11 19:18:21.324095: [debug] Failed to decode module interface: /Users/matija/git/wasp-lang/wasp/waspc/.stack-work/dist/x86_64-osx/Cabal-3.2.1.0/build/wasp/wasp-tmp/Main.hi Decoding failure: Invalid magic: e49ceb0f
2021-11-11 19:18:21.324205: [debug] Finished in 4ms: getPackageFiles /Users/matija/git/wasp-lang/wasp/waspc/waspc.cabal
2021-11-11 19:18:21.325389: [error]
-- While building package waspc-0.0.0.1 (scroll up to its section to see the error) using:
/Users/matija/.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 lib:waspc exe:wasp --ghc-options " -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
Stack version
$ stack --version
Version 2.5.1, Git revision d6ab861544918185236cf826cb2028abb266d6d5 x86_64 hpack-0.33.0
Method of installation
homebrew
The text was updated successfully, but these errors were encountered:
@Martinsos, thanks for reporting. As @brandon-leapyear has indicated, I think this arises because the file system on macOs is case-insensitive and there is no distinction made between:
.stack-work/dist/.../build/foo/foo (the executable foo for the package)
.stack-work/dist/.../build/Foo/Foo (the directory for the build artefacts for module Foo.Foo.Something)
The problem is not limited to macOS. On Linux (case-sensitive) with executable Foo, there is no distinction between:
.stack-work/dist/.../build/Foo/Foo (the executable Foo for the package)
.stack-work/dist/.../build/Foo/Foo (the directory for the build artefacts for modules Foo.Foo.Something)
It seems to me to be a feature/bug of Cabal (the library). This Cabal issue (from 2016) appears to be related: haskell/cabal#3545.
Steps to reproduce
Create a project that has executable named "foo" and also has module Foo.Foo.Bar in src/ that executable calls.
I created a minimal example to reproduce it here: https://github.com/wasp-lang/wasp/tree/mac-build-error/waspc .
To try it out, check out https://github.com/wasp-lang/wasp, branch
mac-build-error
and then runstack build
on Mac machine.We confirmed this to happen on two different Macs + Github CI for Mac.
Ways to fix it: rename executable to something else, or remove one of the two directories that have the same name as executable.
Expected
I expect project to compile, and it does on Linux, but it does not on Mac.
Actual
What actually happened.
If you suspect that a stack command misbehaved, please include the output of that command in
--verbose
mode.If the output is larger than a page please paste the output in a Gist.
Stack version
Method of installation
homebrew
The text was updated successfully, but these errors were encountered: