devinus / poolboy

A hunky Erlang worker pool factory
http://github.com/devinus/poolboy
ISC License
1.56k stars 348 forks source link

Is Poolboy supported on Windows? #81

Open ghost opened 8 years ago

ghost commented 8 years ago

I tried using poolboy in my Elixir program on Windows. Mix fails to compile it. Something about rebar.


>mix deps.compile
==> poolboy (compile)
Compiling src/poolboy.erl failed:
src/poolboy.erl:17: type queue() undefined
ERROR: compile failed while processing c:/Users/my_user/Projects/my_app/deps/poolboy: rebar_abort
** (Mix) Could not compile dependency :poolboy, "escript.exe "c:/Users/my_user/.mix/rebar"" command failed. You can recompile this dependency with "mix deps.compile poolboy", update it with "mix deps.update poolboy" or clean it with "mix deps.clean poolboy"

On Mac it complied fine:


$ mix
Could not find "rebar", which is needed to build dependency :poolboy
I can install a local copy which is just used by Mix
Shall I install rebar? [Yn] Y
* creating /Users/my_user/.mix/rebar
==> poolboy (compile)
Compiled src/poolboy_sup.erl
Compiled src/poolboy_worker.erl
Compiled src/poolboy.erl
Compiled lib/my_app.ex
Generated my_app app

Vagabond commented 8 years ago

That's an erlang version difference problem. Your erlang on windows is probably older.

devinus commented 8 years ago

@ejstembler What is your Erlang version on Windows?

Give me the output of erlang:system_info(otp_release).

ghost commented 8 years ago

It looks like both are the same, 18. On my Windows 8 x64 VM:

>erl
Eshell V7.0  (abort with ^G)
1> erlang:system_info(otp_release).
"18"
2>

On my Mac OS X El Capitan:

$ erl
Erlang/OTP 18 [erts-7.1] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Eshell V7.1  (abort with ^G)
1> erlang:system_info(otp_release).
"18"
2> 
OnorioCatenacci commented 8 years ago

This isn't really a bug. You just need to install Rebar on your Windows machine. http://theburningmonk.com/2014/08/getting-started-with-rebar-on-windows/

OnorioCatenacci commented 8 years ago

By the way, Eshell v7.0 is not the same as Eshell v7.1. They're both major version 18 but they're different minor versions.

devinus commented 8 years ago

@OnorioCatenacci Wont mix download rebar automatically if not found?

OnorioCatenacci commented 8 years ago

That's a good question. I'm not sure. I just manually downloaded rebar when I needed it (there was some other dependency in Phoenix that needed rebar at one point).

On Mon, Oct 26, 2015 at 4:00 PM, Devin Torres notifications@github.com wrote:

@OnorioCatenacci https://github.com/OnorioCatenacci Wont mix download rebar automatically if not found?

— Reply to this email directly or view it on GitHub https://github.com/devinus/poolboy/issues/81#issuecomment-151266186.

Onorio Catenacci

http://onor.io http://www.google.com/+OnorioCatenacci

OnorioCatenacci commented 8 years ago

Here's something that may have relevance: https://github.com/elixir-lang/elixir/issues/2152

While the bug mentioned may have been fixed last year it's still worth taking a look at the comments.

ghost commented 8 years ago

@OnorioCatenacci I cloned rebar, compiled it locally, then added it to my path. The output:

