jiffy icon indicating copy to clipboard operation
jiffy copied to clipboard

Compilation of Jiffy 1.1.1 fails on Windows 11

Open cynic opened this issue 2 years ago • 3 comments

Environment

  • x64
  • Windows 11 with Visual Studio Build Tools 2019
  • Elixir 1.14.3
  • Erlang/OTP 25

Steps to reproduce

In Developer Command Prompt,

  • Create a new Phoenix project (mix phx.new wut --no-ecto)
  • Add jiffy to the mix.exs file (i.e. append {:jiffy, "~> 1.1"} to deps)
  • Get deps with mix deps.get
  • Build with mix phx.server

Expected

Everything builds and compiles successfully.

Actual

Compilation fails.

C:\Temp\wut>mix phx.server
===> Analyzing applications...
===> Compiling jiffy
===> Compiling c_src/decoder.c
===> Compiling c_src/encoder.c
===> Compiling c_src/jiffy.c
===> Compiling c_src/termstack.c
===> Compiling c_src/utf8.c
===> Compiling c_src/util.c
===> Compiling c_src/doubles.cc
===> Compiling c_src/objects.cc
===> Compiling c_src/double-conversion/bignum-dtoa.cc
===> Compiling c_src/double-conversion/bignum.cc
===> Compiling c_src/double-conversion/cached-powers.cc
===> Compiling c_src/double-conversion/diy-fp.cc
===> Compiling c_src/double-conversion/double-conversion.cc
===> Compiling c_src/double-conversion/fast-dtoa.cc
===> Compiling c_src/double-conversion/fixed-dtoa.cc
===> Compiling c_src/double-conversion/strtod.cc
===> Linking c:/Temp/wut/_build/dev/lib/jiffy/priv/jiffy.dll
===> Missing artifact priv/jiffy.so
** (Mix) Could not compile dependency :jiffy, "escript.exe "c:/Users/cinyc/.mix/elixir/1-14/rebar3" bare compile --paths c:/Temp/wut/_build/dev/lib/*/ebin" command failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile jiffy", update it with "mix deps.update jiffy" or clean it with "mix deps.clean jiffy"

cynic avatar Sep 13 '23 16:09 cynic

Facing the exact same issue

jmSfernandes avatar Feb 16 '24 17:02 jmSfernandes

Wonder if it's the artifacts rebar config: https://github.com/davisp/jiffy/blob/9ea1b35b6e60ba21dfd4adbd18e7916a831fd7d4/rebar.config.script#L57

Maybe on Windows it should be something like:

diff --git a/rebar.config.script b/rebar.config.script
index 007e9b3..cc8f8cc 100644
--- a/rebar.config.script
+++ b/rebar.config.script
@@ -54,7 +54,10 @@ case IsRebar2 of
     false ->
         Config2 ++ [
             {plugins, [{pc, "~> 1.0"}]},
-            {artifacts, ["priv/jiffy.so"]},
+            case os:type() of
+                {win32, _} -> {artifacts, ["priv/jiffy.dll"]};
+                {_, _} -> {artifacts, ["priv/jiffy.so"]}
+            end,
             {provider_hooks, [
                 {post, [
                     {compile, {pc, compile}},

nickva avatar Feb 16 '24 22:02 nickva

Yes it is... I was able to make it work by just replacing the {artifacts, ["priv/jiffy.so"]} with {artifacts, ["priv/jiffy.dll"]} @nickva solution seems perfect in this case

jmSfernandes avatar Feb 18 '24 17:02 jmSfernandes