Permalink
Browse files

Add note on building linux amd64 binary using custom g++

  • Loading branch information...
1 parent 0ee1e52 commit 2b502077b6dbaf34b71d589aa7b47531b610c070 @xerial committed Mar 28, 2013
Showing with 10 additions and 2 deletions.
  1. +9 −1 README.md
  2. +1 −1 src/main/java/org/xerial/snappy/SnappyLoader.java
View
@@ -51,7 +51,7 @@ In addition, high-level methods (`Snappy.compress(String)`, `Snappy.compress(flo
### 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 +91,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.
+## Build linux amd64 binary
+
+snappy-java tries to static link libstdc++ to increase the availability for various Linux versions. However, standard distribuions 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 details, 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:
@@ -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 2b50207

Please sign in to comment.