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

haskell.compiler.ghcHEAD: get JS backend to work #208879

Closed
sternenseemann opened this issue Jan 3, 2023 · 5 comments · Fixed by #209112
Closed

haskell.compiler.ghcHEAD: get JS backend to work #208879

sternenseemann opened this issue Jan 3, 2023 · 5 comments · Fixed by #209112

Comments

@sternenseemann
Copy link
Member

ghcHEAD (and the to be released GHC 9.6) have a JS backend that will replace ghcjs. We should get it to work in order to be able to get rid of the burdensome ghcjs 8.10.7. Ideally we can do this via the already existing pkgsCross.ghcjs infrastructure, but emscripten is proving to be a little annoying, so it may not be entirely possible.

Upstream build instructions.

@sternenseemann
Copy link
Member Author

This is probably blocked on #194634, as the JS backend requires llvm/llvm-project@2368f18.

@nomeata
Copy link
Contributor

nomeata commented Feb 16, 2023

Thanks! Should something like

nix-build -A pkgsCross.ghcjs.haskell.packages.ghcHEAD.colour

work in theory now?

I get these strange errors, as if the build doesn’t include all the necessary files:

~/build/nixpkgs $ nix-build -A pkgsCross.ghcjs.haskell.packages.ghcHEAD.colour
this derivation will be built:
  /nix/store/nvx8yw1yvlvnkz1pinz5v381hmx99ldz-colour-2.3.6.drv
building '/nix/store/nvx8yw1yvlvnkz1pinz5v381hmx99ldz-colour-2.3.6.drv'...
setupCompilerEnvironmentPhase
Build with /nix/store/bks18n98ks2nf1yrg1hn948qnfk5p021-js-unknown-ghcjs-ghc-native-bignum-9.7.20221224.
unpacking sources
unpacking source archive /nix/store/by6hrd83kvcaahw930vimf1qpa3hpms9-colour-2.3.6.tar.gz
source root is colour-2.3.6
setting SOURCE_DATE_EPOCH to timestamp 1624549247 of file colour-2.3.6/Setup.lhs
patching sources
compileBuildDriverPhase
setupCompileFlags: -package-db=/build/tmp.yqbmRKNoNh/setup-package.conf.d -j8 -threaded -rtsopts
[1 of 2] Compiling Main             ( Setup.lhs, /build/tmp.yqbmRKNoNh/Main.o )
[2 of 2] Linking Setup
updateAutotoolsGnuConfigScriptsPhase
configuring
configureFlags: --verbose --prefix=/nix/store/4plkid844gyrrk3piw9dfhgwvf7wxwc8-colour-2.3.6 --libdir=$prefix/lib/$compiler --libsubdir=$abi/$libname --datadir=/nix/store/lms9mp3lw3sxx8mnc1ycgs4skicr3c41-colour-2.3.6-data/share/js-unknown-ghcjs-ghc-9.7.20221224 --docdir=/nix/store/16akxn43xgnxz84k4h5jak2izzfcigw5-colour-2.3.6-doc/share/doc/colour-2.3.6 --package-db=/build/tmp.yqbmRKNoNh/package.conf.d --ghc-options=-j8 --disable-split-objs --enable-library-profiling --profiling-detail=exported-functions --disable-profiling --enable-shared --disable-coverage --enable-static --disable-executable-dynamic --disable-tests --disable-benchmarks --enable-library-vanilla --disable-library-for-ghci --ghc-option=-split-sections --disable-library-stripping --disable-executable-stripping --configure-option=--host=js-unknown-ghcjs --with-ghc=js-unknown-ghcjs-ghc --with-ghc-pkg=js-unknown-ghcjs-ghc-pkg --with-gcc=gcc --hsc2hs-option=--cross-compile --ghc-options=-haddock --extra-include-dirs=/nix/store/0pmahlgrpvlq12l2xlasplpklxlfc6qc-nodejs-slim-18.13.0/include --extra-lib-dirs=/nix/store/0pmahlgrpvlq12l2xlasplpklxlfc6qc-nodejs-slim-18.13.0/lib
Using Parsec parser
Configuring colour-2.3.6...
Warning: Unknown/unsupported 'ghc' version detected (Cabal 3.9.0.0 supports
'ghc' version < 9.6):
/nix/store/bks18n98ks2nf1yrg1hn948qnfk5p021-js-unknown-ghcjs-ghc-native-bignum-9.7.20221224/bin/js-unknown-ghcjs-ghc
is version 9.7.20221224
Dependency base >=4.13 && <5: using base-4.18.0.0
Source component graph: component lib
Configured component graph:
    component colour-2.3.6-CfrQgfI7fGF10h4ygiixhz include base-4.18.0.0
