Code Monkey home page Code Monkey logo

wasm-compiler's Introduction

wasm-compiler

this project is a tool to generate contentos contract's wasm and abi file.

build instruction on ubuntu

the instruction to build coscc program on ubuntu.

step

1.install basic software

  apt-get update -y
  apt-get install -y \
              wget \
              git \
              tar \
              gcc \
              g++ \
              python \
              llvm-4.0 \
              libclang-4.0-dev \
              zlib1g-dev \	
              make \

2.install cmake

  cd / && \
  wget https://cmake.org/files/v3.12/cmake-3.12.2-Linux-x86_64.tar.gz && \
  tar zxvf cmake-3.12.2-Linux-x86_64.tar.gz && \
  mv cmake-3.12.2-Linux-x86_64 /opt/cmake-3.12.2 && \
  ln -sf /opt/cmake-3.12.2/bin/*  /usr/bin/ && \
  rm -rf /cmake-3.12.2-Linux-x86_64.tar.gz

3.install boost

  wget https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.bz2 && \
  tar -xf boost_1_67_0.tar.bz2 && \
  cd boost_1_67_0 && \
  ./bootstrap.sh && \
  ./b2 -j12 --without-python install && \
  rm -rf /boost_1_67_0 && \
  rm /boost_1_67_0.tar.bz2

4.install llvm

  cd / && \
    git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/llvm.git && \
    cd llvm/tools/ && \
    git clone --depth 1 --single-branch --branch release_40 https://github.com/llvm-mirror/clang.git && \
    cd .. && \
    mkdir build && \
    cd build && \
    cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=/root/opt/wasm -DLLVM_TARGETS_TO_BUILD= -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly -DCMAKE_BUILD_TYPE=Release ../ && \
  make -j12 install && \
  rm -rf /llvm/

5.install wabt

  cd / && \
	wget https://github.com/WebAssembly/wabt/releases/download/1.0.10/wabt-1.0.10-linux.tar.gz && \
    tar -xf wabt-1.0.10-linux.tar.gz && \
    cp /wabt-1.0.10/wat2wasm /usr/bin/ && \
  rm -rf /wabt-1.0.10 && \
  rm -rf /wabt-1.0.10-linux.tar.gz

6.compile wasm-compiler

  cd / && \
  git clone -b master https://github.com/coschain/wasm-compiler.git && \
  cd wasm-compiler && \
  git submodule update --init && \
  mkdir build && cd build && \
  cmake .. && \
  make -j2 install

usage

use coscc program to compile contract wasm and abi

cosiocc -o xxx.wasm xxx.cpp
cosiocc -g xxx.abi xxx.cpp

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.