C:\Users\my_user\Projects\my_project>mix deps.get
* Getting poolboy (https://github.com/devinus/poolboy.git)
Cloning into 'c:/Users/my_user/Projects/my_project/deps/poolboy'...
remote: Counting objects: 838, done.
Receiving objects: 100% (838/838), 1.83 MiB, done.
Resolving deltas: 100% (404/404), done.
remote: Total 838 (delta 0), reused 0 (delta 0), pack-reused 838

C:\Users\my_user\Projects\my_project>mix
==> poolboy (compile)
src/poolboy.erl:17: type queue() undefined
Compiling src/poolboy.erl failed:
ERROR: compile failed while processing c:/Users/my_user/Projects/my_project/deps/poolboy: rebar_abort
** (Mix) Could not compile dependency :poolboy, "c:/Users/my_user/Projects/rebar/rebar.cmd" command failed. You can recompile this dependency with "mix deps.compile poolboy", update it with "mix deps.update poolboy" or clean it with "mix deps.clean poolboy"
OnorioCatenacci commented 8 years ago

That wouldn't have been the way that I would have suggested to get rebar but no matter. What do you get when you type "rebar" at a command prompt? That's the simplest way to insure rebar is set up and running correctly and in the path.

Onorio

On Tue, Oct 27, 2015 at 9:26 AM, Edward J. Stembler < notifications@github.com> wrote:

I cloned rebar, compiled it locally, then added it to my path. The output:

C:\Users\my_user\Projects\my_project>mix deps.get

  • Getting poolboy (https://github.com/devinus/poolboy.git) Cloning into 'c:/Users/my_user/Projects/my_project/deps/poolboy'... remote: Counting objects: 838, done.�[K Receiving objects: 100% (838/838), 1.83 MiB, done. Resolving deltas: 100% (404/404), done. remote: Total 838 (delta 0), reused 0 (delta 0), pack-reused 838�[K

C:\Users\my_user\Projects\my_project>mix ==> poolboy (compile) src/poolboy.erl:17: type queue() undefined Compiling src/poolboy.erl failed: ERROR: compile failed while processing c:/Users/my_user/Projects/my_project/deps/poolboy: rebar_abort \ (Mix) Could not compile dependency :poolboy, "c:/Users/my_user/Projects/rebar/rebar.cmd" command failed. You can recompile this dependency with "mix deps.compile poolboy", update it with "mix deps.update poolboy" or clean it with "mix deps.clean poolboy"

— Reply to this email directly or view it on GitHub https://github.com/devinus/poolboy/issues/81#issuecomment-151493268.

Onorio Catenacci

http://onor.io http://www.google.com/+OnorioCatenacci

ghost commented 8 years ago

@OnorioCatenacci Well, I followed the instructions on the link you provided on the mailing list.

In any case, typing rebar was the first thing I did after modify my path, and starting a new terminal window. It complains about no parameters and displays the usage:

>rebar
No command to run specified!
Usage: rebar [-h] [-c] [-v <verbose>] [-q <quiet>] [-V] [-f]
...

Also, on Windows I can do a where:

>where rebar
C:\Users\my_user\Projects\rebar\rebar
C:\Users\my_user\Projects\rebar\rebar.cmd
OnorioCatenacci commented 8 years ago

Ok--just to insure we're all playing from the same playbook: type rebar version and post the message. There are a few different versions of rebar available and we can help you better if we can insure we're all working from the same version of rebar.

Also I'd try calling rebar directly (as opposed to calling it from within mix) like so: rebar compile poolboy

From a command prompt within the poolboy directory of course.

All of this is not to say that mix shouldn't work with this but it's easier to isolate the problem if we can find something that does work and then compare that to the non-working path.

Just my suggestions of course.

On Tue, Oct 27, 2015 at 9:46 AM, Edward J. Stembler < notifications@github.com> wrote:

@OnorioCatenacci https://github.com/OnorioCatenacci Well, I followed the instructions on the link you provided http://theburningmonk.com/2014/08/getting-started-with-rebar-on-windows/ on the mailing list.

In any case, typing rebar was the first thing I did after modify my path, and starting a new terminal window. It complains about no parameters and displays the usage:

rebar No command to run specified! Usage: rebar [-h] [-c] [-v ] [-q ] [-V] [-f] ...

Also, on Windows I can do a where:

where rebar C:\Users\my_user\Projects\rebar\rebar C:\Users\my_user\Projects\rebar\rebar.cmd

— Reply to this email directly or view it on GitHub https://github.com/devinus/poolboy/issues/81#issuecomment-151501341.

Onorio Catenacci

http://onor.io http://www.google.com/+OnorioCatenacci

ghost commented 8 years ago

@OnorioCatenacci Sure. Good suggestions. Here's the output:

>rebar version
rebar 2.6.1 18 20151027_131239 git 2.6.1-10-g992dfac
C:\Users\my_user\Projects\my_project\deps\poolboy>rebar compile poolboy
==> poolboy (compile)
src/poolboy.erl:17: type queue() undefined
Compiling src/poolboy.erl failed:
ERROR: compile failed while processing C:/Users/my_user/Projects/my_project/deps/poolboy: rebar_abort

@devinus I'm not privy to the poolboy source, however, where is queue coming from in src/poolboy.erl:16? Is it imported from somewhere?

OnorioCatenacci commented 8 years ago

Devin can comment more on this but I believe this would be the queue in question:

http://www.erlang.org/doc/man/queue.html

One thing though--it looks like the code is thinking Erlang is "pre17"? I mean this:

-ifdef(pre17). -type pid_queue() :: queue(). -else. -type pid_queue() :: queue:queue(). -endif.

I don't think your version of Erlang is pre17 (I'm assuming that's 16 or earlier) in any case so that seems suspect to me. I'd wonder why you're getting that.

I'd also suggest that you check your code path in Erlang. See if you've got a queue.beam file under your Erlang folder. On my machine I have queue.beam at c:\program files\erl7.1\lib\stdlib-2.6\ebin. Erlang/Rebar would be trying to find that queue.beam file (as far as I know).

Onorio

On Tue, Oct 27, 2015 at 10:08 AM, Edward J. Stembler < notifications@github.com> wrote:

@OnorioCatenacci https://github.com/OnorioCatenacci Sure. Good suggestions. Here's the output:

rebar version rebar 2.6.1 18 20151027_131239 git 2.6.1-10-g992dfac

C:\Users\my_user\Projects\my_project\deps\poolboy>rebar compile poolboy ==> poolboy (compile) src/poolboy.erl:17: type queue() undefined Compiling src/poolboy.erl failed: ERROR: compile failed while processing C:/Users/my_user/Projects/my_project/deps/poolboy: rebar_abort

I'm not privy to the poolboy source, however, where is queue coming from in src/poolboy.erl:16 https://github.com/devinus/poolboy/blob/master/src/poolboy.erl#L16? Is it imported from somewhere?

— Reply to this email directly or view it on GitHub https://github.com/devinus/poolboy/issues/81#issuecomment-151507288.

Onorio Catenacci

http://onor.io http://www.google.com/+OnorioCatenacci

ghost commented 8 years ago

Yeah, I do have queue.beam in C:/Program Files/erl7.1/lib/stdlib-2.6/ebin/.

Anyone know how pre17 gets set? It doesn't come up when I search the erlang or rebar repos. I see a reference to in the poolboy's rebar config though: rebar.config:3. I'm not sure what that means, but I found a previously closed issue with the regex: compile fails with erlang 18

devinus commented 8 years ago

@ejstembler You don't have pre17 though, you're on a release of 18. I'm not sure how your release of 18 doesn't have the queue type honestly.

OnorioCatenacci commented 8 years ago

Maybe it's a codepath issue? I forget how to check the codepath. But it seems as if it were a codepath issue he'd be seeing more issues than just poolboy.

On Tue, Oct 27, 2015 at 12:03 PM, Devin Torres notifications@github.com wrote:

@ejstembler https://github.com/ejstembler You don't have pre17 though, you're on a release of 18. I'm not sure how your release of 18 doesn't have the queue type honestly.

— Reply to this email directly or view it on GitHub https://github.com/devinus/poolboy/issues/81#issuecomment-151551663.

Onorio Catenacci

http://onor.io http://www.google.com/+OnorioCatenacci

devinus commented 8 years ago

@ejstembler I'm not sure how you installed Erlang or Elixir, but it seems messed up.

  1. Install Erlang 18.1 64-bit using the installer here: http://www.erlang.org/download.html
  2. Install Elixir 1.1.1 using the installer here: http://elixir-lang.org/install.html
Devin@desktop MINGW64 ~/Projects/poolboy (master)
$ ~/.mix/rebar compile
==> poolboy (compile)
Compiled src/poolboy_sup.erl
Compiled src/poolboy_worker.erl
Compiled src/poolboy.erl
ghost commented 8 years ago

@devinus That's what I had before. However, I uninstalled everything to be safe, rebooted, and re-installed. I used:

Checked the versions from the shells:

>erl
Eshell V7.1  (abort with ^G)
1> erlang:system_info(otp_release).
"18"
>iex --version
Eshell V7.1  (abort with ^G)
Elixir 1.1.1

Wheres:

>where erl
C:\Program Files\erl7.1\bin\erl.exe

>where iex
C:\Program Files (x86)\Elixir\bin\iex
C:\Program Files (x86)\Elixir\bin\iex.bat

I get the same output though:

C:\Users\my_user\Projects\my_project>mix deps.get
* Getting poolboy (https://github.com/devinus/poolboy.git)
Cloning into 'c:/Users/my_user/Projects/my_project/deps/poolboy'...
remote: Counting objects: 838, done.
Receiving objects: 100% (838/838), 1.83 MiB | 2.28 MiB/s, done.
Resolving deltas: 100% (404/404), done.
remote: Total 838 (delta 0), reused 0 (delta 0), pack-reused 838

C:\Users\my_user\Projects\my_project>mix
==> poolboy (compile)
src/poolboy.erl:17: type queue() undefined
Compiling src/poolboy.erl failed:
ERROR: compile failed while processing c:/Users/my_user/Projects/my_projects/deps/poolboy: rebar_abort
** (Mix) Could not compile dependency :poolboy, "c:/Users/my_user/Projects/rebar/rebar.cmd" command failed. You can recompile this dependency with "mix deps.compile poolboy", update it with "mix deps.update poolboy" or clean it with "mix deps.clean poolboy"

I deleted my cloned copy of rebar, and tried again:

C:\Users\my_user\Projects\my_project>mix deps.get
* Getting poolboy (https://github.com/devinus/poolboy.git)
Cloning into 'c:/Users/my_user/Projects/my_project/deps/poolboy'...
remote: Counting objects: 838, done.
Receiving objects: 100% (838/838), 1.83 MiB, done.
Resolving deltas: 100% (404/404), done.
remote: Total 838 (delta 0), reused 0 (delta 0), pack-reused 838

C:\Users\my_user\Projects\my_projects>mix
==> poolboy (compile)
Compiling src/poolboy.erl failed:
src/poolboy.erl:17: type queue() undefined
ERROR: compile failed while processing c:/Users/my_user/Projects/my_project/deps/poolboy: rebar_abort
** (Mix) Could not compile dependency :poolboy, "escript.exe "c:/Users/my_user/.mix/rebar"" command failed. You can recompile this dependency with "mix deps.compile poolboy", update it with "mix deps.update poolboy" or clean it with "mix deps.clean poolboy"

It seems like it's trying to use the version of rebar mix includes. But it fails too.

devinus commented 8 years ago

@ejstembler Try deleting ~/.mix/rebar and doing mix local.rebar.

After that, try cloning poolboy itself and then using ~/.mix/rebar compile and report back.

ghost commented 8 years ago

@devinus Well, I think we're getting closer...

C:\Users\my_user\.mix>rm rebar

C:\Users\my_user\Projects\my_project>mix local.rebar
* creating c:/Users/my_user/.mix/rebar

C:\Users\my_user\Projects\my_project\deps>git clone https://github.com/devinus/poolboy.git
Cloning into 'poolboy'...
remote: Counting objects: 838, done.
Receiving objects: 100% (838/838), 1.83 MiB, done.ack-reused 838 eceiving objects: 100% (838/838)

Resolving deltas: 100% (404/404), done.

C:\Users\my_user\Projects\my_project\deps\poolboy>c:\Users\my_user\.mix\rebar compile
'c:\Users\my_user\.mix\rebar' is not recognized as an internal or external command,
operable program or batch file.

For Windows, should there be a corresponding rebar.bat file? Similar to how there's an iex and iex.bat?

OnorioCatenacci commented 8 years ago

rebar itself is an escript. So yes, you'd need a bat or cmd file or something of that sort to start rebar via escript. Here's mine:

"%PROGRAMFILES%/erl7.1/bin/escript.exe" /ProgramData/Chocolatey/Lib/Rebar3-beta1.3.0/rebar3 %*

On Tue, Oct 27, 2015 at 2:08 PM, Edward J. Stembler < notifications@github.com> wrote:

@devinus https://github.com/devinus Well, I think we're getting closer...

C:\Users\my_user.mix>rm rebar

C:\Users\my_user\Projects\my_project>mix local.rebar

  • creating c:/Users/stemblej/.mix/rebar

C:\Users\my_user\Projects\my_project\deps>git clone https://github.com/devinus/poolboy.git Cloning into 'poolboy'... remote: Counting objects: 838, done. Receiving objects: 100% (838/838), 1.83 MiB, done.ack-reused 838 eceiving objects: 100% (838/838)

Resolving deltas: 100% (404/404), done.

C:\Users\my_user\Projects\my_project\deps\poolboy>c:\Users\my_user.mix\rebar compile 'c:\Users\my_user.mix\rebar' is not recognized as an internal or external command, operable program or batch file.

For Windows, should there be a corresponding rebar.bat file? Similar to how there an iex and ies.bat?

— Reply to this email directly or view it on GitHub https://github.com/devinus/poolboy/issues/81#issuecomment-151591605.

Onorio Catenacci

http://onor.io http://www.google.com/+OnorioCatenacci

ghost commented 8 years ago

@OnorioCatenacci @devinus I got it to work! Thanks for your help Devin and Onorio!

C:\Users\my_user\Projects\my_project\deps\poolboy>c:\Users\my_user\.mix\rebar compile
==> poolboy (compile)
Compiled src/poolboy_sup.erl
Compiled src/poolboy_worker.erl
Compiled src/poolboy.erl

I created a rebar.bat similar to how they do their bootstrap.bat

@echo off
escript.exe rebar %*

So, maybe the issue is that Elixir (or mix?) needs to create that additional rebar.bat file for Windows?

devinus commented 8 years ago

@josevalim Thoughts?

tymoor commented 8 years ago

Was this ever resolved? I'm getting the same error after installing Elixir and Erlang via the elixir-websetup.exe ... it appears that mix is correctly passing rebar to escript:

C:\Users\my_user\example>mix deps.compile poolboy
==> poolboy (compile)
src/poolboy.erl:17: type queue() undefined
Compiling src/poolboy.erl failed:
ERROR: compile failed while processing c:/Users/my_user/example/deps/poolboy: rebar_abort
** (Mix) Could not compile dependency :poolboy, "escript.exe "c:/Users/my_user/.mix/rebar" compile skip_deps=true deps_dir="c:/Users/my_user/example/_build/dev/lib"" command failed. You can recompile this dependency with "mix deps.compile poolboy", update it with "mix deps.update poolboy" or clean it with "mix deps.clean poolboy"

C:\Users\my_user\example>escript.exe "c:\Users\my_user\.mix\rebar" compile skip_deps=true deps_dir="c:\Users\my_user\example\_build\test\lib"
==> example (compile)

C:\Users\my_user\example>

It still fails to run (attempts to compile poolboy again) after running the command manually as above.

C:\Users\my_user\example>escript.exe "c:\Users\my_user\.mix\rebar" compile skip_deps=true deps_dir="c:\Users\my_user\example\_build\test\lib"
==> example (compile)

C:\Users\my_user\example>mix test
==> poolboy (compile)
src/poolboy.erl:17: type queue() undefined
Compiling src/poolboy.erl failed:
ERROR: compile failed while processing c:/Users/my_user/example/deps/poolboy: rebar_abort
** (Mix) Could not compile dependency :poolboy, "escript.exe "c:/Users/my_user/.mix/rebar" compile skip_deps=true deps_dir="c:/Users/my_user/example/_build/test/lib"" command failed. You can recompile this dependency with "mix deps.compile poolboy", update it with "mix deps.update poolboy" or clean it with "mix deps.clean poolboy"

C:\Users\my_user\example>
josevalim commented 8 years ago

What is your Windows, Elixir and Erlang versions? I am confident Poolboy works on Windows, so we need to identify what is missing in your setup.

On Wednesday, September 14, 2016, tymoor notifications@github.com wrote:

Was this ever resolved? I'm getting the same error after installing Elixir and Erlang via the elixir-websetup.exe ... it appears that mix is correctly passing rebar to escript:

`C:\Users\my_user\example>mix deps.compile poolboy ==> poolboy (compile) src/poolboy.erl:17: type queue() undefined Compiling src/poolboy.erl failed: ERROR: compile failed while processing c:/Users/my_user/example/deps/poolboy: rebar_abort \ (Mix) Could not compile dependency :poolboy, "escript.exe "c:/Users/my_user/.mix/rebar" compile skip_deps=true deps_dir="c:/Users/my_user/example/_build/dev/lib"" command failed. You can recompile this dependency with "mix deps.compile poolboy", update it with "mix deps.update poolboy" or clean it with "mix deps.clean poolboy"

C:\Users\my_user\example>escript.exe "c:\Users\my_user.mix\rebar" compile skip_deps=true deps_dir="c:\Users\my_user\example_build\test\lib" ==> example (compile)

C:\Users\my_user\example>`

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/devinus/poolboy/issues/81#issuecomment-246910499, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAlbpbia1-uFQVkdPKhZYQiOdeLymoxks5qp4Z3gaJpZM4GTUrA .

José Valimwww.plataformatec.com.br http://www.plataformatec.com.br/Founder and Director of R&D

josevalim commented 8 years ago

Due to the error, it seems your issue is either an old Poolboy version (try updating it) or an old Erlang version. It seems tone the former.

José Valimwww.plataformatec.com.br http://www.plataformatec.com.br/Founder and Director of R&D

tymoor commented 8 years ago

Yeah, that was it - when I got to the hex page ( [(https://hex.pm/] ) I just copied the ecto tuple it suggests:

Using with Elixir

Simply specify your Mix dependencies as two-item tuples like {:ecto, "~> 0.1.0"} and Elixir will ask if you want to install Hex if you haven't already. After installed, you can run $ mix local to see all available Hex tasks and $ mix help TASK for more information about a specific task.

into my sample program... that tuple is old, and has a dependency on an old version of poolboy.