Linked component graph:
    unit colour-2.3.6-CfrQgfI7fGF10h4ygiixhz
        include base-4.18.0.0
        Data.Colour=colour-2.3.6-CfrQgfI7fGF10h4ygiixhz:Data.Colour,Data.Colour.CIE=colour-2.3.6-CfrQgfI7fGF10h4ygiixhz:Data.Colour.CIE,Data.Colour.CIE.Illuminant=colour-2.3.6-CfrQgfI7fGF10h4ygiixhz:Data.Colour.CIE.Illuminant,Data.Colour.Names=colour-2.3.6-CfrQgfI7fGF10h4ygiixhz:Data.Colour.Names,Data.Colour.RGBSpace=colour-2.3.6-CfrQgfI7fGF10h4ygiixhz:Data.Colour.RGBSpace,Data.Colour.RGBSpace.HSL=colour-2.3.6-CfrQgfI7fGF10h4ygiixhz:Data.Colour.RGBSpace.HSL,Data.Colour.RGBSpace.HSV=colour-2.3.6-CfrQgfI7fGF10h4ygiixhz:Data.Colour.RGBSpace.HSV,Data.Colour.SRGB=colour-2.3.6-CfrQgfI7fGF10h4ygiixhz:Data.Colour.SRGB,Data.Colour.SRGB.Linear=colour-2.3.6-CfrQgfI7fGF10h4ygiixhz:Data.Colour.SRGB.Linear
Ready component graph:
    definite colour-2.3.6-CfrQgfI7fGF10h4ygiixhz depends base-4.18.0.0
Using Cabal-3.9.0.0 compiled by ghc-9.7
Using compiler: ghc-9.7.20221224
Using install prefix: /nix/store/4plkid844gyrrk3piw9dfhgwvf7wxwc8-colour-2.3.6
Executables installed in:
/nix/store/4plkid844gyrrk3piw9dfhgwvf7wxwc8-colour-2.3.6/bin
Libraries installed in:
/nix/store/4plkid844gyrrk3piw9dfhgwvf7wxwc8-colour-2.3.6/lib/ghc-9.7.20221224/js-ghcjs-ghc-9.7.20221224/colour-2.3.6-CfrQgfI7fGF10h4ygiixhz
Dynamic Libraries installed in:
/nix/store/4plkid844gyrrk3piw9dfhgwvf7wxwc8-colour-2.3.6/lib/ghc-9.7.20221224/js-ghcjs-ghc-9.7.20221224
Private executables installed in:
/nix/store/4plkid844gyrrk3piw9dfhgwvf7wxwc8-colour-2.3.6/libexec/js-ghcjs-ghc-9.7.20221224/colour-2.3.6
Data files installed in:
/nix/store/lms9mp3lw3sxx8mnc1ycgs4skicr3c41-colour-2.3.6-data/share/js-unknown-ghcjs-ghc-9.7.20221224/js-ghcjs-ghc-9.7.20221224/colour-2.3.6
Documentation installed in:
/nix/store/16akxn43xgnxz84k4h5jak2izzfcigw5-colour-2.3.6-doc/share/doc/colour-2.3.6
Configuration files installed in:
/nix/store/4plkid844gyrrk3piw9dfhgwvf7wxwc8-colour-2.3.6/etc
No alex found
Using ar found on system at:
/nix/store/ahahkszqpjikydq1c8q0c3mm3dzwaxq4-emscripten-3.1.24/bin/emar
No c2hs found
No cpphs found
No doctest found
Using gcc version 11.3.0 given by user at:
/nix/store/iiq295j1z4q1sxmdbrl2j8ma3l5ns4wr-gcc-wrapper-11.3.0/bin/gcc
Using ghc version 9.7.20221224 given by user at:
/nix/store/bks18n98ks2nf1yrg1hn948qnfk5p021-js-unknown-ghcjs-ghc-native-bignum-9.7.20221224/bin/js-unknown-ghcjs-ghc
Using ghc-pkg version 9.7.20221224 given by user at:
/nix/store/bks18n98ks2nf1yrg1hn948qnfk5p021-js-unknown-ghcjs-ghc-native-bignum-9.7.20221224/bin/js-unknown-ghcjs-ghc-pkg
No ghcjs found
No ghcjs-pkg found
No greencard found
Using haddock version 2.27.0 found on system at:
/nix/store/v22q1m99vpi858r2i4mk1jlwgqra1202-ghc-9.7.20221224/bin/haddock
No happy found
Using haskell-suite found on system at: haskell-suite-dummy-location
Using haskell-suite-pkg found on system at: haskell-suite-pkg-dummy-location
No hmake found
Using hpc version 0.68 found on system at:
/nix/store/v22q1m99vpi858r2i4mk1jlwgqra1202-ghc-9.7.20221224/bin/hpc
Using hsc2hs version 0.68.8 found on system at:
/nix/store/v22q1m99vpi858r2i4mk1jlwgqra1202-ghc-9.7.20221224/bin/hsc2hs
Using hscolour version 1.24 found on system at:
/nix/store/2s44cidcf8fsa0qs02iw4gx4q7x7lxgb-hscolour-1.24.4/bin/HsColour
No jhc found
Using ld found on system at:
/nix/store/ahahkszqpjikydq1c8q0c3mm3dzwaxq4-emscripten-3.1.24/bin/emcc
No pkg-config found
Using runghc version 9.7.20221224 found on system at:
/nix/store/v22q1m99vpi858r2i4mk1jlwgqra1202-ghc-9.7.20221224/bin/runghc
Using strip version 2.39 found on system at:
/nix/store/iiq295j1z4q1sxmdbrl2j8ma3l5ns4wr-gcc-wrapper-11.3.0/bin/strip
Using tar found on system at:
/nix/store/g4qrlj5kr7iwcr81jsm1p55vk0z9rh0z-gnutar-1.34/bin/tar
No uhc found
building
Preprocessing library for colour-2.3.6..
Building library for colour-2.3.6..
[ 1 of 14] Compiling Data.Colour.CIE.Chromaticity ( Data/Colour/CIE/Chromaticity.hs, dist/build/Data/Colour/CIE/Chromaticity.o, dist/build/Data/Colour/CIE/Chromaticity.dyn_o )

