Ошибка nmake при попытке скомпилировать argon2_elixir - PullRequest
1 голос
/ 10 апреля 2019

Я пытаюсь добавить argon2_elixir в свой проект Phoenix, но я получаю эту ошибку при компиляции:

mix compile
==> argon2_elixir

Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation.  All rights reserved.

makefile(34) : fatal error U1000: syntax error : ')' missing in macro invocation
Stop.
could not compile dependency :argon2_elixir, "mix compile" failed. You can recompile this dependency with "mix deps.compile argon2_elixir", update it with "mix deps.update argon2_elixir" or clean it with "mix deps.clean argon2_elixir"
==> chatter
** (Mix) Could not compile with "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\nmake.exe" (exit status: 2).
One option is to install a recent version of
[Visual C++ Build Tools](http://landinghub.visualstudio.com/visual-cpp-build-tools)
either manually or using [Chocolatey](https://chocolatey.org/) -
`choco install VisualCppBuildTools`.

After installing Visual C++ Build Tools, look in the "Program Files (x86)"
directory and search for "Microsoft Visual Studio". Note down the full path
of the folder with the highest version number. Open the "run" command and
type in the following command (make sure that the path and version number
are correct):

    cmd /K "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64

This should open up a command prompt with the necessary environment variables
set, and from which you will be able to run the "mix compile", "mix deps.compile",
and "mix test" commands.

До этой ошибки ранее упоминалось, как nmake.exe не был найден иустановите это как системную переменную MAKE.Поэтому я вошел в переменные окружения и установил путь к C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\nmake.exe.

Если я открою cmd / powershell следующей командой cmd /K "C:\..." amd64, я должен cd вернуться в проект phoenix.После запуска mix compile / mix deps.compile argon2_elixir выдает ту же ошибку.

Я заметил, что существует закрытая проблема github , но она не имеет решения.

Вот мой файл mix.ex

defmodule Chatter.MixProject do
  use Mix.Project

  def project do
    [
      app: :chatter,
      version: "0.1.0",
      elixir: "~> 1.5",
      elixirc_paths: elixirc_paths(Mix.env()),
      compilers: [:phoenix, :gettext] ++ Mix.compilers(),
      start_permanent: Mix.env() == :prod,
      aliases: aliases(),
      deps: deps()
    ]
  end

  # Configuration for the OTP application.
  #
  # Type `mix help compile.app` for more information.
  def application do
    [
      mod: {Chatter.Application, []},
      extra_applications: [:logger, :runtime_tools, :phoenix, :phoenix_pubsub, :phoenix_html, :cowboy, :logger, :gettext,
      :phoenix_ecto, :postgrex, :comeonin ]
    ]
  end

  # Specifies which paths to compile per environment.
  defp elixirc_paths(:test), do: ["lib", "test/support"]
  defp elixirc_paths(_), do: ["lib"]

  # Specifies your project dependencies.
  #
  # Type `mix help deps` for examples and options.
  defp deps do
    [
      {:phoenix, "~> 1.4.1"},
      {:phoenix_pubsub, "~> 1.1"},
      {:phoenix_ecto, "~> 4.0"},
      {:ecto_sql, "~> 3.0"},
      {:postgrex, ">= 0.0.0"},
      {:phoenix_html, "~> 2.11"},
      {:phoenix_live_reload, "~> 1.2", only: :dev},
      {:gettext, "~> 0.11"},
      {:jason, "~> 1.0"},
      {:plug_cowboy, "~> 2.0"},
      {:comeonin, "~> 5.1.1"},
      {:argon2_elixir, "~> 2.0"}
    ]
  end

  # Aliases are shortcuts or tasks specific to the current project.
  # For example, to create, migrate and run the seeds file at once:
  #
  #     $ mix ecto.setup
  #
  # See the documentation for `Mix` for more info on aliases.
  defp aliases do
    [
      "ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
      "ecto.reset": ["ecto.drop", "ecto.setup"],
      test: ["ecto.create --quiet", "ecto.migrate", "test"]
    ]
  end
end

1 Ответ

1 голос
/ 12 апреля 2019

Вы получаете сообщение об ошибке в строке 34 в Makefile.Предполагается использовать Makefile.win вместо Makefile в Windows, но в этом случае это не так.

Оказывается, что это «особенность» elixir_make.Если используемым исполняемым файлом make является nmake, он использует аргументы /F Makefile.win, в противном случае он не указывает, какой make-файл использовать, и nmake предположительно возвращается к использованию Makefile.Это происходит здесь .

Но поскольку вы устанавливаете переменную окружения MAKE на C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\nmake.exe, это больше не сравнивается равным nmake, и поэтому используется Makefileвместо Makefile.win - и вы получите ошибку.

Я бы предложил две вещи:

  • Вместо установки переменной среды MAKE измените PATH, чтобы включитькаталог, где nmake.exe.
  • Сообщить об ошибке в elixir_make.Вероятно, он должен проверить, имеет ли исполняемый файл, указанный в MAKE, имя файла nmake или nmake.exe независимо от каталога, а не просто сравнивать со строкой "nmake".
...