Phoenix: Compilation error on file web/gettext.ex

Created on 22 Oct 2016  路  22Comments  路  Source: phoenixframework/phoenix

Environment

  • Elixir version (elixir -v):
Erlang/OTP 19 [erts-8.1] [source] [64-bit] [smp:4:4] [async-threads:10] [kernel-poll:false]
Elixir 1.3.3
  • Phoenix version (mix deps):
* connection 1.0.4 (Hex package) (mix)
  locked at 1.0.4 (connection) a1cae722
  ok
* fs 0.9.1 (Hex package) (rebar)
  locked at 0.9.2 (fs) ed17036c
  ok
* gettext 0.12.0 (Hex package) (mix)
  locked at 0.12.0 (gettext) 5bea1a94
  ok
* ranch 1.2.1 (Hex package) (rebar)
  locked at 1.2.1 (ranch) a6fb992c
  ok
* poolboy 1.5.1 (Hex package) (rebar)
  locked at 1.5.1 (poolboy) 6b461639
  ok
* decimal 1.2.0 (Hex package) (mix)
  locked at 1.2.0 (decimal) 462960fd
  ok
* poison 2.2.0 (Hex package) (mix)
  locked at 2.2.0 (poison) 4763b69a
  ok
* db_connection 1.0.0 (Hex package) (mix)
  locked at 1.0.0 (db_connection) 63c03e52
  ok
* phoenix_pubsub 1.0.1 (Hex package) (mix)
  locked at 1.0.1 (phoenix_pubsub) c10ddf62
  ok
* cowlib 1.0.2 (Hex package) (rebar)
  locked at 1.0.2 (cowlib) 9d769a1d
  ok
* cowboy 1.0.4 (Hex package) (rebar)
  locked at 1.0.4 (cowboy) a324a8df
  ok
* mime 1.0.1 (Hex package) (mix)
  locked at 1.0.1 (mime) 05c39385
  ok
* plug 1.2.2 (Hex package) (mix)
  locked at 1.2.2 (plug) cfbda521
  ok
* phoenix_html 2.7.0 (Hex package) (mix)
  locked at 2.7.0 (phoenix_html) 19e12e20
  ok
* phoenix 1.2.1 (Hex package) (mix)
  locked at 1.2.1 (phoenix) 6dc59224
  ok
* phoenix_live_reload 1.0.5 (Hex package) (mix)
  locked at 1.0.5 (phoenix_live_reload) 829218c4
  ok
* postgrex 0.12.1 (Hex package) (mix)
  locked at 0.12.1 (postgrex) 2f8b46cb
  ok
* ecto 2.0.5 (Hex package) (mix)
  locked at 2.0.5 (ecto) 7f4c79ac
  ok
* phoenix_ecto 3.0.1 (Hex package) (mix)
  locked at 3.0.1 (phoenix_ecto) 42eb486e
  ok
  • NodeJS version (node -v):
v6.9.1
  • NPM version (npm -v):
3.10.8
  • Operating system:
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:    14.04
Codename:   trusty

Issue

Getting started with phoenix and getting Compilation error on file web/gettext.ex.

