簡體   English   中英

如何修復在Windows上編譯bcrypt_elixir或argon_elixir的錯誤?

[英]How can one fix error compiling bcrypt_elixir or argon_elixir on windows?

我正在嘗試在elixir / phoenix中創建一個帶有身份驗證的Web應用程序。 嘗試使用mix deps.compile或者混合phx.server編譯argon_elixir或bcrypt_elixir時,我遇到了nmake的錯誤。如何正確配置nmake以便能夠編譯包?

我已經安裝了visual studio和c ++構建工具並將nmake設置為我的路徑。 然后在使用vcvarsall.bat amd64的相應路徑設置命令提示符后運行命令mix deps.compile后,出現以下錯誤:

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

        del /Q /F priv
        erl -eval "io:format(\"~s~n\", [lists:concat([\"ERTS_INCLUDE_PATH=\", code:root_dir(), \"/erts-\", erlang:system_info(version), \"/include\"])])" -s init stop -noshell > Makefile.auto.win
        nmake /                   /F Makefile.win priv\argon2_nif.dll

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

        if NOT EXIST "priv" mkdir "priv"
        cl /O2 /EHsc /I"argon2\include" /I"argon2\src" /I"c:/Program Files/erl10.4/erts-10.4/include" /LD /MD /Fepriv\argon2_nif.dll argon2\src\argon2.c argon2\src\core.c argon2\src\blake2\blake2b.c argon2\src\thread.c argon2\src\encoding.c argon2\src\ref.c c_src\argon2_nif.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.20.27508.1 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

argon2.c
argon2\src\argon2.c(18): fatal error C1083: Cannot open include file: 'string.h': No such file or directory
core.c
argon2\src\core.c(20): fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
blake2b.c
argon2\src\blake2\blake2b.c(19): fatal error C1083: Cannot open include file: 'string.h': No such file or directory
thread.c
d:\elixir\codefountain\deps\argon2_elixir\argon2\src\thread.h(34): fatal error C1083: Cannot open include file: 'process.h': No such file or directory
encoding.c
argon2\src\encoding.c(18): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
ref.c
argon2\src\ref.c(19): fatal error C1083: Cannot open include file: 'string.h': No such file or directory
argon2_nif.c
c_src\argon2_nif.c(26): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
Generating Code...
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\bin\HostX64\x64\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.20.27508\bin\HostX64\x64\nmake.EXE"' : return code '0x2'
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"
==> codefountain
** (Mix) Could not compile with "nmake" (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.

嘗試打開Developer Command Prompt並在該shell中重新運行該命令。 在路徑上擁有nmake本身並不足夠; 編譯器還依賴於需要設置的一些環境變量(例如LIB)。 實際上,您收到的錯誤消息告訴我沒有設置那些環境變量。

Developer Command Prompt設置這些環境變量。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM