reflex-frp / reflex-platform

A curated package set and set of tools that let you build Haskell packages so they can run on a variety of platforms. reflex-platform is built on top of the nix package manager.
https://reflex-frp.org
BSD 3-Clause "New" or "Revised" License
721 stars 164 forks source link

Build of `double-conversion` hangs on test suite #534

Closed johannesgerer closed 11 months ago

johannesgerer commented 5 years ago

Running this command in a fresh checkout of reflex-platform (37b7bdd):

nix-build . -A ghcjs.double-conversion

will build fine but then hang on:

running tests
Running 1 test suites...
Test suite tests: RUNNING...

and this process will be running with 0% CPU:

node dist/build/tests/tests

Two issues: 1) It is expected behavior that the test hangs instead of failing?

Reason: When I build and run the test I got the error

uncaught exception in Haskell thread: ReferenceError: h$_hs_ToShortestLength is not defined

which is expected given that these C functions (or JS equivalent) are not availble.

2) Given that the package cannot actually be used as is in GHCJS due to the missing C functions, why did it say it built correctly?

ali-abrar commented 5 years ago

There are a couple of things happening here. The first is that reflex-platform overrides double-conversion for ghcjs by default: https://github.com/reflex-frp/reflex-platform/blob/develop/haskell-overlays/text-jsstring/default.nix#L47-L54

This override uses a fork of double-conversion that avoids the C FFI: https://github.com/obsidiansystems/double-conversion/commit/0f9ddde468687d25fa6c4c9accb02a034bc2f9c3

To build and test locally:

git clone git@github.com:obsidiansystems/double-conversion
cd double-conversion
nix-shell /path/to/reflex-platform -A ghcjs.double-conversion.env
cabal configure --ghcjs
cabal build
cabal test

Alternatively, you can do:

git clone @git@github.com:obsidiansystems/double-conversion
cd double-conversion
/path/to/reflex-platform/scripts/work-on ghcjs ./.
cabal configure --ghcjs
cabal build
cabal test
johannesgerer commented 5 years ago

Thanks.

I ran the tests using your snippet and got the same failure as in my post above.

I had a look at the package and it seems the C functions are not all replaced. The test fails when it tries to find h$_hs_ToShortestLength which is called here.

So this is an issue with double-conversion.

And the second issue also remains: the test is hanging instead of failing when built with nix within the reflex-platform.

ali-abrar commented 11 months ago

double-conversion tests do fail, but they do not hang now. tested on 1.2.0.0 by running nix-build . -A ghcjs.double-conversion