tuyenth / leveldb

Automatically exported from code.google.com/p/leveldb
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Build issue on Solaris #88

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Untar 1.4.0 sources on Solaris 10, run gmake

The environment (partly set by the OpenCSW build system):
HOME="/home/maciej" 
PATH="/opt/csw/gnu:/home/maciej/src/opencsw/pkg/leveldb/trunk/work/solaris10-i38
6/install-isa-amd64/opt/csw/bin/amd64:/home/maciej/src/opencsw/pkg/leveldb/trunk
/work/solaris10-i386/install-isa-amd64/opt/csw/bin:/home/maciej/src/opencsw/pkg/
leveldb/trunk/work/solaris10-i386/install-isa-amd64/opt/csw/sbin/amd64:/home/mac
iej/src/opencsw/pkg/leveldb/trunk/work/solaris10-i386/install-isa-amd64/opt/csw/
sbin:/opt/csw/bin/amd64:/opt/csw/bin:/opt/csw/sbin/amd64:/opt/csw/sbin:/opt/csw/
bin:/home/maciej/src/opencsw/pkg/.buildsys/v2/gar/bin:/usr/bin:/usr/sbin:/usr/ja
va/bin:/usr/ccs/bin:/usr/openwin/bin" 
LC_ALL="C" 
prefix="/opt/csw/gxx" 
exec_prefix="/opt/csw/gxx" 
bindir="/opt/csw/gxx/bin/amd64" 
sbindir="/opt/csw/gxx/sbin/amd64" libexecdir="/opt/csw/gxx/libexec/amd64" 
datadir="/opt/csw/gxx/share" 
sysconfdir="/etc/opt/csw/gxx" 
sharedstatedir="/opt/csw/gxx/share" 
localstatedir="/var/opt/csw/gxx" 
libdir="/opt/csw/gxx/lib/64" 
infodir="/opt/csw/gxx/share/info" lispdir="/opt/csw/gxx/share/emacs/site-lisp" 
includedir="/opt/csw/gxx/include" 
mandir="/opt/csw/gxx/share/man" 
docdir="/opt/csw/gxx/share/doc" 
sourcedir="/opt/csw/src" 
CPPFLAGS="-I/opt/csw/gxx/include -I/opt/csw/include" 
CFLAGS="-O2 -pipe -m64 -march=opteron" 
CXXFLAGS="-O2 -pipe -m64 -march=opteron" 
LDFLAGS="-m64 -march=opteron -L/opt/csw/gxx/lib/64 -L/opt/csw/lib/64" 
FFLAGS="-O2 -pipe -m64 -march=opteron" 
FCFLAGS="-O2 -pipe -m64 -march=opteron" 
F77="/opt/csw/bin/gfortran-4.6" 
FC="/opt/csw/bin/gfortran-4.6" 
ASFLAGS="" OPTFLAGS="-O2 -pipe -m64 -march=opteron" CC="/opt/csw/bin/gcc-4.6" 
CXX="/opt/csw/bin/g++-4.6" 
CC_HOME="/opt/csw" 
CC_VERSION="gcc version 4.6.3 (GCC) " 
CXX_VERSION="gcc version 4.6.3 (GCC) " 
GARCH="i386" 
GAROSREL="5.10" 
GARPACKAGE="trunk" 
LD_OPTIONS="-R/opt/csw/gxx/lib/\$ISALIST -R/opt/csw/gxx/lib/64 
-R/opt/csw/lib/\$ISALIST -R/opt/csw/lib/64"

2.
3.

What is the expected output? What do you see instead?

I'm getting an error message:

rm -f libleveldb.a
ar -rs libleveldb.a db/builder.o db/c.o db/db_impl.o db/db_iter.o db/dbformat.o 
db/filename.o db/log_reader.o db/log_writer.o db/memtable.o db/repair.o 
db/table_cache.o db/version_edit.o db/version_set.o db/write_batch.o 
table/block.o table/block_builder.o table/filter_block.o table/format.o 
table/iterator.o table/merger.o table/table.o table/table_builder.o 
table/two_level_iterator.o util/arena.o util/bloom.o util/cache.o util/coding.o 
util/comparator.o util/crc32c.o util/env.o util/env_posix.o 
util/filter_policy.o util/hash.o util/histogram.o util/logging.o util/options.o 
util/status.o port/port_posix.o
ar: creating libleveldb.a
ld: warning: option -o appears more than once, first setting taken
ld: fatal: file 
/home/maciej/src/opencsw/pkg/leveldb/trunk/work/solaris10-i386/build-isa-amd64/l
eveldb-1.4.0/libleveldb.so.1: open failed: No such file or directory
ld: fatal: File processing errors. No output written to libleveldb.so.1.4
gmake: *** [libleveldb.so.1.4] Error 1

What version of the product are you using? On what operating system?
leveldb-1.4.0 on Solaris 10 x86

Please provide any additional information below.

The build recipe:
http://sourceforge.net/apps/trac/gar/browser/csw/mgar/pkg/leveldb/trunk/Makefile

The C++ libraries such as snappy, are under the /opt/csw/gxx prefix.

Original issue reported on code.google.com by blizin...@google.com on 8 May 2012 at 6:21

GoogleCodeExporter commented 9 years ago
Doing some more digging. One problem could be concurrency, the "ar" line might 
not correspond to the error message. I isolated the command that results in the 
error:

