Versioning

Solidity versions follow semantic versioning and in addition to releases, nightly development builds are also made available. The nightly builds are not guaranteed to be working and despite best efforts they might contain undocumented and/or broken changes. We recommend using the latest release. Package installers below will use the latest release.

Remix

We recommend Remix for small contracts and for quickly learning Solidity.

Access Remix online, you do not need to install anything. If you want to use it without connection to the Internet, go to https://github.com/ethereum/remix-live/tree/gh-pages and download the .zip file as explained on that page. Remix is also a convenient option for testing nightly builds without installing multiple Solidity versions.

Further options on this page detail installing commandline Solidity compiler software on your computer. Choose a commandline compiler if you are working on a larger contract or if you require more compilation options.

npm / Node.js

Use npm for a convenient and portable way to install solcjs, a Solidity compiler. The solcjs program has fewer features than the ways to access the compiler described further down this page. The Using the Commandline Compiler documentation assumes you are using the full-featured compiler, solc. The usage of solcjs is documented inside its own repository.

Note: The solc-js project is derived from the C++ solc by using Emscripten which means that both use the same compiler source code. solc-js can be used in JavaScript projects directly (such as Remix). Please refer to the solc-js repository for instructions.

npm install -g solc

Note

The commandline executable is named solcjs.

The comandline options of solcjs are not compatible with solc and tools (such as geth) expecting the behaviour of solc will not work with solcjs.

Docker

Docker images of Solidity builds are available using the solc image from the ethereum organisation. Use the stable tag for the latest released version, and nightly for potentially unstable changes in the develop branch.

The Docker image runs the compiler executable, so you can pass all compiler arguments to it. For example, the command below pulls the stable version of the solc image (if you do not have it already), and runs it in a new container, passing the --help argument.

docker run ethereum/solc:stable --help

You can also specify release build versions in the tag, for example, for the 0.5.4 release.

docker run ethereum/solc:0.5.4 --help

To use the Docker image to compile Solidity files on the host machine mount a local folder for input and output, and specify the contract to compile. For example.

docker run -v /local/path:/sources ethereum/solc:stable -o /sources/output --abi --bin /sources/Contract.sol

You can also use the standard JSON interface (which is recommended when using the compiler with tooling). When using this interface it is not necessary to mount any directories.

docker run ethereum/solc:stable --standard-json < input.json > output.json

Binary Packages

Binary packages of Solidity are available at solidity/releases.

We also have PPAs for Ubuntu, you can get the latest stable version using the following commands:

sudo add-apt-repository ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install solc

The nightly version can be installed using these commands:

sudo add-apt-repository ppa:ethereum/ethereum
sudo add-apt-repository ppa:ethereum/ethereum-dev
sudo apt-get update
sudo apt-get install solc

We are also releasing a snap package, which is installable in all the supported Linux distros. To install the latest stable version of solc:

sudo snap install solc

If you want to help testing the latest development version of Solidity with the most recent changes, please use the following:

sudo snap install solc --edge

Arch Linux also has packages, albeit limited to the latest development version:

pacman -S solidity

We distribute the Solidity compiler through Homebrew as a build-from-source version. Pre-built bottles are currently not supported.

brew update
brew upgrade
brew tap ethereum/ethereum
brew install solidity

To install the most recent 0.4.x version of Solidity you can also use brew install solidity@4.

If you need a specific version of Solidity you can install a Homebrew formula directly from Github.

View solidity.rb commits on Github.

Follow the history links until you have a raw file link of a specific commit of solidity.rb.

Install it using brew:

brew unlink solidity
# eg. Install 0.4.8
brew install https://raw.githubusercontent.com/ethereum/homebrew-ethereum/77cce03da9f289e5a3ffe579840d3c5dc0a62717/solidity.rb

Gentoo Linux also provides a solidity package that can be installed using emerge:

emerge dev-lang/solidity

Building from Source

Prerequisites - All Operating Systems

The following are dependencies for all builds of Solidity:

Software Notes
CMake (version 3.5+) Cross-platform build file generator.
Boost (version 1.65+) C++ libraries.
Git Command-line tool for retrieving source code.
z3 (version 4.6+, Optional) For use with SMT checker.
cvc4 (Optional) For use with SMT checker.

Note

Solidity versions prior to 0.5.10 can fail to correctly link against Boost versions 1.70+. A possible workaround is to temporarily rename <Boost install path>/lib/cmake/Boost-1.70.0 prior to running the cmake command to configure solidity.

Starting from 0.5.10 linking against Boost 1.70+ should work without manual intervention.

Minimum compiler versions

