Skip to content

Commit 2129f91

Browse files
committed
Add notes for building g++ with -fPIC option
1 parent fe2f579 commit 2129f91

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,23 @@ When building on Solaris use
107107

108108
A file `target/snappy-java-$(version).jar` is the product additionally containing the native library built for your platform.
109109

110-
## Building linux amd64 binary
110+
## Building linux x86_64 binary
111111

112-
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:
112+
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:
113113

114-
$ ./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
114+
```
115+
$ cd work
116+
$ wget (gcc-4.8.3 source)
117+
$ tar xvfz (gcc-4.8.3.tar.gz)
118+
$ cd gcc-4.8.3
119+
$ ./contrib/download_prerequisites
120+
$ cd ..
121+
$ mkdir objdir
122+
$ cd objdir
123+
$ ../gcc-4.8.3/configure --prefix=$HOME/local/gcc-4.8.3 CXXFLAGS=-fPIC CFLAGS=-fPIC --enable-languages=c,c++
124+
$ make
125+
$ make install
126+
```
115127

116128
This g++ build enables static linking of libstdc++. For more infomation on building GCC, see GCC's home page.
117129

0 commit comments

Comments
 (0)