maciej@unstable10x [unstable10x]:~/src/opencsw/pkg/leveldb/trunk $ (cd 
/home/maciej/src/opencsw/pkg/leveldb/trunk/work/solaris10-i386/build-isa-amd64/l
eveldb-1.4.0; /opt/csw/bin/g++-4.6 -m64 -march=opteron -L/opt/csw/gxx/lib/64 
-L/opt/csw/lib/64 -lpthread -lrt -shared -Wl,-soname 
-Wl,/home/maciej/src/opencsw/pkg/leveldb/trunk/work/solaris10-i386/build-isa-amd
64/leveldb-1.4.0/libleveldb.so.1 -O2 -pipe -m64 -march=opteron -I. -I./include 
-fno-builtin-memcmp -D_REENTRANT -DOS_SOLARIS -DLEVELDB_PLATFORM_POSIX -O2 
-DNDEBUG        -fPIC db/builder.cc db/c.cc db/db_impl.cc db/db_iter.cc 
db/dbformat.cc db/filename.cc db/log_reader.cc db/log_writer.cc db/memtable.cc 
db/repair.cc db/table_cache.cc db/version_edit.cc db/version_set.cc 
db/write_batch.cc table/block.cc table/block_builder.cc table/filter_block.cc 
table/format.cc table/iterator.cc table/merger.cc table/table.cc 
table/table_builder.cc table/two_level_iterator.cc util/arena.cc util/bloom.cc 
util/cache.cc util/coding.cc util/comparator.cc util/crc32c.cc util/env.cc 
util/env_posix.cc util/filter_policy.cc util/hash.cc util/histogram.cc 
util/logging.cc util/options.cc util/status.cc  port/port_posix.cc -o 
libleveldb.so.1.4)
ld: warning: option -o appears more than once, first setting taken
ld: fatal: file 
/home/maciej/src/opencsw/pkg/leveldb/trunk/work/solaris10-i386/build-isa-amd64/l
eveldb-1.4.0/libleveldb.so.1: open failed: No such file or directory
ld: fatal: File processing errors. No output written to libleveldb.so.1.4
maciej@unstable10x [unstable10x]:~/src/opencsw/pkg/leveldb/trunk $ ls -l 
/home/maciej/src/opencsw/pkg/leveldb/trunk/work/solaris10-i386/build-isa-amd64/l
eveldb-1.4.0
total 756
-rw-r--r--   1 maciej   csw          193 Apr 30 22:31 AUTHORS
-rw-r--r--   1 maciej   csw         1484 Apr 30 22:31 LICENSE
-rw-r--r--   1 maciej   csw         6992 Apr 30 22:31 Makefile
-rw-r--r--   1 maciej   csw          509 Apr 30 22:31 NEWS
-rw-r--r--   1 maciej   csw         1713 Apr 30 22:31 README
-rw-r--r--   1 maciej   csw          494 Apr 30 22:31 TODO
-rw-r--r--   1 maciej   csw         1012 May  8 20:26 build_config.mk
-rwxr-xr-x   1 maciej   csw         5203 Apr 30 22:31 build_detect_platform
drwxr-xr-x   2 maciej   csw           56 May  8 20:10 db
drwxr-xr-x   3 maciej   csw            9 Apr 30 22:31 doc
drwxr-xr-x   3 maciej   csw            3 Apr 30 22:31 helpers
drwxr-xr-x   3 maciej   csw            3 Apr 30 22:31 include
-rw-r--r--   1 maciej   csw       771778 May  8 20:10 libleveldb.a
drwxr-xr-x   3 maciej   csw           12 May  8 20:10 port
drwxr-xr-x   2 maciej   csw           29 May  8 20:10 table
drwxr-xr-x   2 maciej   csw           49 May  8 20:10 util

Another thing is that soname looks wrong; it shouldn't contain a full path. Yet 
another thing is the linker; GCC on Solaris uses the Solaris linker, which 
accepts different flags than the GNU linker. For instance, it needs "-h 
foo.so.1" to set the soname.

Here's a working invocation, which produces a shared library:

maciej@unstable10x [unstable10x]:~/src/opencsw/pkg/leveldb/trunk $ (cd 
/home/maciej/src/opencsw/pkg/leveldb/trunk/work/solaris10-i386/build-isa-amd64/l
eveldb-1.4.0; /opt/csw/bin/g++-4.6 -m64 -march=opteron -L/opt/csw/gxx/lib/64 
-L/opt/csw/lib/64 -lpthread -lrt -shared -Wl,-h -Wl,libleveldb.so.1 -O2 -pipe 
-m64 -march=opteron -I. -I./include -fno-builtin-memcmp -D_REENTRANT 
-DOS_SOLARIS -DLEVELDB_PLATFORM_POSIX -O2 -DNDEBUG        -fPIC db/builder.cc 
db/c.cc db/db_impl.cc db/db_iter.cc db/dbformat.cc db/filename.cc 
db/log_reader.cc db/log_writer.cc db/memtable.cc db/repair.cc db/table_cache.cc 
db/version_edit.cc db/version_set.cc db/write_batch.cc table/block.cc 
table/block_builder.cc table/filter_block.cc table/format.cc table/iterator.cc 
table/merger.cc table/table.cc table/table_builder.cc 
table/two_level_iterator.cc util/arena.cc util/bloom.cc util/cache.cc 
util/coding.cc util/comparator.cc util/crc32c.cc util/env.cc util/env_posix.cc 
util/filter_policy.cc util/hash.cc util/histogram.cc util/logging.cc 
util/options.cc util/status.cc  port/port_posix.cc -o libleveldb.so.1.4)

What would be the best way to modify the build scripts to support Solaris 
builds?

Original comment by blizin...@google.com on 8 May 2012 at 6:35