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

GHCi only works with Stack with a custom cabal.buildinfo file. #52

Open
TravisWhitaker opened this issue Oct 27, 2017 · 1 comment
Open

Comments

@TravisWhitaker
Copy link
Contributor

When building with cabal or Stack on Windows 10 with GHC 8.2.1, stack ghci and cabal repl both yield:

ghc.EXE:  | C:\Users\Travis\sources\cuda\.stack-work\dist\e53504d9\build\cbits\stubs.o: unknown symbol `cudaConfigureCall'
linking extra libraries/objects failed

Using the generated cabal.buildinfo.generated, which looks like this on my machine:

buildable: True
cc-options: "-DCUDA_INSTALL_PATH=\"C:\\\\Program Files\\\\NVIDIA GPU Computing Toolkit\\\\CUDA\\\\v8.0\""
            "-DCUDA_LIBRARY_PATH=\"C:\\\\Program Files\\\\NVIDIA GPU Computing Toolkit\\\\CUDA\\\\v8.0\\\\lib/x64\""
            "-IC:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v8.0\\include"
ld-options: "-LC:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v8.0\\lib/x64"
extra-libraries:
    cudart
    cuda
extra-ghci-libraries: cudart64_80
                      nvcuda
extra-lib-dirs: "C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v8.0\\lib/x64"
x-extra-c2hs-options: --cppopts=-E --cppopts=-m64 --cppopts=-DUSE_EMPTY_CASE

Strangely, simply copying cuda.buildinfo.generated to cuda.buildinfo, without rebuilding or reconfiguring, allows stack repl to work. I haven't managed to cause a similar effect with any combination of cabal repl, cabal configure, or cabal clean.

stack ghci doesn't seem to work by calling Setup.hs; I verified this by simply adding a putStr before defaultMainWithHooks. I also added prints to getHookedBuildInfo, so I have no idea by what code path Stack is able to read the cuda.buildinfo file (and fail to read the cuda.buildinfo.generated file!).

In practice I doubt anyone is using this library alone in GHCi, but this behavior is very strange and might be some Cabal and/or Stack bug. I'm curious if anyone can manage to reproduce this.

@tmcdonell
Copy link
Owner

So I got a windows box set up, but was unable to reproduce this...

Maybe it doesn't work when running in the same directory? I don't think this will ever work quite right though because most of the files are c2hs files which need to be run through the preprocessor, and ghci isn't going to do that for you whenever you update them...

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