Data/Colour/CIE/Chromaticity.hs:23:8: error:
    Failed to load dynamic interface file for Prelude:
    Bad interface file: /nix/store/bks18n98ks2nf1yrg1hn948qnfk5p021-js-unknown-ghcjs-ghc-native-bignum-9.7.20221224/lib/js-unknown-ghcjs-ghc-9.7.20221224/lib/../lib/js-ghcjs-ghc-9.7.20221224/base-4.18.0.0/Prelude.dyn_hi
        /nix/store/bks18n98ks2nf1yrg1hn948qnfk5p021-js-unknown-ghcjs-ghc-native-bignum-9.7.20221224/lib/js-unknown-ghcjs-ghc-9.7.20221224/lib/../lib/js-ghcjs-ghc-9.7.20221224/base-4.18.0.0/Prelude.dyn_hi: withBinaryFile: does not exist (No such file or directory)
   |
23 | module Data.Colour.CIE.Chromaticity where
   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ 3 of 14] Compiling Data.Colour.Chan ( Data/Colour/Chan.hs, dist/build/Data/Colour/Chan.o, dist/build/Data/Colour/Chan.dyn_o )

Data/Colour/Chan.hs:27:1: error:
    Failed to load dynamic interface file for Data.List:
    Bad interface file: /nix/store/bks18n98ks2nf1yrg1hn948qnfk5p021-js-unknown-ghcjs-ghc-native-bignum-9.7.20221224/lib/js-unknown-ghcjs-ghc-9.7.20221224/lib/../lib/js-ghcjs-ghc-9.7.20221224/base-4.18.0.0/Data/List.dyn_hi
        /nix/store/bks18n98ks2nf1yrg1hn948qnfk5p021-js-unknown-ghcjs-ghc-native-bignum-9.7.20221224/lib/js-unknown-ghcjs-ghc-9.7.20221224/lib/../lib/js-ghcjs-ghc-9.7.20221224/base-4.18.0.0/Data/List.dyn_hi: withBinaryFile: does not exist (No such file or directory)
   |
27 | import qualified Data.List (sum)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ 5 of 14] Compiling Data.Colour.Matrix ( Data/Colour/Matrix.hs, dist/build/Data/Colour/Matrix.o, dist/build/Data/Colour/Matrix.dyn_o )

Data/Colour/Matrix.hs:25:19: error:
    Module ‘Data.List’ does not export ‘transpose’
   |
25 | import Data.List (transpose)
   |                   ^^^^^^^^^

@sternenseemann
Copy link
Member Author

@nomeata Interesting! We should find out if it is possible to build “dynamic” js objects or not with the JS backend – if not, we simply need to disable building shared objects for the js backend in generic-builder.nix which I may have neglected.

@sternenseemann
Copy link
Member Author

@nomeata We get further with #217168, but then hit llvm/llvm-project#60949.

@sternenseemann
Copy link
Member Author

@nomeata The JS backend can only build executables at the moment: https://gitlab.haskell.org/ghc/ghc/-/issues/23235#note_491474

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants