haskell / haskell-ide-engine

The engine for haskell ide-integration. Not an IDE
BSD 3-Clause "New" or "Revised" License
2.38k stars 212 forks source link

Cabal build fails if documentation is enabled #1693

Closed mouse07410 closed 4 years ago

mouse07410 commented 4 years ago

MacOS Catalina 10.15.3, GHC-8.8.3, current master. ./cabal-hie-install hie-8.8.3 fails if ~/.cabal/config include the line

documentation: True

Here's the log: cabal-build-8.8.3.txt

$ ./cabal-hie-install hie-8.8.3
. . . . .
Resolving dependencies...
Build profile: -w ghc-8.8.3 -O1
In order, the following will be built (use -v for more details):
 - hie-plugin-api-1.2 (lib) (requires build)
 - haskell-ide-engine-1.2 (lib) (requires build)
 - haskell-ide-engine-1.2 (exe:hie-wrapper) (requires build)
 - haskell-ide-engine-1.2 (exe:hie) (requires build)
Starting     hie-plugin-api-1.2 (lib)
Building     hie-plugin-api-1.2 (lib)
Haddock      hie-plugin-api-1.2 (lib)
Warning: Failed to build documentation for hie-plugin-api-1.2 (which is
required by exe:hie-wrapper from haskell-ide-engine-1.2 and exe:hie from
haskell-ide-engine-1.2).
Symlinking 'hie'
Symlinking 'hie-wrapper'
Error when running Shake build system:
  at want, called at src/Development/Shake/Internal/Args.hs:83:69 in shk-0.18.5-78bc9188:Development.Shake.Internal.Args
* Depends on: hie-8.8.3
* Raised the exception:
/Users/ur20980/.cabal/bin/hie: copyFile:atomicCopyFileContents:withReplacementFile:copyFileToHandle:openBinaryFile: does not exist (No such file or directory)

Commenting that line out makes the build succeed: cabal-good-build-8.8.3.txt

$ ./cabal-hie-install hie-8.8.3
. . . . .
Installing   haskell-ide-engine-1.2 (exe:hie-wrapper)
Completed    haskell-ide-engine-1.2 (exe:hie-wrapper)
Installing   haskell-ide-engine-1.2 (exe:hie)
Completed    haskell-ide-engine-1.2 (exe:hie)
Symlinking 'hie-wrapper'
Symlinking 'hie'
Copied executables hie-wrapper, hie, hie-8.8 and hie-8.8.3 to /Users/ur20980/.cabal/bin
Build completed in 1m30s
jneira commented 4 years ago

@mouse07410 it is weird that enable docs caused a warning (that should not make the build fail) and an error trying to access/write the hie executable, previously symlinked (with no errors, right?) Does is exists /Users/ur20980/.cabal/bin/hie after the failing build? are you usins cabal-3.0.0.0 or higher?

jneira commented 4 years ago

I've reproduced the error in windows, or at least it is quite similar:

Copying 'hie.exe'
Warning: Failed to build documentation for hie-plugin-api-1.2 (which is
required by exe:hie-wrapper from haskell-ide-engine-1.2 and exe:hie from
haskell-ide-engine-1.2).
D:\csd\ghc-8.8.3\haskell-ide-e_-1.2-859d42c4bdbc03eea12d889a1f96e6618bcfc994\bin\hie.exe: copyFile:atomicCopyFileContents:withReplacementFile:copyFileToHandle:openBinaryFile: does not exist (No such file or directory)

In my case D:\csd\ghc-8.8.3\haskell-ide-e_-1.2-859d42c4bdbc03eea12d889a1f96e6618bcfc994 does not exist after the build.

It seems a cabal bug but it is hard that it will get patched in the short/medium term. So maybe we could investigate why docs fail for hie-plugin-api

fendor commented 4 years ago

I am on it. Seems like function parameter documentation with -- | is actually not allowed. E.g.

foo
  -- | Int param
  :: Int
  -- | String param
  ->  String 
  -> Int

Should be turned into:

foo 
  :: Int 
  -- ^ Int param
  -> String
  -- ^ String param
  -> Int
mouse07410 commented 4 years ago

Good job, guys! Thank you - problem fixed (verified).