Skip to content

haskellPackages: wrap up loose ends in js context#321004

Merged
maralorn merged 4 commits intoNixOS:haskell-updatesfrom
alexfmpe:ghcjs-wrap-up
Jun 19, 2024
Merged

haskellPackages: wrap up loose ends in js context#321004
maralorn merged 4 commits intoNixOS:haskell-updatesfrom
alexfmpe:ghcjs-wrap-up

Conversation

@alexfmpe
Copy link
Member

@alexfmpe alexfmpe commented Jun 19, 2024

Description of changes

ghcjs-base

$ nix-build -A pkgsCross.ghcjs.haskell.packages.ghc98.ghcjs-base
/nix/store/j82sxhz433yv9nik8knw4wd4jwlv1168-ghcjs-base-0.8.0.1

$ nix-build -A haskell.packages.ghc96.ghcjs-base 
...
Running phase: installPhase
Error: Setup: No executables and no library found. Nothing to do.

Guess it started failing after removing ghcjs-base = null.
Since it's only buildable on JS, I set it as the only supported platform.

Related, turns out the ghcjs-prim = null removal broke old ghcjs eval

$ nix-build -A haskell.packages.ghcjs810.ghcjs-base
...
error: function 'anonymous lambda' called without required argument 'ghcjs-prim'

so I added that back in ghcjs-8.x only.

That fixes the eval errors, but I can't seem to actually build as linking fails on hspec-discover

Linking dist/build/hspec-discover/hspec-discover.jsexe (Main,Paths_hspec_discover)
Running phase: checkPhase
Running 1 test suites...
Test suite spec: RUNNING...
uncaught exception in Haskell main thread: ReferenceError: h$CLOCK_MONOTONIC is not defined
ReferenceError: h$CLOCK_MONOTONIC is not defined
    at h$hspeczmmetazm2zi7zi8zmKLEyatGv3WyFnEfi1EAvPBZCTestziHspecziCoreziClockzigetMonotonicTime2_e (/build/hspec-discover-2.7.10/dist/build/spec/spec:182124:102)
    at h$runThreadSlice (/build/hspec-discover-2.7.10/dist/build/spec/spec:7492:11)
    at h$runThreadSliceCatch (/build/hspec-discover-2.7.10/dist/build/spec/spec:7468:12)
    at h$mainLoop (/build/hspec-discover-2.7.10/dist/build/spec/spec:7463:9)
    at /build/hspec-discover-2.7.10/dist/build/spec/spec:7956:13
    at h$handleErrnoC (/build/hspec-discover-2.7.10/dist/build/spec/spec:5460:9)
    at /build/hspec-discover-2.7.10/dist/build/spec/spec:22758:13
    at FSReqCallback.oncomplete (node:fs:204:21)

Happens on master as well though

ghcjs-websockets

https://hackage.haskell.org/package/ghcjs-websockets was last updated 8 years ago and is deprecated in favor of https://github.com/ghcjs/ghcjs-base/blob/31a85c618a97ce3af3d91bbceb7b0891b0fdab94/JavaScript/Web/WebSocket.hs .
Its only reverse dependency on hackage is acme-everything, so I flagged it as broken by default and unmarked on ghcjs-8.x only. I don't think the compile time errors under new js backend will ever be fixed:

$ nix-build -A pkgsCross.ghcjs.haskell.packages.ghc98.ghcjs-websockets
...
Building library for ghcjs-websockets-0.3.0.5..
[1 of 5] Compiling JavaScript.Blob  ( src/JavaScript/Blob.hs, dist/build/JavaScript/Blob.o )

src/JavaScript/Blob.hs:16:27: error: [GHC-61689]
    Module ‘GHCJS.Foreign’ does not export ‘bufferByteString’.
   |
16 | import GHCJS.Foreign     (bufferByteString)
   |                           ^^^^^^^^^^^^^^^^
[2 of 5] Compiling JavaScript.NoGHCJS ( src/JavaScript/NoGHCJS.hs, dist/build/JavaScript/NoGHCJS.o )
[3 of 5] Compiling JavaScript.WebSockets.FFI ( src/JavaScript/WebSockets/FFI.hs, dist/build/JavaScript/WebSockets/FFI.o )

src/JavaScript/WebSockets/FFI.hs:28:28: error: [GHC-61689]
    Module ‘GHCJS.Types’ does not export ‘JSArray’.
   |
28 | import GHCJS.Types (JSRef, JSArray, JSString, JSObject, JSBool)
   |                            ^^^^^^^

src/JavaScript/WebSockets/FFI.hs:28:47: error: [GHC-61689]
    Module ‘GHCJS.Types’ does not export ‘JSObject’.
   |
28 | import GHCJS.Types (JSRef, JSArray, JSString, JSObject, JSBool)
   |                                               ^^^^^^^^

src/JavaScript/WebSockets/FFI.hs:28:57: error: [GHC-61689]
    Module ‘GHCJS.Types’ does not export ‘JSBool’.
   |
28 | import GHCJS.Types (JSRef, JSArray, JSString, JSObject, JSBool)
   |                                                         ^^^^^^

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added the 6.topic: haskell General-purpose, statically typed, purely functional programming language label Jun 19, 2024
@ofborg ofborg bot added 8.has: clean-up This PR removes packages or removes other cruft 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Jun 19, 2024
@maralorn
Copy link
Member

I am just wondering whether it makes sense to build ghcjs-base. Is it maybe also distributed with ghcjs?

@alexfmpe
Copy link
Member Author

I am just wondering whether it makes sense to build ghcjs-base. Is it maybe also distributed with ghcjs?

Not sure but this seems to be building fine

# Test suite fails; https://github.com/ghcjs/ghcjs-base/issues/133
ghcjs-base = dontCheck (self.callPackage ../compilers/ghcjs/ghcjs-base.nix {
fetchFromGitHub = pkgs.buildPackages.fetchFromGitHub;
aeson = self.aeson_1_5_6_0;
});

and the custom package expression has been here from the start ba25b27#diff-23ecfe4f32ee3203aa1fe2663504d2294c0e4bb69836df5de72003dec50ea62dR21-R23

so maybe not worth touching it for ghcjs itself?

As for the js backend, ghcjs-base is a normal package AFAICT

@maralorn
Copy link
Member

Well then, let‘s do this. Thanks!

@maralorn maralorn merged commit 17d6c23 into NixOS:haskell-updates Jun 19, 2024
@alexfmpe alexfmpe deleted the ghcjs-wrap-up branch June 28, 2024 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: haskell General-purpose, statically typed, purely functional programming language 8.has: clean-up This PR removes packages or removes other cruft 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants