From 2129f915ef34317bfafc08f7e54e91de1a3da03c Mon Sep 17 00:00:00 2001 From: "Taro L. Saito" Date: Fri, 4 Jul 2014 13:54:08 +0900 Subject: [PATCH] Add notes for building g++ with -fPIC option --- README.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e7ebb05..03d1487 100755 --- a/README.md +++ b/README.md @@ -107,11 +107,23 @@ When building on Solaris use A file `target/snappy-java-$(version).jar` is the product additionally containing the native library built for your platform. -## Building linux amd64 binary +## Building linux x86_64 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: +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 as follows: - $ ./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 +``` +$ cd work +$ wget (gcc-4.8.3 source) +$ tar xvfz (gcc-4.8.3.tar.gz) +$ cd gcc-4.8.3 +$ ./contrib/download_prerequisites +$ cd .. +$ mkdir objdir +$ cd objdir +$ ../gcc-4.8.3/configure --prefix=$HOME/local/gcc-4.8.3 CXXFLAGS=-fPIC CFLAGS=-fPIC --enable-languages=c,c++ +$ make +$ make install +``` This g++ build enables static linking of libstdc++. For more infomation on building GCC, see GCC's home page.