From 5e8ae3217bcf9916cd322bff2416a922cfe7cc77 Mon Sep 17 00:00:00 2001 From: Peter Rudenko Date: Fri, 12 Jan 2018 04:55:34 -0800 Subject: [PATCH] Include libdisni.so into assembly jar Signed-off-by: Peter Rudenko --- README.md | 11 +++----- libdisni/build_libdisni.py | 51 ++++++++++++++++++++++++++++++++++++++ pom.xml | 19 ++++++++++++++ 3 files changed, 73 insertions(+), 8 deletions(-) create mode 100755 libdisni/build_libdisni.py diff --git a/README.md b/README.md index 95833707..b7b3542e 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,7 @@ DiSNI is a Java library for direct storage and networking access from userpace. ## Building DiSNI Building the source requires [Apache Maven](http://maven.apache.org/) and [GNU/autotools](http://www.gnu.org/software/autoconf/autoconf.html) and Java version 8 or higher. -To build DiSNI and its example programs, obtain a copy of DiSNI from [Github](https://github.com/zrlio/disni) and execute the following steps: - -1. Compile the Java sources using: mvn -DskipTests install -2. Compile libdisni using: cd libdisni; ./autoprepare.sh; ./configure --with-jdk=\; make install +To build DiSNI and its example programs, obtain a copy of DiSNI from [Github](https://github.com/zrlio/disni) and execute `mvn -DskipTests install`. By default DiSNI will only build with RDMA support. To enable NVMf you will need to install DPDK and SPDK using following steps. Below, \ refers to the DPDK 4-tuple for your platform, which would be `x86_64-native-linuxapp-gcc` for Intel/AMD processors and `ppc_64-power8-linuxapp-gcc` for Power (run `make help` in the DPDK top source directory for a list of 4-tuples supported by DPDK): @@ -16,16 +13,14 @@ By default DiSNI will only build with RDMA support. To enable NVMf you will need 3. Build dpdk using: make install T=\ DESTDIR=. EXTRA_CFLAGS="-fPIC" 4. Obtain spdk from [Github](https://github.com/spdk/spdk) (version 17.10) 5. Build spdk using: make DPDK_DIR=\ CONFIG_RDMA=y -6. Configure libdisni for NVMf: ./configure --with-jdk=\ --with-spdk=\ --with-dpdk=\/\ -7. Build libdisni: make install -8. Make sure shared libraries of DPDK are in the LD_LIBRARY_PATH +6. Build Disni for NVMf: `mvn -DskipTests -Dexec.args="--with-spdk= --with-dpdk=/" install` +7. Make sure shared libraries of DPDK are in the LD_LIBRARY_PATH ## How to Run the Examples Common steps: 1. After building DiSNI, make sure DiSNI and its dependencies are in the classpath (e.g., disni-1.3-jar-with-dependencies.jar). Also add the DiSNI test jar (disni-1.3-tests.jar) which includes the examples.
-2. Make sure libdisni is part of the LD_LIBRARY_PATH ### RDMA example 1. Make sure the RDMA network interface is configured and up on the test machines (run ibv\_devices to see the list of RDMA NICs). If your machine does not have RDMA hardware, you can also use SoftiWARP from [Github](https://github.com/zrlio/softiwarp). diff --git a/libdisni/build_libdisni.py b/libdisni/build_libdisni.py new file mode 100755 index 00000000..f5443883 --- /dev/null +++ b/libdisni/build_libdisni.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +import errno +import glob +import os +import shutil +import subprocess +import sys + +def maybe_makedirs(path): + path = normpath(path) + print("mkdir -p " + path) + try: + os.makedirs(path) + except OSError as e: + if e.errno != errno.EEXIST: + raise + + +def run(command, **kwargs): + print(command) + subprocess.check_call(command, shell=True, **kwargs) + + +def cp(source, target): + source = normpath(source) + target = normpath(target) + print("cp {0} {1}".format(source, target)) + shutil.copy(source, target) + + +def normpath(path): + """Normalize UNIX path to a native path.""" + normalized = os.path.join(*path.split("/")) + if os.path.isabs(path): + return os.path.abspath("/") + normalized + else: + return normalized + + +if __name__ == "__main__": + print("building libdisni") + maybe_makedirs("build") + run("./autoprepare.sh") + run("./configure --with-jdk={} --prefix={} {}".format(os.environ["JAVA_HOME"], + os.path.join(os.getcwd(), "build"), + sys.argv[1] if len(sys.argv) == 2 else "")) + run("make") + run("make install") + print("copying native library") + maybe_makedirs("../src/main/resources/lib") + cp("build/lib/libdisni.so", "../src/main/resources/lib") diff --git a/pom.xml b/pom.xml index 2134fcef..1fbfd95c 100644 --- a/pom.xml +++ b/pom.xml @@ -115,6 +115,25 @@ + + org.codehaus.mojo + exec-maven-plugin + 1.6.0 + + + native + generate-sources + + exec + + + ./build_libdisni.py + libdisni + + + + + maven-assembly-plugin