Skip to content

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

@TravisWhitaker

Description

@TravisWhitaker

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions