Skip to content

Internal libraries does not work if there's no main library #3787

Closed
@deyaaeldeen

Description

@deyaaeldeen

General summary/comments (optional)

Internal libraries does not work.

Steps to reproduce

$ cat foo.cabal
-- Initial foo.cabal generated by cabal init.  For further documentation,
-- see http://haskell.org/cabal/users-guide/

name:                foo
version:             0.1.0.0
-- synopsis:
-- description:
license:             BSD3
license-file:        LICENSE
author:              Deyaa
maintainer:          diaa6510@gmail.com
-- copyright:
-- category:
build-type:          Simple
extra-source-files:  ChangeLog.md
cabal-version:       >=1.10

library internal-foo
  build-depends:       base >=4.10 && <4.11
  default-language:    Haskell2010

$ cat stack.yaml
flags: {}
packages:
- '.'
extra-deps:
resolver: lts-10.3

Expected

it to build fine.

Actual

$ stack build --verbose
2018-01-17 13:18:07.100419: [debug] Checking for project config at: /Users/dalmahal-admin/Downloads/foo/stack.yaml
@(Stack/Config.hs:842:9)
2018-01-17 13:18:07.101739: [debug] Loading project config file stack.yaml
@(Stack/Config.hs:868:13)
2018-01-17 13:18:07.104077: [debug] Decoding build plan from: /Users/dalmahal-admin/.stack/build-plan/lts-10.3.yaml
@(Stack/Snapshot.hs:150:5)
2018-01-17 13:18:07.104190: [debug] Trying to decode /Users/dalmahal-admin/.stack/build-plan-cache/lts-10.3.cache
@(Data/Store/VersionTagged.hs:66:5)
2018-01-17 13:18:07.110259: [debug] Success decoding /Users/dalmahal-admin/.stack/build-plan-cache/lts-10.3.cache
@(Data/Store/VersionTagged.hs:70:13)
2018-01-17 13:18:07.110931: [debug] Using standard GHC build
@(Stack/Setup.hs:617:9)
2018-01-17 13:18:07.111229: [debug] Getting global package database location
@(Stack/GhcPkg.hs:46:5)
2018-01-17 13:18:07.111444: [debug] Asking GHC for its version
@(Stack/Setup/Installed.hs:98:13)
2018-01-17 13:18:07.111709: [debug] Run process: /Users/dalmahal-admin/.stack/programs/x86_64-osx/ghc-8.2.2/bin/ghc --numeric-version
@(System/Process/Log.hs:37:3)
2018-01-17 13:18:07.113626: [debug] Getting Cabal package version
@(Stack/GhcPkg.hs:185:5)
2018-01-17 13:18:07.113941: [debug] Run process: /Users/dalmahal-admin/.stack/programs/x86_64-osx/ghc-8.2.2/bin/ghc-pkg --no-user-package-db list --global
@(System/Process/Log.hs:37:3)
2018-01-17 13:18:07.114039: [debug] Run process: /Users/dalmahal-admin/.stack/programs/x86_64-osx/ghc-8.2.2/bin/ghc-pkg --no-user-package-db field --simple-output Cabal version
@(System/Process/Log.hs:37:3)
2018-01-17 13:18:07.176911: [debug] Process finished in 62ms: /Users/dalmahal-admin/.stack/programs/x86_64-osx/ghc-8.2.2/bin/ghc-pkg --no-user-package-db list --global
@(System/Process/Log.hs:44:3)
2018-01-17 13:18:07.177389: [debug] Process finished in 57ms: /Users/dalmahal-admin/.stack/programs/x86_64-osx/ghc-8.2.2/bin/ghc-pkg --no-user-package-db field --simple-output Cabal version
@(System/Process/Log.hs:44:3)
2018-01-17 13:18:07.200553: [debug] Process finished in 88ms: /Users/dalmahal-admin/.stack/programs/x86_64-osx/ghc-8.2.2/bin/ghc --numeric-version
@(System/Process/Log.hs:44:3)
2018-01-17 13:18:07.200766: [debug] GHC version is: ghc-8.2.2
@(Stack/Setup/Installed.hs:102:13)
2018-01-17 13:18:07.200895: [debug] Resolving package entries
@(Stack/Setup.hs:250:5)
2018-01-17 13:18:07.201035: [debug] Trying to decode /Users/dalmahal-admin/.stack/loaded-snapshot-cache/x86_64-osx/ghc-8.2.2/lts-10.3.cache
@(Data/Store/VersionTagged.hs:66:5)
2018-01-17 13:18:07.248768: [debug] Success decoding /Users/dalmahal-admin/.stack/loaded-snapshot-cache/x86_64-osx/ghc-8.2.2/lts-10.3.cache
@(Data/Store/VersionTagged.hs:70:13)
2018-01-17 13:18:07.249178: [debug] Starting to execute command inside EnvConfig
@(Stack/Runners.hs:170:18)
2018-01-17 13:18:07.249475: [debug] Parsing the targets
@(Stack/Build/Target.hs:460:3)
2018-01-17 13:18:07.283784: [debug] Exception ignored when attempting to load /Users/dalmahal-admin/Downloads/foo/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/stack-build-cache: /Users/dalmahal-admin/Downloads/foo/.stack-work/dist/x86_64-osx/Cabal-2.0.1.0/stack-build-cache: openBinaryFile: does not exist (No such file or directory)
@(Data/Store/VersionTagged.hs:84:9)
Package has buildable sublibraries but no buildable libraries, I'm giving up
CallStack (from HasCallStack):
  error, called at src/Stack/Package.hs:281:30 in stack-1.6.3-J1I753MGXoT93WwgNHFXcA:Stack.Package

Stack version

$ stack --version
Version 1.6.3 x86_64 hpack-0.20.0

$ cabal --version
cabal-install version 2.0.0.0
compiled using version 2.0.0.2 of the Cabal library

$ sw_vers                                                                                                                                                                                               
ProductName:    Mac OS X
ProductVersion: 10.12.6
BuildVersion:   16G1114

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions