Permalink
Browse files

Merge branch 'release/1.1.0-M3'

  • Loading branch information...
2 parents 8d097fa + 920b838 commit d7c15b0607243c0dcf9d8fbdfa67cc449795f56a @xerial committed Mar 28, 2013
View
@@ -68,7 +68,7 @@ Linux-i386_SNAPPY_FLAGS:=
Linux-amd64_CXX := $(CROSS_PREFIX)g++
Linux-amd64_STRIP := $(CROSS_PREFIX)strip
Linux-amd64_CXXFLAGS := -include lib/inc_linux/jni_md.h -I$(JAVA_HOME)/include -O2 -fPIC -fvisibility=hidden -m64
-Linux-amd64_LINKFLAGS := -shared -static-libgcc # -static-libstdc++
+Linux-amd64_LINKFLAGS := -shared -static-libgcc -static-libstdc++
Linux-amd64_LIBNAME := libsnappyjava.so
Linux-amd64_SNAPPY_FLAGS :=
View
@@ -2,8 +2,8 @@
* `SnappyIndexer` for parallel compression/decompression
* CUI commands (snap/unsnap)
-## snappy-java-1.1.0-M2 (28 March 2013)
- * Fix linux amd64 build
+## snappy-java-1.1.0-M3 (28 March 2013)
+ * Fix linux amd64 build (embed libstdc++)
* Fixes #26
## snappy-java-1.1.0-M1 (27 March 2013)
View
@@ -31,27 +31,29 @@ If you are a Maven user, see [pom.xml example](#using-with-maven).
## Usage
First, import `org.xerial.snapy.Snappy` in your Java code:
- import org.xerial.snappy.Snappy;
-
+```java
+import org.xerial.snappy.Snappy;
+```
Then use `Snappy.compress(byte[])` and `Snappy.uncompress(byte[])`:
- String input = "Hello snappy-java! Snappy-java is a JNI-based wrapper of "
+```java
+String input = "Hello snappy-java! Snappy-java is a JNI-based wrapper of "
+ "Snappy, a fast compresser/decompresser.";
- byte[] compressed = Snappy.compress(input.getBytes("UTF-8"));
- byte[] uncompressed = Snappy.uncompress(compressed);
+byte[] compressed = Snappy.compress(input.getBytes("UTF-8"));
+byte[] uncompressed = Snappy.uncompress(compressed);
- String result = new String(uncompressed, "UTF-8");
- System.out.println(result);
-
+String result = new String(uncompressed, "UTF-8");
+System.out.println(result);
+```
In addition, high-level methods (`Snappy.compress(String)`, `Snappy.compress(float[] ..)` etc. ) and low-level ones (e.g. `Snappy.rawCompress(.. )`, `Snappy.rawUncompress(..)`, etc.), which minimize memory copies, can be used. See also
[Snappy.java](https://github.com/xerial/snappy-java/blob/master/src/main/java/org/xerial/snappy/Snappy.java)
### Stream-based API
Stream-based compressor/decompressor `SnappyOutputStream`/`SnappyInputStream` are also available for reading/writing large data sets.
- * [Javadoc API](https://oss.sonatype.org/service/local/repositories/snapshots/archive/org/xerial/snappy/snappy-java/1.0.5-M5-SNAPSHOT/snappy-java-1.0.5-M5-20130319.150524-2-javadoc.jar/!/index.html)
+ * [Javadoc API](https://oss.sonatype.org/service/local/repositories/releases/archive/org/xerial/snappy/snappy-java/1.1.0-M2/snappy-java-1.1.0-M2-javadoc.jar/!/index.html)
### Setting classpath
If you have snappy-java-(VERSION).jar in the current directory, use `-classpath` option as follows:
@@ -91,6 +93,14 @@ See the [installation instruction](https://github.com/xerial/snappy-java/blob/de
A file `target/snappy-java-$(version).jar` is the product additionally containing the native library built for your platform.
+## Building linux amd64 binary
+
+snappy-java tries to static link libstdc++ to increase the availability for various Linux versions. However, standard distributions of 64-bit Linux OS rarely provide libstdc++ compiled with `-fPIC` option. I currently uses custom g++ compiled with the following options:
+
+ $ ./configure --prefix=$HOME/local --with-gmp=$HOME/local --with-mpfr=$HOME/local --with-mpc=$HOME/local --with-ppl=$HOME/local --with-cloog=$HOME/local CXXFLAGS=-fPIC CFLAGS=-fPIC
+
+This g++ build enables static linking of libstdc++. For more infomation on building GCC, see GCC's home page.
+
## Cross-compiling for other platforms
The Makefile contains rules for cross-compiling the native library for other platforms so that the snappy-java JAR can support multiple platforms. For example, to build the native libraries for x86 Linux, x86 and x86-64 Windows, and soft- and hard-float ARM:
View
@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.xerial.snappy</groupId>
<artifactId>snappy-java</artifactId>
- <version>1.1.0-M2</version>
+ <version>1.1.0-M3</version>
<name>Snappy for Java</name>
<description>snappy-java: A fast compression/decompression library</description>
<packaging>bundle</packaging>
@@ -499,7 +499,7 @@ public static String getVersion() {
version = versionData.getProperty("version", version);
if (version.equals("unknown"))
version = versionData.getProperty("VERSION", version);
- version = version.trim().replaceAll("[^0-9\\.]", "");
+ version = version.trim().replaceAll("[^0-9M\\.]", "");
}
}
catch (IOException e) {

0 comments on commit d7c15b0

Please sign in to comment.