第1章 安装

原文连接  https://erlang.mk/guide/installation.htmlhtml

 

Chapter 1. Installation

 

1.1. On Unix

Erlang.mk requires GNU Make to be installed. While it will currently work with GNU Make 3.81, support for this version is deprecated and will be removed in 2017. We recommend GNU Make 4.1 or later.git

Git and Erlang/OTP must also be installed.github

Some functionality requires that Autoconf 2.59 or later be installed, in order to compile Erlang/OTP. Erlang/OTP may have further requirements depending on your needs.shell

Some packages may require additional libraries.windows

1.1.1. Linux

The commands to install packages vary between distributions:bash

Arch Linux. less

$ pacman -S erlang git make

 

1.1.2. FreeBSD

FreeBSD comes with binary and source packages:编辑器

Install binary packages. ide

$ pkg install erlang git gmake

 

On FreeBSD the make command is BSD Make. Use gmake instead.post

1.1.3. OS X and macOS

While Apple distributes their own GNU Make, their version is very old and plagued with numerous bugs. It is recommended to install a more recent version from either Homebrew or MacPorts:

Homebrew. 

$ brew install erlang git make

 

Homebrew installs GNU Make as gmake. The make command is the one provided by Apple.

MacPorts. 

$ sudo port install erlang git gmake

 

1.2. On Windows

1.2. 在Windows上

 

Erlang.mk can be used on Windows inside an MSYS2 environment. Cygwin, MSYS (the original) and native Windows (both Batch and PowerShell) are currently not supported.

Erlang.mk能够在安装有MSYS2环境的Windows上使用,暂时不支持在Cygwin,原始的MSYS和windows本地(包括批处理和PowerShell)中直接使用。

 

Note

注意

 

Erlang.mk expects Unix line breaks in most of the files (LF instead of CRLF). Make sure to configure your text editor adequately.

Erlang.mk指望大多数文件是Unix换行符(LF而不是CRLF),请确保文本编辑器的配置是Unix换行符。

 

The rest of this section details how to setup Erlang/OTP and MSYS2 in order to use Erlang.mk.

本节其他部分将详细介绍如何设置 Erlang/OTP 和 MSYS2,以便在Windows下使用Erlang.mk。

 

1.2.1. Installing Erlang/OTP

1.2.1. 安装Erlang/OTP

 

Erlang.mk requires Erlang/OTP to be installed. The OTP team provides binaries of Erlang/OTP for all major and minor releases, available from the official download page. It is recommended that you use the 64-bit installer unless technically impossible. Please follow the instructions from the installer to complete the installation.

使用Erlang.mk必须安装好Erlang/OTP。OTP团队提供全部主板本和次版本的Erlang/OTP二进制文件,可从官方下载页面得到。推荐使用64位安装程序,除非技术上不可行。请按照安装程序的指令完成安装。

 

The OTP team also provides a short guide to installing Erlang/OTP on Windows if you need additional references.

若是你须要额外的参考资料,OTP团队也提供了Windows安装Erlang/OTP的简要指南。

 

You can install Erlang/OTP silently using the /S switch on the command line:

你能够在命令行上使用 /S 开关,静默安装Erlang/OTP:

C:\Users\essen\Downloads> otp_win64_18.0.exe /S

 

1.2.2. Installing MSYS2

1.2.2. 安装MSYS2

 

The only supported environment on Windows is MSYS2. MSYS2 is a lightweight Unix-like environment for Windows that comes with the Arch Linux package manager, pacman.

Erlang.mk在Windows上惟一受到支持的环境是MSYS2。MSYS2是Arch Linux软件包管理器  pacman 附带的一个轻量级类Unix环境。

 

The MSYS2 project provides a one click installer and instructions to set things up post-installation.

MSYS2项目提供了一个单击安装程序,并提供指令来设置安装后的内容。

 

It is currently not possible to use the installer silently. Thankfully, the MSYS2 project provides an archive that can be used in lieu of the installer. The archive however requires 7zip to decompress it.

MSYS2目前没法使用静默安装,值得庆幸的是,MSYS2项目提供了一个可用来代替安装程序的压缩包,这个压缩包须要使用 7zip 来解压。

 

First, download the MSYS2 base archive and extract it under C:\. Assuming you downloaded the archive as msys2.tar.xz and put it in C:\, you can use the following commands to extract it:

首先,下载 MSYS2基础压缩包 并解压到 C:\ 目录。假设你下载了压缩包为 msys2.tar.xz 并将其放在了C:\,你可使用如下命令来提取它:

C:\> 7z x msys2.tar.xz
C:\> 7z x msys2.tar > NUL

 

Then you can run the two commands needed to perform the post-installation setup:

而后你能够运行执行安装后设置所需的两个命令:

C:\> C:\msys64\usr\bin\bash -lc "pacman --needed --noconfirm -Sy bash pacman pacman-mirrors msys2-runtime"
C:\> C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syu"

 

1.2.3. Installing the required MSYS2 packages

1.2.3. 安装所需的MSYS2软件包

 

After following these instructions, you can install GNU Make, Git and any other required softwares. From an MSYS2 shell, you can call pacman directly:

按照这些说明,你能够安装GNU Make,Git和其余所需的软件。在MSYS2 shell下,你能够直接调用 pacman :

$ pacman -S git make

 

You can use pacman -Ss to search packages. For example, to find all packages related to GCC:

你可使用 pacman -Ss 来搜索软件包。例如,要查找与GCC相关的全部软件包:

$ pacman -Ss gcc

 

If you are going to compile C/C++ code, you will need to install this package, as Erlang.mk cannot use the normal "gcc" package:

若是你要编译 C/C++ 代码,你须要安装这个包,由于Erlang.mk不能使用标准“gcc”包:

$ pacman -S mingw-w64-x86_64-gcc

 

You can also run commands under the MSYS2 environment from the Windows command line or batch files. This command will install GNU Make and Git:

你也能够从Windows命令行或批处理文件中让命令运行在MSYS2环境下。 这个命令将安装GNU Make和Git:

C:\> C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S git make"

 

You can use similar bash commands if you need to run programs inside the MSYS2 environment from a batch file.

若是你须要在批处理文件中让程序运行在MSYS2环境下,则可使用相似的 bash 命令。

 

1.2.4. Gotchas

1.2.4. 陷阱

 

While most of the basic functionality will just work, there are still some issues. Erlang.mk needs to be fixed to pass the right paths when running Erlang scripts. We are working on it. Erlang.mk is fully tested on both Linux and Windows, but is lacking tests in the areas not yet covered by this guide, so expect bugs to be fixed as more tests are added.

虽然大部分基本功能都能正常工做,但仍存在一些问题。在运行Erlang脚本时,须要修复Erlang.mk来传递正确的路径,咱们正在解决这个问题。Erlang.mk在Linux和Windows上都获得了充分的测试,可是在本指南还未涵盖的领域缺乏测试,在添加了更多的测试后,但愿bug可以被修复。

相关文章
相关标签/搜索