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

clash-ghc ignores "-package-db" flag #35

Closed
Ericson2314 opened this Issue Nov 12, 2014 · 10 comments

Comments

Projects
None yet
3 participants
@Ericson2314
Contributor

Ericson2314 commented Nov 12, 2014

I am trying to synthesize to VHDL (after using just clash-prelude for a while), and am running into difficulty. Because my school runs Debian and I don't have root, I have a custom compiled copy of ghc + cabal to be less out of date. I used that version of cabal to install clash.

When I ran "clash --interactive " it was unable to find the ghc package database built by cabal, so it couldn't find clash-prelude. I used "-package-db" to point clash to the gh pkgs database. That worked enough for me to successful load the REPL, and simulate my circuit in the REPL (in order to force any of the linking I've seen normal GHCi do lazily).

However when I ran ":vhdl" in the clash REPL, the command threw an exception saying it could not find clash-prelude. It appears then that the clash-specific code run by ":vhdl" does not have access to the extra package databases I specified on the command line with "-package-db".

@christiaanb

This comment has been minimized.

Show comment
Hide comment
@christiaanb

christiaanb Nov 12, 2014

Contributor

So when you do ghc-pkg list, you have three package databases? Or just the global one, and the one in your home directory (usually $HOME/.ghc/x86_64-linux-7.8.3/package.conf.d/)?

Also, when you do: ghc --info and clash --info, are the LibDir and Global Package DB the same?

Contributor

christiaanb commented Nov 12, 2014

So when you do ghc-pkg list, you have three package databases? Or just the global one, and the one in your home directory (usually $HOME/.ghc/x86_64-linux-7.8.3/package.conf.d/)?

Also, when you do: ghc --info and clash --info, are the LibDir and Global Package DB the same?

@christiaanb christiaanb added bug and removed bug labels Nov 12, 2014

@christiaanb christiaanb added this to the 0.5 milestone Nov 12, 2014

@christiaanb christiaanb self-assigned this Nov 12, 2014

@Ericson2314

This comment has been minimized.

Show comment
Hide comment
@Ericson2314

Ericson2314 Nov 12, 2014

Contributor

Ok, so some more details I had forgotten about: My cabal config has user installs disabled, and the package db I was specifying in the command line is what cabal sees as the global db. So the only package dbs are the one installed with ghc, and the one I set up as cabal's global db.

If I run ghc-pkg list, it only picks up the one that came with ghc. ghc --info and clash --info have the same output regarding those two fields, and Global Package DB is (in both) the ghc package db. So yes, if I try to load my file with ghc or clash, both cannot find CLaSH.Prelude unless I specify cabal's package db with the flag. cabal repl or cabal repl --with-ghc=clash feeds that flag automatically, and thus I also get to the REPL that way too.

But again, once I have gotten to the REPL via either clash -package-db=... or cabal repl --with-ghc=clash, and CLaSH.Prelude is definitely loaded, the :vhdl command still cannot find it.

Contributor

Ericson2314 commented Nov 12, 2014

Ok, so some more details I had forgotten about: My cabal config has user installs disabled, and the package db I was specifying in the command line is what cabal sees as the global db. So the only package dbs are the one installed with ghc, and the one I set up as cabal's global db.

If I run ghc-pkg list, it only picks up the one that came with ghc. ghc --info and clash --info have the same output regarding those two fields, and Global Package DB is (in both) the ghc package db. So yes, if I try to load my file with ghc or clash, both cannot find CLaSH.Prelude unless I specify cabal's package db with the flag. cabal repl or cabal repl --with-ghc=clash feeds that flag automatically, and thus I also get to the REPL that way too.

But again, once I have gotten to the REPL via either clash -package-db=... or cabal repl --with-ghc=clash, and CLaSH.Prelude is definitely loaded, the :vhdl command still cannot find it.

@christiaanb

This comment has been minimized.

Show comment
Hide comment
@christiaanb

christiaanb Nov 15, 2014

Contributor

Just wanted to be absolutely sure it was not a configuration problem. Indeed it seems I do not copy the REPL session data to the synthesis session. I hope to fix this after the weekend.

Contributor

christiaanb commented Nov 15, 2014

Just wanted to be absolutely sure it was not a configuration problem. Indeed it seems I do not copy the REPL session data to the synthesis session. I hope to fix this after the weekend.

@echo-oddly

This comment has been minimized.

Show comment
Hide comment
@echo-oddly

echo-oddly Nov 15, 2014

I think this issue is affecting me too. I am running NixOS and CLaSH.Prelude is stored in a non-standard location. So I have to tell clash where it is using -package-db

See NixOS/nixpkgs#4548

echo-oddly commented Nov 15, 2014

I think this issue is affecting me too. I am running NixOS and CLaSH.Prelude is stored in a non-standard location. So I have to tell clash where it is using -package-db

See NixOS/nixpkgs#4548

@christiaanb

This comment has been minimized.

Show comment
Hide comment
@christiaanb

christiaanb Nov 19, 2014

Contributor

The patch for this bug is included in clash-ghc 0.4, which is now released on hackage. Can you check if it resolves your problems?

Contributor

christiaanb commented Nov 19, 2014

The patch for this bug is included in clash-ghc 0.4, which is now released on hackage. Can you check if it resolves your problems?

@Ericson2314

This comment has been minimized.

Show comment
Hide comment
@Ericson2314

Ericson2314 Nov 19, 2014

Contributor

I started to, but then got bogged down converting to clash-prelude 0.6. I'll let you know when I finish.

Contributor

Ericson2314 commented Nov 19, 2014

I started to, but then got bogged down converting to clash-prelude 0.6. I'll let you know when I finish.

@echo-oddly

This comment has been minimized.

Show comment
Hide comment
@echo-oddly

echo-oddly Nov 20, 2014

This resolves my problem

echo-oddly commented Nov 20, 2014

This resolves my problem

@Ericson2314

This comment has been minimized.

Show comment
Hide comment
@Ericson2314

Ericson2314 Dec 2, 2014

Contributor

@christiaanb Sorry for taking so long. This does indeed solve it for me too!

Contributor

Ericson2314 commented Dec 2, 2014

@christiaanb Sorry for taking so long. This does indeed solve it for me too!

@christiaanb

This comment has been minimized.

Show comment
Hide comment
@christiaanb

christiaanb Dec 3, 2014

Contributor

No problem, and thanks for checking it out.

And sorry for the inconvenience brought by the breaking changes of clash-prelude 0.6. There shouldn't be such breaking changes anymore in the foreseeable future.

Contributor

christiaanb commented Dec 3, 2014

No problem, and thanks for checking it out.

And sorry for the inconvenience brought by the breaking changes of clash-prelude 0.6. There shouldn't be such breaking changes anymore in the foreseeable future.

@Ericson2314

This comment has been minimized.

Show comment
Hide comment
@Ericson2314

Ericson2314 Dec 4, 2014

Contributor

Don't worry about 0.6. I had a bunch of other things to do between when I wrote my "bogged down" comment, so converting my code was a really tiny nuscence in the end, and 0.6 is definitely a worthwhile improvement.

Besides, I am always aggressively refactoring things, while whining about the persistence of decades-old interfaces and abstractions. It's about time I had a taste of my own medicine!

Contributor

Ericson2314 commented Dec 4, 2014

Don't worry about 0.6. I had a bunch of other things to do between when I wrote my "bogged down" comment, so converting my code was a really tiny nuscence in the end, and 0.6 is definitely a worthwhile improvement.

Besides, I am always aggressively refactoring things, while whining about the persistence of decades-old interfaces and abstractions. It's about time I had a taste of my own medicine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment