tweag / asterius

DEPRECATED in favor of ghc wasm backend, see https://www.tweag.io/blog/2022-11-22-wasm-backend-merged-in-ghc
1.97k stars 58 forks source link

Building error on multi-packages cabal project. #907

Closed freedomhero closed 2 years ago

freedomhero commented 2 years ago

Describe the bug Building error was reported when trying to use on a simple multi-packges cabal project.

The project has two pakcages:

With structure like this:

image

common/common.cabal

cabal-version:      2.4
name:               common
version:            0.1.0.0

library
    exposed-modules:  Common
    build-depends:    base ^>=4.13.0.0
    hs-source-dirs:   ./
    default-language: Haskell2010

aaa.cabal:

cabal-version:      2.4
name:               aaa
version:            0.1.0.0

library
    exposed-modules:  MyLib
    build-depends:    base ^>=4.13.0.0, aeson == 1.4.7.1, common
    hs-source-dirs:   src
    default-language: Haskell2010

executable aaa
    main-is:          Main.hs
    build-depends:
        base ^>=4.13.0.0,
        aaa
    hs-source-dirs:   app
    default-language: Haskell2010

cabal.project:

with-compiler: ghc-8.8.4

packages: ./, common/

To Reproduce Use code from this repo and the recommanded docker image.

git clone https://github.com/freedomhero/aaa
cd aaa
docker run -it --rm -v $(pwd):/workspace -w /workspace terrorjack/asterius
ahc-cabal new-update
ahc-cabal build

Expected behavior Building success was expected as the same as running cabal build, but got error log like this:

Resolving dependencies...
Build profile: -w ghc-8.8.4 -O1
In order, the following will be built (use -v for more details):
 - common-0.1.0.0 (lib) (first run)
 - aaa-0.1.0.0 (lib) (first run)
 - aaa-0.1.0.0 (exe:aaa) (first run)
Configuring library for common-0.1.0.0..
Preprocessing library for common-0.1.0.0..
Building library for common-0.1.0.0..
<command line>: cannot satisfy -package-id base
    (use -v for more information)
cabal: Failed to build common-0.1.0.0 (which is required by exe:aaa from
aaa-0.1.0.0).

ahc-cabal: callProcess: cabal "build" (exit 1): failed

Environment

andreabedini commented 2 years ago

@freedomhero remove with-compiler: ghc-8.8.4 from cabal.project. It is making cabal call ghc-8.8.4 rather than ahc.