LumiGuide / haskell-opencv

Haskell binding to OpenCV-3.x
Other
154 stars 44 forks source link

GHC crashes when building with stack build --fast #72

Open nh2 opened 7 years ago

nh2 commented 7 years ago

When I stack build with a package that has opencv as a dependency like

- location:
    git: https://github.com/chpatrick/haskell-opencv
    commit: 52a3898b95e899609a942245b32a8e5561cb240a
  extra-dep: true

in stack.yml everything runs through nicely.

If then I run stack build --fast I get the utterly disturbing

    Configuring opencv-0.0.0...
    Preprocessing library opencv-0.0.0...
    [29 of 58] Compiling OpenCV.Core.Types.Mat.Internal ( src/OpenCV/Core/Types/Mat/Internal.hs, .stack-work/dist/x86_64-linux-nix-custom-tuneable-addr/Cabal-1.24.0.0/build/OpenCV/Core/Types/Mat/Internal.o ) [flags changed]
    ghc: panic! (the 'impossible' happened)
      (GHC version 8.0.1 for x86_64-unknown-linux):
        Loading temp shared object failed: /run/user/1000/ghc16696_0/libghc_23.so: undefined symbol: inline_c_OpenCV_Exception_Internal_0_9c662f8b58a9de54c461812288a8567063b02b4d

after this has happened, even stack build without --fast doesn't work anymore, I have to stack clean opencv and then stack build works again.

stack build --fast never seems to work, even after a clean.

I have no idea why it happens, but I observed that sometimes (e.g. when I do stack build after stack clean myproject) I get:

➤ stack build 
opencv-0.0.0: unregistering (local file changes: src/OpenCV/Core/Types/Mat/Internal.cpp)
opencv-0.0.0: build
opencv-0.0.0: copy/register
serkezet-0.1.0.0: configure
Configuring myproject...

Where would the local file changes: src/OpenCV/Core/Types/Mat/Internal.cpp come from? Given that I location: haskell-opencv in stack.yml, I don't even have a way to change it, so where do the file changes come from? Maybe these file changes are related to the --fast ghc error?

basvandijk commented 7 years ago

This might be related to: https://github.com/LumiGuide/haskell-opencv/issues/65. Are you running this on Nix? If so, you should try out the latest revision of haskell-opencv.

I don't use stack myself. Does it have a verbosity flag? If so, could you share the output of stack build --fast -v?

nh2 commented 7 years ago

Are you running this on Nix?

@basvandijk No, I was running that without nix.

nh2 commented 7 years ago

This might also be a general inline-c problem. We should check it out again when addCStub support has landed (https://github.com/fpco/inline-c/issues/21#issuecomment-279210548), maybe it helps somehow with this issue.