Skip to content

Build Aion kernel from source

AionJayT edited this page May 14, 2019 · 4 revisions

Prerequisites

Build to native binary

  1. install pre-required package
sudo apt-get update
sudo apt-get install -y git g++ cmake wget llvm-4.0 lsb-release libjsoncpp1 libjsoncpp-dev libboost1.58-all-dev libzmq5 libstdc++6 libgcc1 libpgm-5.2-0
  1. Clone the Aion project
git clone --recursive https://github.com/aionnetwork/aion 
  1. Go into the folder
cd aion
  1. Check your environment settings are correct, including the Ant execute path, java executes PATH link to the JDK11 folder, and the JAVA_HOME.

Set a link at /usr/lib/jvm/jdk-11.0.1

ln -s [your jdk install folder] /usr/lib/jvm/jdk-11.0.1

This is the example for the building environment settings in .profile under the home path. You can reload it by source ~/.profile

export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8
export JAVA_HOME=/usr/lib/jvm/jdk-11.0.1
export ANT_HOME=$HOME/IDE/apache-ant-1.10.3
PATH="$ANT_HOME/bin:$JAVA_HOME/bin:$PATH"

Then you should be able to build

./gradlew build
  1. Verify the code You can go through the test cases by:
./gradlew test -x aion_api:test
  1. pack the code
./gradlew pack

check your pack folder

cd pack

You should see a file named like this

aion-v<KERNEL VERSION>.<GIT REVISION>-<BUILD DATE>.tar.bz2

eg. aion-v0.1.12.2c5119a-2018-02-28.tar.bz2

Build the fastVM and the solidity compiler native library from source code

If you want to build the project all from the source code. In step 4 of the How to build, you can use ant full_build to build all from source (It will take a while). make sure your Ubuntu is 16.04 release (if you want to build on top of the latest Ubuntu release, will require you to change the dependency of the build script in the aion_fastvm/script folder, the last Ubuntu release doesn't have the libboost1.58 package)

Build Docker image

The build scripts can also produce a Docker image.

In addition to the per-requisites listed above, building the Docker image will also require you to have the following installed:

  • Docker 18+
  • Python 2.x

To build the Docker image, run the following from the aion directory: ./gradlew packDocker

For more information about running Aion in Docker, see: https://docs.aion.network/v1.1/docs/docker-images

Execute your Aion network

Please check the section Aion Installation in the aion/README.md

For Developers

There is a wiki about the code convention. Please follow the rules when you do pull requests to this repo. Thanks

Test with your local AVM

If you want to test your dev AVM with the Aion Java kernel, copy the AVM libraries to the Aion kernel lib folder after finished your build in the AVM repo

(in your AVM repo) ant; ant test
cp [your AVM repo]/build/main/org-aion-avm-*(except org-aion-avm-tooling.jar)   [your kernel repo]/lib 
Clone this wiki locally