ghcjs / ghcjs-dom

Make Document Object Model (DOM) apps that run in any browser and natively using WebKitGtk
74 stars 41 forks source link

ghcjs-dom-jsffi needs to be explicitly built before building library #87

Open brandonchinn178 opened 5 years ago

brandonchinn178 commented 5 years ago

I'm building a project with stack, and I put ghcjs-dom-jsffi into the extra-deps section. When building stack build --only-dependencies in CI, it was failing with an error like:

    [  1 of 598] Compiling GHCJS.DOM.Types  ( src/GHCJS/DOM/Types.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0_ghcjs/build/GHCJS/DOM/Types.js_o )
    [  2 of 598] Compiling GHCJS.DOM.JSFFI.RTCPeerConnectionError ( src/GHCJS/DOM/JSFFI/RTCPeerConnectionError.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0_ghcjs/build/GHCJS/DOM/JSFFI/RTCPeerConnectionError.js_o )
    [  3 of 598] Compiling GHCJS.DOM.JSFFI.Generated.Enums ( src/GHCJS/DOM/JSFFI/Generated/Enums.hs, .stack-work/dist/x86_64-linux/Cabal-1.24.2.0_ghcjs/build/GHCJS/DOM/JSFFI/Generated/Enums.js_o )
    Cabal-simple_mPHDZzAJ_1.24.2.0_ghcjs-0.2.1.9008011_ghc-8.0.2:
    '/root/.stack/programs/x86_64-linux/ghcjs-0.2.1.9008011_ghc-8.0.2/bin/ghcjs-pkg'
    exited with an error:
    ghcjs-dom-jsffi-0.9.2.0: Warning: haddock-interfaces:
    /tmp/stack69671/ghcjs-dom-jsffi-0.9.2.0/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0_ghcjs/doc/html/ghcjs-dom-jsffi/ghcjs-dom-jsffi.haddock
    doesn't exist or isn't a file
    ghcjs-dom-jsffi-0.9.2.0: Warning: haddock-html:
    /tmp/stack69671/ghcjs-dom-jsffi-0.9.2.0/.stack-work/dist/x86_64-linux/Cabal-1.24.2.0_ghcjs/doc/html/ghcjs-dom-jsffi
    doesn't exist or isn't a directory
    ghcjs-dom-jsffi-0.9.2.0: cannot find any of
    ["GHCJS/DOM.hi","GHCJS/DOM.p_hi","GHCJS/DOM.dyn_hi","GHCJS/DOM.js_hi","GHCJS/DOM.js_p_hi"]
    (use --force to override)

with that cannot find any of [...] error for every module in ghcjs-dom-jsffi. The way I had to mitigate this was to explicitly build stack build ghcjs-dom-jsffi before running stack build --only-dependencies.

I've attached a minimal example script that should be run on a CentOS machine (attached as .txt so github won't complain). Without changes, it should error with the above message. Uncomment line 45 in order to fix the error.

test-ghcjs-dom-jsffi.txt