The following C++ compilers and their minimum versions can build the Solidity codebase:

Prerequisites - macOS

For macOS builds, ensure that you have the latest version of Xcode installed. This contains the Clang C++ compiler, the Xcode IDE and other Apple development tools which are required for building C++ applications on OS X. If you are installing Xcode for the first time, or have just installed a new version then you will need to agree to the license before you can do command-line builds:

sudo xcodebuild -license accept

Our OS X build script uses the Homebrew package manager for installing external dependencies. Here’s how to uninstall Homebrew, if you ever want to start again from scratch.

Prerequisites - Windows

You need to install the following dependencies for Windows builds of Solidity:

Software Notes
Visual Studio 2017 Build Tools C++ compiler
Visual Studio 2017 (Optional) C++ compiler and dev environment.

If you already have one IDE and only need the compiler and libraries, you could install Visual Studio 2017 Build Tools.

Visual Studio 2017 provides both IDE and necessary compiler and libraries. So if you have not got an IDE and prefer to develop solidity, Visual Studio 2017 may be a choice for you to get everything setup easily.

Here is the list of components that should be installed in Visual Studio 2017 Build Tools or Visual Studio 2017:

  • Visual Studio C++ core features
  • VC++ 2017 v141 toolset (x86,x64)
  • Windows Universal CRT SDK
  • Windows 8.1 SDK
  • C++/CLI support

Dependencies Helper Script

We have a helper script which you can use to install all required external dependencies on macOS, Windows and on numerous Linux distros.

./scripts/install_deps.sh

Or, on Windows:

scripts\install_deps.bat

Clone the Repository

To clone the source code, execute the following command:

git clone --recursive https://github.com/ethereum/solidity.git
cd solidity

If you want to help developing Solidity, you should fork Solidity and add your personal fork as a second remote:

git remote add personal git@github.com:[username]/solidity.git

Command-Line Build

Be sure to install External Dependencies (see above) before build.

Solidity project uses CMake to configure the build. You might want to install ccache to speed up repeated builds. CMake will pick it up automatically. Building Solidity is quite similar on Linux, macOS and other Unices:

mkdir build
cd build
cmake .. && make

or even easier on Linux and macOS, you can run:

#note: this will install binaries solc and soltest at usr/local/bin
./scripts/build.sh

Warning

BSD builds should work, but are untested by the Solidity team.

And for Windows:

mkdir build
cd build
cmake -G "Visual Studio 15 2017 Win64" ..

This latter set of instructions should result in the creation of solidity.sln in that build directory. Double-clicking on that file should result in Visual Studio firing up. We suggest building Release configuration, but all others work.

Alternatively, you can build for Windows on the command-line, like so:

cmake --build . --config Release

CMake options

If you are interested what CMake options are available run cmake .. -LH.

SMT Solvers

Solidity can be built against SMT solvers and will do so by default if they are found in the system. Each solver can be disabled by a cmake option.

Note: In some cases, this can also be a potential workaround for build failures.

Inside the build folder you can disable them, since they are enabled by default:

# disables only Z3 SMT Solver.
cmake .. -DUSE_Z3=OFF # disables only CVC4 SMT Solver.
cmake .. -DUSE_CVC4=OFF # disables both Z3 and CVC4
cmake .. -DUSE_CVC4=OFF -DUSE_Z3=OFF

The version string in detail

The Solidity version string contains four parts:

  • the version number
  • pre-release tag, usually set to develop.YYYY.MM.DD or nightly.YYYY.MM.DD
  • commit in the format of commit.GITHASH
  • platform, which has an arbitrary number of items, containing details about the platform and compiler

If there are local modifications, the commit will be postfixed with .mod.

These parts are combined as required by Semver, where the Solidity pre-release tag equals to the Semver pre-release and the Solidity commit and platform combined make up the Semver build metadata.

A release example: 0.4.8+commit.60cc1668.Emscripten.clang.

A pre-release example: 0.4.9-nightly.2017.1.17+commit.6ecb4aa3.Emscripten.clang

Important information about versioning

After a release is made, the patch version level is bumped, because we assume that only patch level changes follow. When changes are merged, the version should be bumped according to semver and the severity of the change. Finally, a release is always made with the version of the current nightly build, but without the prerelease specifier.

Example:

  1. the 0.4.0 release is made
  2. nightly build has a version of 0.4.1 from now on
  3. non-breaking changes are introduced - no change in version
  4. a breaking change is introduced - version is bumped to 0.5.0
  5. the 0.5.0 release is made

This behaviour works well with the version pragma.

