Open adlaika opened 2 years ago
I've seen someone else have this exact problem, also happening during build of unix-time
. I tried to reproduce with their test case but the issue didn't occur. It looks like Stack is adding the extra-depends
of the main project to the dependencies of unix-time
.
Have you tried wiping ~/.stack
or ~/.cabal
?
oh and which stack version are you using?
oh and which stack version are you using?
2.7.5
https://github.com/qwbarch/ambiguous-prelude
this is the reproducer of the other reporter of this bug, can you verify it happens for you there as well?
just tried again, stack 2.7.5, clean cache. built successfully
https://github.com/qwbarch/ambiguous-prelude
this is the reproducer of the other reporter of this bug, can you verify it happens for you there as well?
I was able to build this project successfully (after accounting for a Mac M1 specific problem that I'm 99% sure is unrelated).
Attempting with the same LTS as my project.
huh!
@qwbarch was using a Debian VM, so it's definitely unrelated to MacOS
do you have a repo I can try?
I've seen someone else have this exact problem, also happening during build of
unix-time
. I tried to reproduce with their test case but the issue didn't occur. It looks like Stack is adding theextra-depends
of the main project to the dependencies ofunix-time
.Have you tried wiping
~/.stack
or~/.cabal
?
Haven't tried this yet, but I did stack clean && stack purge
at least once.
do you have a repo I can try?
I'll try to get you a minimal example after lunch.
Attempting with the same LTS as my project.
This worked as well.
I found this: https://github.com/commercialhaskell/stack/issues/5414
might be worth trying:
$ rm -rf ~/.stack/snapshots/...
$ rm -rf .stack-work
$ stack build unix-time
$ stack build
:sweat_smile: Stack's hermeticity appears to be severely lacking, I guess :slightly_smiling_face:
Yeah, looks like that worked--build is well past that point now. Had to do it again for network
.
oh wow. that's also the package that failed in the linked issue
very curious, given that alternative preludes aren't exactly an exotic concept. wonder if Relude et al. are doing something to prevent that
very curious, given that alternative preludes aren't exactly an exotic concept. wonder if Relude et al. are doing something to prevent that
we use classy-prelude, which exports ClassyPrelude
instead.
oh right
So...now I'm getting:
➜ stack build
Building all executables for `nauvoo' once. After a successful build of all of them, only specified executables will be rebuilt.
nauvoo> build (lib + exe)
Preprocessing library for nauvoo-0.0.0.1..
Building library for nauvoo-0.0.0.1..
[ 15 of 198] Compiling Paths_nauvoo
/Users/adlai/gits/astro/nauvoo/.stack-work/dist/aarch64-osx/Cabal-3.4.1.0/build/autogen/Paths_nauvoo.hs:41:53: error:
Variable not in scope: return :: FilePath -> IO String
|
41 | getBinDir = catchIO (getEnv "nauvoo_bindir") (\_ -> return bindir)
| ^^^^^^
/Users/adlai/gits/astro/nauvoo/.stack-work/dist/aarch64-osx/Cabal-3.4.1.0/build/autogen/Paths_nauvoo.hs:42:53: error:
Variable not in scope: return :: FilePath -> IO String
|
42 | getLibDir = catchIO (getEnv "nauvoo_libdir") (\_ -> return libdir)
| ^^^^^^
/Users/adlai/gits/astro/nauvoo/.stack-work/dist/aarch64-osx/Cabal-3.4.1.0/build/autogen/Paths_nauvoo.hs:43:59: error:
Variable not in scope: return :: FilePath -> IO String
|
43 | getDynLibDir = catchIO (getEnv "nauvoo_dynlibdir") (\_ -> return dynlibdir)
| ^^^^^^
/Users/adlai/gits/astro/nauvoo/.stack-work/dist/aarch64-osx/Cabal-3.4.1.0/build/autogen/Paths_nauvoo.hs:44:55: error:
Variable not in scope: return :: FilePath -> IO String
|
44 | getDataDir = catchIO (getEnv "nauvoo_datadir") (\_ -> return datadir)
| ^^^^^^
/Users/adlai/gits/astro/nauvoo/.stack-work/dist/aarch64-osx/Cabal-3.4.1.0/build/autogen/Paths_nauvoo.hs:45:61: error:
Variable not in scope: return :: FilePath -> IO String
|
45 | getLibexecDir = catchIO (getEnv "nauvoo_libexecdir") (\_ -> return libexecdir)
| ^^^^^^
/Users/adlai/gits/astro/nauvoo/.stack-work/dist/aarch64-osx/Cabal-3.4.1.0/build/autogen/Paths_nauvoo.hs:46:61: error:
Variable not in scope: return :: FilePath -> IO String
|
46 | getSysconfDir = catchIO (getEnv "nauvoo_sysconfdir") (\_ -> return sysconfdir)
| ^^^^^^
/Users/adlai/gits/astro/nauvoo/.stack-work/dist/aarch64-osx/Cabal-3.4.1.0/build/autogen/Paths_nauvoo.hs:51:3: error:
Variable not in scope: return :: [Char] -> IO FilePath
|
51 | return (dir ++ "/" ++ name)
| ^^^^^^
-- While building package nauvoo-0.0.0.1 (scroll up to its section to see the error) using:
/Users/adlai/.stack/setup-exe-cache/aarch64-osx/Cabal-simple_mPHDZzAJ_3.4.1.0_ghc-9.0.2 --builddir=.stack-work/dist/aarch64-osx/Cabal-3.4.1.0 build lib:nauvoo exe:nauvoo exe:nauvoo-integration --ghc-options " -fdiagnostics-color=always"
Process exited with code: ExitFailure 1
...which I assume is the result of not having some Prelude in scope somewhere?
but perhaps is unrelated?
are you using Incipit
as your prelude explicitly, i.e. specifying hiding (Prelude)
for base
?
I'm not suggesting you do that, but if so, you might want to disable the Paths_nauvoo
module with
when:
condition: false
generated-other-modules:
- Paths_nauvoo
in your hpack file
this is a more general issue, discussed frequently on the cabal issue tracker, like here: https://github.com/haskell/cabal/issues/7761
oh right, you're using classy-prelude
. that should apply for that as well, I think
I'm not suggesting you do that, but if so, you might want to disable the
Paths_nauvoo
module withwhen: condition: false generated-other-modules: - Paths_nauvoo
in your hpack file
No luck with either this or the solution from #7761:
library paths-nauvoo
default-language: Haskell2010
build-depends: base
autogen-modules: Paths_nauvoo
exposed-modules: Paths_nauvoo
library
...
build-depends:
...
, paths-nauvoo
...
Is it necessary to wipe ~/.stack
and ~/.cabal
between every attempt?
no, this problem should be local to your project. let's first establish the circumstances – did I understand correctly that you're using classy-prelude, with something like
dependencies:
- name: base
mixin: (hiding Prelude)
- name: classy-prelude
mixin: (ClassyPrelude as Prelude)
Also, nauvoo
is the project you're working on, not a dep?
If so, return
appears to be exported by ClassyPrelude
, which suggests that there is another weird interaction with incipit
caused by stack. If that's the case, I'd definitely have to reevaluate the utility of providing a convienence Prelude
module here.
still strange that this only surfaces for the Paths
module though.
btw my hack for hiding Paths
has to be added to both the library and all executables and tests. you can verify that it works if there is no mention of Paths
in the generated nauvoo.cabal
Sorry, I wasn't clear--we don't use a mixin for classy-prelude
. We just import ClassyPrelude
where needed.
ok, that should have the same effect
And yes--nauvoo
is our project.
btw my hack for hiding
Paths
has to be added to both the library and all executables and tests. you can verify that it works if there is no mention ofPaths
in the generatednauvoo.cabal
I'll try this.
oh, you import ClassyPrelude
when needed? as in, you still use Prelude
from base
by default?
As far as I can tell, there's no mention of Paths
in our nauvoo.cabal
. That makes sense, since I actually generated it via hpack with
dependencies:
...
- paths-nauvoo
verbatim: |
library paths-nauvoo
default-language: Haskell2010
build-depends: base
autogen-modules: Paths_nauvoo
exposed-modules: Paths_nauvoo
...then library
, executable
, and tests
all depend on the top-level dependencies
oh, you import
ClassyPrelude
when needed? as in, you still usePrelude
frombase
by default?
No, we use NoImplicitPrelude
.
(thank you for your time and patience, btw! really appreciate it :) )
I see. so the default-visible Prelude
used by Paths
should definitely be from base
.
In any case, this is pretty bad UX, I will release a new version of all the packages without an exported Prelude
in incipit-*
.
Might take a few days though :)
and thank you for the valuable feedback :smile:
That's awesome! Once polysemy-conc
uses the new version, that'll solve our problem :)
I just noticed the file /home/tek/.ghc/x86_64-linux-9.0.2/environments/default
, seems to be generated by stack and contains a few package ids. That might be the source of the contamination.
hmm. my ~/.ghc/
folder is empty. Maybe because I use ghcup
?
might be!
As far as I can tell, my ~/.ghcup
doesn't contain any equivalent to /home/tek/.ghc/x86_64-linux-9.0.2/environments/default
@adlaika FYI all the libs have been released!
Wow, quick! You rock, thanks so much for all the help :)
please yell if anything still behaves unexpectedly!
Will do--I'm out of town this weekend, but I'll give it a shot on Monday.
On Sat, Jun 11, 2022, 11:50 AM Torsten Schmits @.***> wrote:
please yell if anything still behaves unexpectedly!
— Reply to this email directly, view it on GitHub https://github.com/tek/incipit/issues/1#issuecomment-1152980397, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACB7APJAM6QWX66ZKSZNSOLVOTNV5ANCNFSM5YOVRTVQ . You are receiving this because you were mentioned.Message ID: @.***>
After seeing the following error trying to
stack build
a project that relies onpolysemy-conc
(and thus onincipit-core
)......I tried the README's suggestion in
package.yaml
'sdependencies
block:However, I'm still getting the same error. Is there something I'm missing? Thanks!