The WasmEdge (formerly SSVM
) is a high performance WebAssembly runtime optimized for server side applications. This project provides support for accessing with JPEG library and PNG library.
For this WasmEdge Image extension, we prefer to link the libjpeg and libpng statically into the both WasmEdge Image static and shared library. Hence, we compile and release the pre-built static and shared library of libjpeg and libpng on the legacy operating system, and link them into our WasmEdge Image extension library for not only reducing the compilation time, but also saving the library installation.
This project is under the License as the same as the libjpeg and libpng projects.
Our docker image is based on ubuntu 20.04
.
$ docker pull wasmedge/wasmedge
Please notice that WasmEdge-Image requires cmake>=3.11 and libboost>=1.68.
# Tools and libraries
$ sudo apt install -y \
software-properties-common \
cmake \
libboost-all-dev
# WasmEdge supports both clang++ and g++ compilers
# You can choose one of them for building this project
$ sudo apt install -y gcc g++
$ sudo apt install -y clang
$ git clone https://github.com/second-state/WasmEdge-image.git
$ cd WasmEdge-image
$ git checkout 0.9.0-rc1
WasmEdge-Image depends on WasmEdge-Core, you have to prepare WasmEdge-Core before you build WasmEdge-Image. We provides two options for setting up the WasmEdge-Core:
# After pulling our WasmEdge docker image
$ docker run -it --rm \
-v <path/to/your/WasmEdge-image/source/folder>:/root/WasmEdge-image \
wasmedge/wasmedge:latest
(docker)$ cd /root/WasmEdge-image
(docker)$ mkdir -p build && cd build
(docker)$ cmake -DCMAKE_BUILD_TYPE=Release .. && make
(docker)$ cmake -DWASMEDGE_CORE_PATH=<path/to/WasmEdge/source> -DCMAKE_BUILD_TYPE=Release .. && make
The shared library build/lib/libwasmedge-image_c.so
is the C API to create wasmedge-image
import object.
The header build/include/wasmedge/wasmedge-image.h
is the header of the shared library.
The static library build/lib/libwasmedgeHostModuleWasmEdgeImage.a
is for executables linking in CMake.
$ mkdir workspace && cd workspace
$ wget https://downloads.sourceforge.net/libpng/libpng-1.6.37.tar.xz
$ tar Jxvf libpng-1.6.37.tar.xz
$ wget http://ijg.org/files/jpegsrc.v8c.tar.gz
$ tar -zxvf jpegsrc.v8c.tar.gz
$ docker pull wasmedge/wasmedge:manylinux1_x86_64
$ docker run -it --rm -v $(pwd):/root/$(basename $(pwd)) wasmedge/wasmedge:manylinux1_x86_64
(docker) $ cd /root/workspace/jpeg-8c
(docker) $ CFLAGS=-fPIC ./configure --enable-shared=off && make
# The JPEG static library will be at `.libs/libjpeg.a`.
(docker) $ cd /root/workspace/libpng-1.6.37
(docker) $ CFLAGS=-fPIC ./configure --enable-shared=off && make
# The PNG static library will be at `.libs/libpng16.a`.