Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'package.cache' conflict with multiple haskell_library deps #7

Closed
jin opened this issue Nov 22, 2017 · 2 comments
Closed

'package.cache' conflict with multiple haskell_library deps #7

jin opened this issue Nov 22, 2017 · 2 comments

Comments

@jin
Copy link
Contributor

jin commented Nov 22, 2017

Take the following example BUILD file from https://github.com/jin/bazel_haskell_example:

haskell_binary(
    name = "main",
    srcs = ["Main.hs"],
    deps = [
	":a",
	":b",
    ],
)

haskell_library(
    name = "a",
    srcs = ["A.hs"],
)


haskell_library(
    name = "b",
    srcs = ["B.hs"],
)

This throws an error:

→ bazel build :main
ERROR: /Users/jin/Code/rules_haskell_conflict_error/BUILD:18:1: generated file 'package.cache' in rule 'b' conflicts with existing generated file from rule 'a', defined at /Users/jin/Code/rules_haskell_conflict_error/BUILD:12:1.
ERROR: error loading package '': Package '' contains errors.
INFO: Elapsed time: 0.051s
@jin
Copy link
Contributor Author

jin commented Nov 22, 2017

I guess the problem is even simpler: having two haskell_library rules in the same package throws the same loading phase error.

haskell_library(
    name = "a",
    srcs = ["A.hs"],
)


haskell_library(
    name = "b",
    srcs = ["B.hs"],
)

@Fuuzetsu
Copy link
Collaborator

Interesting, I wonder if they share directories so it's counting it as same output… Thanks for reporting, it's very much WIP.

Fuuzetsu pushed a commit that referenced this issue Nov 29, 2017
This no longer fails at analysis time but it fails at build-time:
seems the two libraries are sharing build directory and it breaks
things in a nasty way (bazel NPE).
Fuuzetsu pushed a commit that referenced this issue Nov 29, 2017
We suffix all the build directories and files that we make with a
package name and version. As package name is a target name, there can
only be a unique one in single project and we preserve some sanity in
build environment, at least for the directories we declare and pass
around. This allows multiple `haskell_library` and `haskell_binary`
targets in a single package.

Closes #7.
@mboes mboes closed this as completed in d95ae9b Dec 15, 2017
Profpatsch pushed a commit that referenced this issue Mar 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants