LoginSignup
14
6

More than 3 years have passed since last update.

Scenicを試してみる(Elixir)

Last updated at Posted at 2020-06-18

はじめに

  • Scenic とは、いまこの時点ではなんのことかさっぱりわかっていません
  • とにかくすごいらしいという噂をいままさに行われているElixirConf EU Virtualでききました
  • Getting Started的なものをやってみます
macOS 10.15.5
elixir         1.10.3-otp-23
erlang         23.0.1 

準備

  1. Erlang, Elixirをインストールしましょう
  2. 依存関係を解決しましょう
    • macOSの場合はHomebrewで以下の感じです
$ brew update
$ brew install glfw3 glew pkg-config

Getting Startedの通りにやってみる

$ mix archive.install hex scenic_new
$ mix scenic.new my_app
$ cd my_app
$ mix deps.get
$ mix scenic.run

スクリーンショット 2020-06-19 0.09.18.png

:tada::tada::tada:

デスクトップアプリケーションがつくれるようです!

Scenic is a client application library written directly on the Elixir/Erlang/OTP stack. With it you can build applications that operate identically across all supported operating systems, including MacOS, Ubuntu, Nerves/Linux, and more.

応急処置的なこと

  • 上記でうまくいくらしいのですが、私はmix scenic.runしたときに発生する以下のエラーをなかなか解決できませんでした
23:59:25.590 [info]  Application my_app exited: MyApp.start(:normal, []) returned an error: shutdown: failed to start child: Scenic
    ** (EXIT) shutdown: failed to start child: Scenic.ViewPort.SupervisorTop
        ** (EXIT) shutdown: failed to start child: :main_viewport
            ** (EXIT) shutdown: failed to start child: Scenic.ViewPort.Driver.Supervisor
                ** (EXIT) an exception was raised:
                    ** (ArgumentError) The module Scenic.Driver.Glfw was given as a child to a supervisor but it does not exist.
                        (elixir) lib/supervisor.ex:629: Supervisor.init_child/1
                        (elixir) lib/enum.ex:1336: Enum."-map/2-lists^map/1-0-"/2
                        (elixir) lib/supervisor.ex:615: Supervisor.init/2
                        (stdlib) supervisor.erl:295: :supervisor.init/1
                        (stdlib) gen_server.erl:374: :gen_server.init_it/2
                        (stdlib) gen_server.erl:342: :gen_server.init_it/6
                        (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
  • 内容としてはScenic.Driver.Glfw can't be found when run mix scenic.run #164と類似していて以下の解決策が示されています

    • 環境変数でMIX_TARGETを指定していたら消しなさい
      • 私はばっちり該当します
      • Nervesをよくあつかうので環境変数にrpi2を入れていました
      • 消してターミナルを起動しなおしても解決せず、、、、 (やり方悪かったのかも)
    • $ mix deps.compile scenic_driver_glfwするといいよ
      • やってみると、そんなの知らんよ (** (Mix) Unknown dependency scenic_driver_glfw for environment dev) といわれる
      • なぜだかコンパイルの対象になっていないようです
      • これは大きな前進です!
      • そして同じような問題にぶち当たったときに問題の切り分けに使えそうです!
  • これらをヒントにmix.exstargets: :hostを消してみました

    • ビンゴ :tada::tada::tada:
mix.exs
  defp deps do
    [
      {:scenic, "~> 0.10"},
      #{:scenic_driver_glfw, "~> 0.10", targets: :host},
      {:scenic_driver_glfw, "~> 0.10"},
    ]
  end

Wrapping Up

  • この記事はScenicを「とりあえず動かしてみました」しかできていません
  • そのため「何がすごいのか」という生で聞いた方たちが興奮されていた部分をお伝えすることはできていません
    • そのうち動画が公開されるとおもうのでそちらをみてみようとおもいます
  • ElixirConf EU Virtualは2019/6/19(日本時間21:00から。プレイベントが20:00から)もあります!
  • Enjoy!
14
6
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
6