mix phoenix.server                                                                                                                                     
==> connection
Compiling 1 file (.ex)
Generated connection app
==> fs (compile)
Compiled src/fs_app.erl
Compiled src/sys/fsevents.erl
Compiled src/fs_server.erl
Compiled src/fs_sup.erl
Compiled src/sys/inotifywait.erl
Compiled src/fs_event_bridge.erl
Compiled src/sys/inotifywait_win32.erl
Compiled src/fs.erl
==> gettext
Compiling 1 file (.yrl)
Compiling 1 file (.erl)
Compiling 20 files (.ex)
Generated gettext app
==> ranch (compile)
Compiled src/ranch_transport.erl
Compiled src/ranch.erl
Compiled src/ranch_protocol.erl
Compiled src/ranch_conns_sup.erl
Compiled src/ranch_sup.erl
Compiled src/ranch_tcp.erl
Compiled src/ranch_ssl.erl
Compiled src/ranch_acceptors_sup.erl
Compiled src/ranch_listener_sup.erl
Compiled src/ranch_app.erl
Compiled src/ranch_acceptor.erl
Compiled src/ranch_server.erl
==> poolboy (compile)
Compiled src/poolboy_worker.erl
Compiled src/poolboy_sup.erl
Compiled src/poolboy.erl
==> decimal
Compiling 1 file (.ex)
Generated decimal app
==> poison
Compiling 4 files (.ex)
Generated poison app
==> db_connection
Compiling 23 files (.ex)
Generated db_connection app
==> phoenix_pubsub
Compiling 12 files (.ex)
Generated phoenix_pubsub app
==> cowlib (compile)
Compiled src/cow_qs.erl
Compiled src/cow_http_te.erl
src/cow_multipart.erl:392: Warning: crypto:rand_bytes/1 is deprecated and will be removed in a future release; use crypto:strong_rand_bytes/1
Compiled src/cow_multipart.erl
Compiled src/cow_cookie.erl
Compiled src/cow_date.erl
Compiled src/cow_http_hd.erl
Compiled src/cow_http.erl
Compiled src/cow_spdy.erl
Compiled src/cow_mimetypes.erl
==> cowboy (compile)
Compiled src/cowboy_sub_protocol.erl
Compiled src/cowboy_middleware.erl
Compiled src/cowboy_loop_handler.erl
Compiled src/cowboy_protocol.erl
Compiled src/cowboy_http.erl
Compiled src/cowboy_bstr.erl
Compiled src/cowboy_static.erl
Compiled src/cowboy_req.erl
Compiled src/cowboy_spdy.erl
Compiled src/cowboy_http_handler.erl
Compiled src/cowboy.erl
Compiled src/cowboy_rest.erl
Compiled src/cowboy_clock.erl
Compiled src/cowboy_websocket_handler.erl
Compiled src/cowboy_router.erl
Compiled src/cowboy_app.erl
Compiled src/cowboy_websocket.erl
Compiled src/cowboy_sup.erl
Compiled src/cowboy_handler.erl
==> mime
Compiling 1 file (.ex)
Generated mime app
==> plug
Compiling 44 files (.ex)
Generated plug app
==> phoenix_html
Compiling 8 files (.ex)
Generated phoenix_html app
==> phoenix
Compiling 60 files (.ex)
Generated phoenix app
==> phoenix_live_reload
Compiling 3 files (.ex)
Generated phoenix_live_reload app
==> postgrex
Compiling 45 files (.ex)
Generated postgrex app
==> ecto
Compiling 68 files (.ex)
Generated ecto app
==> phoenix_ecto
Compiling 4 files (.ex)
Generated phoenix_ecto app
==> blog_phoenix
Compiling 12 files (.ex)

