rawhat / mist

gleam HTTP server. because it glistens on a web
Apache License 2.0
260 stars 11 forks source link

Fails to compile on Windows #5

Closed mikeyjones closed 1 year ago

mikeyjones commented 2 years ago

Hi,

I'm the author of Howdy, which wraps a simple API around any webserver the conforms the Geam's HTTP server functions. On lpil's recommendation I moved it from Cowboy to Mist, and all works great when I compile the project on my Mac or Linux, but I'm having an issue with Windows.

If I do the following:

gleam new webtest
cd webtest
gleam add mist
gleam run

It returns this error (Only in Windows):

  Resolving versions
  Compiling mist_server
   Compiled in 0.38s
    Running mist_server.main
=INFO REPORT==== 14-Jun-2022::09:34:31.298000 ===
    application: gleam_http
    exited: stopped
    type: temporary

=INFO REPORT==== 14-Jun-2022::09:34:31.319000 ===
    application: gleeunit
    exited: stopped
    type: temporary

=INFO REPORT==== 14-Jun-2022::09:34:31.319000 ===
    application: gleam_stdlib
    exited: stopped
    type: temporary

exception error: no match of right hand side value
                 {error,{hackney,{"no such file or directory","hackney.app"}}}

I have tried added hackney as a dependency to the project gleam add hackney but it doesn't solve the issue, have you come across this before, and/or do you know a solution to this?

Thanks

Mike

rawhat commented 2 years ago

I'm glad it's working well on those other platforms!

Which version of gleam are you running on Windows? This issue https://github.com/gleam-lang/gleam/pull/1569 I believe was causing the problem. The v0.22 RC just got released, which I think should resolve this error. I was able to get a sample repo built on Windows without the (gleam_)hackney dependency on the newest version.

But please let me know if that doesn't work for you, or you run into any other issues!

mikeyjones commented 2 years ago

I was using v0.21, I have just tried the v0.22-rc1, it gave me the same error but with more detail:

 Compiling unicode_util_compat
===> Compiling unicode_util_compat
  Compiling idna
===> Rebar3 detected a lock file from a newer version. It will be loaded in compatibility mode, but important information may be missing or lost. It is recommended to upgrade Rebar3.
===> Compiling idna
  Compiling ssl_verify_fun
===> Compiling ssl_verify_fun
  Compiling certifi
===> Compiling certifi
  Compiling parse_trans
===> Compiling parse_trans
  Compiling metrics
===> Compiling metrics
  Compiling mimerl
===> Compiling mimerl
  Compiling hackney
===> Rebar3 detected a lock file from a newer version. It will be loaded in compatibility mode, but important information may be missing or lost. It is recommended to upgrade Rebar3.
===> Compiling hackney
===> Compiling src/hackney_ssl.erl failed
src/hackney_ssl.erl:none: undefined parse transform 'ct_expand'

escript: exception error: undefined function erlang:get_stacktrace/0
  in function  rebar3:main/1 (/tmp/cirrus-ci-build/src/rebar3.erl, line 72)
  in call from escript:run/2 (escript.erl, line 750)
  in call from escript:start/1 (escript.erl, line 277)
  in call from init:start_em/1 (init.erl, line 1190)
  in call from init:do_boot/3 (init.erl, line 888)
  Compiling gleam_stdlib
  Compiling gleam_http
  Compiling gleam_hackney
  Compiling gleam_erlang
  Compiling gleam_otp
  Compiling gleeunit
  Compiling glisten
  Compiling mist
  Compiling mist_server
   Compiled in 23.82s
    Running mist_server.main
=INFO REPORT==== 15-Jun-2022::22:40:53.503000 ===
    application: gleam_http
    exited: stopped
    type: temporary

=INFO REPORT==== 15-Jun-2022::22:40:53.527000 ===
    application: gleam_stdlib
    exited: stopped
    type: temporary

exception error: no match of right hand side value
                 {error,{hackney,{"no such file or directory","hackney.app"}}}

Now I know that Hackney is not compiling, the error message makes more sense.

I looked closer at the versions that I'm using on Windows I'm using version 24 of Erlang, but on Mac and Linux I'm using Erlang 25. It seems chocolatey is not as up to date as homebrew. I'll need to spend time installing Erlang and rebar3 on Windows manually and see if that resolves the issue at all.

rawhat commented 2 years ago

Also just to be sure, I would do a gleam clean and rm manifest.toml. I believe I also had some issues with lingering files.

Edit: Also you can remove the gleam_hackney dep from your gleam.toml file. There is currently no way to do that with the build tool, just need to remove that line

mikeyjones commented 2 years ago

Sorry, I haven't had chance to properly test this yet as manually installing Erlang and Rebar3 proved to be painful, I will try and see if I can resolve this soon. I have found another issue that I'll post on a new issue, sorry.

rawhat commented 1 year ago

Just closing this for now. Feel free to reopen if you're able to reproduce!