Installing the Solidity Compiler¶的更多相关文章

  1. Solidity transfer vs send 区别

    原文地址: https://ethereum.stackexchange.com/questions/19341/address-send-vs-address-transfer-best-pract ...

  2. Solidity智能合约语言

    语言本身 ethereum官网 https://ethereum.org/zh/ 笔记 uint[] result = new uint[](3);   uint[] memory result = ...

  3. 使用remix的solidity在线编译环境部署一个faucet合约

    一.浏览器打开https://remix.ethereum.org 地址 点击"+"新建一个sol文件,命名为faucet.sol 然后在代码区输入solidity代码 选择相关插 ...

  4. 【转】Install MATLAB 2013a on CentOS 6.4 x64 with mode silent

    首先要下载安装光盘. Matlab801_MacUnix.iso [root@db-172-16-3-150 mnt]# md5sum /ssd1/Matlab801_MacUnix.iso  0d3 ...

  5. ODB 下载与安装 (Linux)

    http://www.codesynthesis.com/products/odb/download.xhtml Installing ODB on UNIX Introduction This gu ...

  6. 安装pip工具

    Python 2.7.9+ and 3.4+ Good news! Python 3.4 (released March 2014) and Python 2.7.9 (released Decemb ...

  7. 深入以太坊智能合约 ABI

    开发 DApp 时要调用在区块链上的以太坊智能合约,就需要智能合约的 ABI.本文希望更多了解 ABI,如为什么需要 ABI?如何解读 Ethereum 的智能合约 ABI?以及如何取得合约的 ABI ...

  8. Go语言打造以太坊智能合约测试框架(level1)

    传送门: 柏链项目学院 Go语言打造以太坊智能合约测试框架 前言 这是什么? 这是一个基于go语言编写的,自动化测试以太坊智能合约的开发框架,使用此框架,可以自动化的部署合约,自动测试合约内的功能函数 ...

  9. crosstool-ng-1.22.0搭建开发环境

        Ubuntu16.04无法安装libtool,只能在Ubuntu14.04以下版本安装. cp 下载/crosstool-ng-1.22.0.tar.bz2 /home/hou/ tar -x ...

随机推荐

  1. 面试题之String s="a"+"b"+"c"+"d";

    今天遇到了一个面试题的选择,我当时真的没怎么在意,其实挺好玩的. 1.这条语句String s="a"+"b"+"c"+"d&qu ...

  2. (详细)JAVA使用JDBC连接MySQL数据库(3)-代码部分

    欢迎任何形式的转载,但请务必注明出处. 本节主要内容 项目建立 数据库连接 数据库操作 主函数 点击进入推荐博客(必看) 一.项目建立 如图所示:新建Java Project.Package.Clas ...

  3. FPGA上外挂DDR2&DDR3&MIG IP的使用记录

    前言 当需要大容量数据存储及处理的时候,FPGA内部自带的存储资源是远远不够的,所以问题来了,怎么使用外带的DDR3? 首要问题在于DDR3是什么?有没有协议?当然只是需要用Xilinx MIG IP ...

  4. vue,onerror实现当图片加载失败时使用默认图

    1. 2.

  5. Oracle dump函数的用法

    一.函数标准格式: DUMP(expr[,return_fmt[,start_position][,length]]) 基本参数时4个,最少可以填的参数是0个.当完全没有参数时,直接返回null.另外 ...

  6. 关于Http协议与TCP协议的一些简单理解

    TCP协议对应于传输层,而HTTP协议对应于应用层,从本质上来说,二者没有可比性.Http协议是建立在TCP协议基础之上的,当浏览器需要从服务器获取网页数据的时候,会发出一次Http请求.Http会通 ...

  7. CentOS 8 (1905)系统安装

    本章内容: CentOS 8 的安装(CentOS-8-1905) 一.安装光盘,选择Install CentOS Linux 8.0.1905 二.选择系统语言,我这里选的是英文,也可以选择中文,往 ...

  8. webpack中css文件的代码分割

    module.exports = { output: { filename: '[name].js', chunkFilename: '[name].chunk.js', path: path.res ...

  9. Oracle查看数据占用的空间和数据文件实际空间的信息

    可以使用如下sql: select 'bgdrac' database,t11.username,t11.default_tablespace tablespace_name,segment_size ...

  10. nagios安装部署及详细配置说明(转)

    一.Nagios简介 Nagios是一款开源的电脑系统和网络监视工具,能有效监控Windows.Linux和Unix的主机状态,交换机路由器等网络设置,打印机等.在系统或服务状态异常时发出邮件或短信报 ...