== Compilation error on file web/gettext.ex ==
** (exit) exited in: GenServer.call(Gettext.ExtractorAgent, {:get, #Function<4.87779196/1 in Gettext.ExtractorAgent.extracting?/0>}, 5000)
    ** (EXIT) no process
    (elixir) lib/gen_server.ex:596: GenServer.call/3
    (stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
    (stdlib) erl_eval.erl:269: :erl_eval.expr/5
    (stdlib) erl_eval.erl:122: :erl_eval.exprs/5
    /tmp/blog_phoenix/web/gettext.ex:1: Gettext.Compiler.__before_compile__/1
    (elixir) lib/kernel/parallel_compiler.ex:117: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compilers/1

Steps to reproduce

  1. mix phoenix.new blog_phoenix
  2. cd blog_phoenix
  3. mix phoenix.server

Most helpful comment

Gettext v0.12.1 is out with a fix for this bug, this can be closed 馃憤

All 22 comments

The only other thing that I can think that could have caused this is me running the following:

~/D/E/website 禄 mix local.hex                                                                                                                                                                                                                                                              
Found existing archive: /home/user/.mix/archives/hex-0.12.1.ez.
Are you sure you want to replace it with "https://repo.hex.pm/installs/1.3.0/hex-0.13.2.ez"? [Yn] 
* creating /home/user/.mix/archives/hex-0.13.2
~/D/E/website 禄 mix archive.install https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez                                                                                                                                                                                 
Are you sure you want to install archive "https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez"? [Yn] 
* creating /home/user/.mix/archives/phoenix_new

After locking the version of gettext back to 0.11.0 and running mix deps.get things seem to work as expected.

  defp deps do
    [{:phoenix, "~> 1.2.1"},
     {:phoenix_pubsub, "~> 1.0"},
     {:phoenix_ecto, "~> 3.0"},
     {:postgrex, ">= 0.0.0"},
     {:phoenix_html, "~> 2.6"},
     {:phoenix_live_reload, "~> 1.0", only: :dev},
     {:gettext, "0.11.0"},
     {:cowboy, "~> 1.0"}]
  end

Gettext v0.12.1 is out with a fix for this bug, this can be closed 馃憤

Perfect, thanks @whatyouhide

My bad! Glad @whatyouhide quickly caught it. :)

I'm having the same issue after upgrading my project deps.
On an existing project, my mix.lock reported gettext 0.11.0 and was working on.
Then after update it upgraded to 0.12.1 and I have the same error as the reporter.

My web/gettext.ex is basically empty:

defmodule DtWeb.Gettext do
  @moduledoc """
  A module providing Internationalization with a gettext-based API.

  By using [Gettext](http://hexdocs.pm/gettext),
  your module gains a set of macros for translations, for example:

      import DtWeb.Gettext

      # Simple translation
      gettext "Here is the string to translate"

      # Plural translation
      ngettext "Here is the string to translate",
               "Here are the strings to translate",
               3

      # Domain-based translation
      dgettext "errors", "Here is the error message to translate"

  See the [Gettext Docs](http://hexdocs.pm/gettext) for detailed usage.
  """
  use Gettext, otp_app: :dt_web
end

any hint?

locking to 0.11.0 makes it work again.

@xadhoom what happens if you update and remove _build? Does it work or does it still breaks?

Same.

the error is:

== Compilation error on file web/gettext.ex ==
** (exit) exited in: GenServer.call(Gettext.ExtractorAgent, {:get, #Function<4.87779196/1 in Gettext.ExtractorAgent.extracting?/0>}, 5000)
    ** (EXIT) no process
    (elixir) lib/gen_server.ex:596: GenServer.call/3
    (stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
    (stdlib) erl_eval.erl:269: :erl_eval.expr/5
    (stdlib) erl_eval.erl:122: :erl_eval.exprs/5
    /home/matteo/devel/detectino/apps/dt_web/web/gettext.ex:1: Gettext.Compiler.__before_compile__/1
    (elixir) lib/kernel/parallel_compiler.ex:116: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compilers/1

Tried also fetching again deps (by cleaning deps and _build), but no change.

My mix.lock is: https://gist.github.com/xadhoom/e733395074ae750524afb47491d0f7d5

Using elixir 1.3.2

Oh, it seems you are using an umbrella project. I wonder if that is the root cause. I will investigate.

yes, using an umbrella, sorry for not mentioning it .

@xadhoom i cannot reproduce it. which command are you running that triggers the failure and on which directory?

just a simple: mix do deps.get, deps.compile, compile after the removal of the deps and _build dir

From the umbrella root? or from the application? Do you have an application that depends on the foo_web application or the opposite?

Furthermore, do you have another application that lists gettext as a dependency and changed the list of compilers to compilers: [:gettext] ++ Mix.compilers?

from the umbrella root. and yes, one of the app depends on the other two.

I've pushed all the repo (with mix updates) to here https://github.com/xadhoom/detectino-core/tree/updates

no other project requires gettext.
mmmh about compilers I have compilers: [:phoenix] ++ Mix.compilers, it must be updated ?

mmmh about compilers I have compilers: [:phoenix] ++ Mix.compilers, it must be updated ?

Yes! Try doing [:phoenix, :gettext] ++ Mix.compilers. If that works, I will make sure to provide a decent error message. :)

EDIT: got it, it works :)

Adding both fixed it.

thanks!

@xadhoom have you listed both :gettext and :phoenix in there?

And make sure the :phoenix one comes first (it shouldn't matter though).

yes, I missed "both", now works perfectly. thanks!

Beautiful!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oliverandrich picture oliverandrich  路  3Comments

fertapric picture fertapric  路  3Comments

mcampa picture mcampa  路  3Comments

mmcc picture mmcc  路  3Comments

imranismail picture imranismail  路  4Comments