guangyu-ryan / py-leveldb

Other
0 stars 0 forks source link

fPIC flag needed when build leveldb #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
System:

    * Ubuntu 11.04 2.6.35-28-generic AMD64 
    * gcc-4.4
    * python-2.6

Install Error:

{{{
leveldb_object.cc:394: warning: deprecated conversion from string constant to 
'char*'
g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions 
build/temp.linux-x86_64-2.6/leveldb_ext.o 
build/temp.linux-x86_64-2.6/leveldb_object.o -lstdc++ -o 
build/lib.linux-x86_64-2.6/leveldb.so -Bdynamic -lm -L./leveldb-read-only 
-Bstatic -lleveldb
/usr/bin/ld.bfd.real: ./leveldb-read-only/libleveldb.a(db_impl.o): relocation 
R_X86_64_32S against `vtable for leveldb::DBImpl::RecoverLogFile(unsigned long, 
leveldb::VersionEdit*, unsigned long*)::LogReporter' can not be used when 
making a shared object; recompile with -fPIC
./leveldb-read-only/libleveldb.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
error: command 'g++' failed with exit status 1
}}}

SUCCESS when:

adding a -fPIC flag to leveldb

$cd leveldb-read-only
$svn diff
{{{
$ svn diff
Index: Makefile
===================================================================
--- Makefile    (revision 45)
+++ Makefile    (working copy)
@@ -8,7 +8,7 @@
 # Uncomment exactly one of the lines labelled (A), (B), and (C) below
 # to switch between compilation modes.

-OPT = -O2 -DNDEBUG       # (A) Production use (optimized mode)
+OPT = -fPIC -O2 -DNDEBUG       # (A) Production use (optimized mode)
 # OPT = -g2              # (B) Debug mode, w/ full line-level debugging symbols
 # OPT = -O2 -g2 -DNDEBUG # (C) Profiling mode: opt, but w/debugging symbols
}}}

Original issue reported on code.google.com by epau...@gmail.com on 2 Aug 2011 at 7:27

GoogleCodeExporter commented 9 years ago
Added installation instructions to front-page, and created a script which 
overrides OPT with '-fPIC -O2 -DNDEBUG'.

Original comment by arnim...@gmail.com on 2 Aug 2011 at 12:00