does not compile under SmartOS
The following error is printed when trying to compile erotcksdb under SmartOS:
./c_src/build_deps.sh
checking for a BSD-compatible install... /opt/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /opt/local/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking build system type... x86_64-pc-solaris2.11
checking host system type... x86_64-pc-solaris2.11
checking how to print strings... print -r
checking for style of include used by make... GNU
checking for gcc... /opt/local/gcc49/bin/gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /opt/local/gcc49/bin/gcc accepts -g... yes
checking for /opt/local/gcc49/bin/gcc option to accept ISO C89... none needed
checking dependency style of /opt/local/gcc49/bin/gcc... gcc3
checking for a sed that does not truncate output... /opt/local/bin/sed
checking for grep that handles long lines and -e... /opt/local/bin/grep
checking for egrep... /opt/local/bin/grep -E
checking for fgrep... /opt/local/bin/grep -F
checking for ld used by /opt/local/gcc49/bin/gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /opt/local/bin/nm -B
checking the name lister (/opt/local/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 786240
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-pc-solaris2.11 file names to x86_64-pc-solaris2.11 format... func_convert_file_noop
checking how to convert x86_64-pc-solaris2.11 file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... print -r --
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /opt/local/bin/nm -B output from /opt/local/gcc49/bin/gcc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... /opt/local/gcc49/bin/gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if /opt/local/gcc49/bin/gcc supports -fno-rtti -fno-exceptions... no
checking for /opt/local/gcc49/bin/gcc option to produce PIC... -fPIC -DPIC
checking if /opt/local/gcc49/bin/gcc PIC flag -fPIC -DPIC works... yes
checking if /opt/local/gcc49/bin/gcc static flag -static works... no
checking if /opt/local/gcc49/bin/gcc supports -c -o file.o... yes
checking if /opt/local/gcc49/bin/gcc supports -c -o file.o... (cached) yes
checking whether the /opt/local/gcc49/bin/gcc linker (/usr/bin/ld -64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... solaris2.11 ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking whether we are using the GNU C++ compiler... yes
checking whether /opt/local/gcc49/bin/gcc accepts -g... yes
checking dependency style of /opt/local/gcc49/bin/gcc... gcc3
checking how to run the C++ preprocessor... /opt/local/gcc49/bin/gcc -E
checking for ld used by /opt/local/gcc49/bin/gcc... /usr/bin/ld -64
checking if the linker (/usr/bin/ld -64) is GNU ld... no
checking whether the /opt/local/gcc49/bin/gcc linker (/usr/bin/ld -64) supports shared libraries... yes
checking for /opt/local/gcc49/bin/gcc option to produce PIC... -fPIC -DPIC
checking if /opt/local/gcc49/bin/gcc PIC flag -fPIC -DPIC works... yes
checking if /opt/local/gcc49/bin/gcc static flag -static works... no
checking if /opt/local/gcc49/bin/gcc supports -c -o file.o... yes
checking if /opt/local/gcc49/bin/gcc supports -c -o file.o... (cached) yes
checking whether the /opt/local/gcc49/bin/gcc linker (/usr/bin/ld -64) supports shared libraries... yes
checking dynamic linker characteristics... solaris2.11 ld.so
checking how to hardcode library paths into programs... immediate
checking whether byte ordering is bigendian... no
checking for size_t... yes
checking for ssize_t... yes
checking for stdint.h... (cached) yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking sys/mman.h usability... yes
checking sys/mman.h presence... yes
checking for sys/mman.h... yes
checking sys/resource.h usability... yes
checking sys/resource.h presence... yes
checking for sys/resource.h... yes
checking windows.h usability... no
checking windows.h presence... no
checking for windows.h... no
checking byteswap.h usability... no
checking byteswap.h presence... no
checking for byteswap.h... no
checking sys/byteswap.h usability... no
checking sys/byteswap.h presence... no
checking for sys/byteswap.h... no
checking sys/endian.h usability... no
checking sys/endian.h presence... no
checking for sys/endian.h... no
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for mmap... yes
checking for 'gtest-config'... checking for gtest-config... no
no
checking for pkg-config... no
checking for gflags... no
checking if the compiler supports __builtin_expect... yes
checking if the compiler supports __builtin_ctzll... yes
checking for zlibVersion in -lz... no
checking for lzo1x_1_15_compress in -llzo2... no
checking for lzf_compress in -llzf... no
checking for fastlz_compress in -lfastlz... no
checking for qlz_compress in -lquicklz... no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating snappy-stubs-public.h
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
gmake[1]: Entering directory '/root/erocksdb/c_src/snappy-1.1.1'
gmake all-am
gmake[2]: Entering directory '/root/erocksdb/c_src/snappy-1.1.1'
/bin/sh ./libtool --tag=CXX --mode=compile /opt/local/gcc49/bin/gcc -DHAVE_CONFIG_H -I. -g -O2 -MT snappy.lo -MD -MP -MF .deps/snappy.Tpo -c -o snappy.lo snappy.cc
libtool: compile: /opt/local/gcc49/bin/gcc -DHAVE_CONFIG_H -I. -g -O2 -MT snappy.lo -MD -MP -MF .deps/snappy.Tpo -c snappy.cc -fPIC -DPIC -o .libs/snappy.o
libtool: compile: /opt/local/gcc49/bin/gcc -DHAVE_CONFIG_H -I. -g -O2 -MT snappy.lo -MD -MP -MF .deps/snappy.Tpo -c snappy.cc -fPIC -DPIC -o snappy.o >/dev/null 2>&1
mv -f .deps/snappy.Tpo .deps/snappy.Plo
/bin/sh ./libtool --tag=CXX --mode=compile /opt/local/gcc49/bin/gcc -DHAVE_CONFIG_H -I. -g -O2 -MT snappy-sinksource.lo -MD -MP -MF .deps/snappy-sinksource.Tpo -c -o snappy-sinksource.lo snappy-sinksource.cc
libtool: compile: /opt/local/gcc49/bin/gcc -DHAVE_CONFIG_H -I. -g -O2 -MT snappy-sinksource.lo -MD -MP -MF .deps/snappy-sinksource.Tpo -c snappy-sinksource.cc -fPIC -DPIC -o .libs/snappy-sinksource.o
libtool: compile: /opt/local/gcc49/bin/gcc -DHAVE_CONFIG_H -I. -g -O2 -MT snappy-sinksource.lo -MD -MP -MF .deps/snappy-sinksource.Tpo -c snappy-sinksource.cc -fPIC -DPIC -o snappy-sinksource.o >/dev/null 2>&1
mv -f .deps/snappy-sinksource.Tpo .deps/snappy-sinksource.Plo
/bin/sh ./libtool --tag=CXX --mode=compile /opt/local/gcc49/bin/gcc -DHAVE_CONFIG_H -I. -g -O2 -MT snappy-stubs-internal.lo -MD -MP -MF .deps/snappy-stubs-internal.Tpo -c -o snappy-stubs-internal.lo snappy-stubs-internal.cc
libtool: compile: /opt/local/gcc49/bin/gcc -DHAVE_CONFIG_H -I. -g -O2 -MT snappy-stubs-internal.lo -MD -MP -MF .deps/snappy-stubs-internal.Tpo -c snappy-stubs-internal.cc -fPIC -DPIC -o .libs/snappy-stubs-internal.o
libtool: compile: /opt/local/gcc49/bin/gcc -DHAVE_CONFIG_H -I. -g -O2 -MT snappy-stubs-internal.lo -MD -MP -MF .deps/snappy-stubs-internal.Tpo -c snappy-stubs-internal.cc -fPIC -DPIC -o snappy-stubs-internal.o >/dev/null 2>&1
mv -f .deps/snappy-stubs-internal.Tpo .deps/snappy-stubs-internal.Plo
/bin/sh ./libtool --tag=CXX --mode=compile /opt/local/gcc49/bin/gcc -DHAVE_CONFIG_H -I. -g -O2 -MT snappy-c.lo -MD -MP -MF .deps/snappy-c.Tpo -c -o snappy-c.lo snappy-c.cc
libtool: compile: /opt/local/gcc49/bin/gcc -DHAVE_CONFIG_H -I. -g -O2 -MT snappy-c.lo -MD -MP -MF .deps/snappy-c.Tpo -c snappy-c.cc -fPIC -DPIC -o .libs/snappy-c.o
libtool: compile: /opt/local/gcc49/bin/gcc -DHAVE_CONFIG_H -I. -g -O2 -MT snappy-c.lo -MD -MP -MF .deps/snappy-c.Tpo -c snappy-c.cc -fPIC -DPIC -o snappy-c.o >/dev/null 2>&1
mv -f .deps/snappy-c.Tpo .deps/snappy-c.Plo
/bin/sh ./libtool --tag=CXX --mode=link /opt/local/gcc49/bin/gcc -g -O2 -version-info 3:0:2 -o libsnappy.la -rpath /root/erocksdb/c_src/system/lib snappy.lo snappy-sinksource.lo snappy-stubs-internal.lo snappy-c.lo
libtool: link: /opt/local/gcc49/bin/gcc -shared -fPIC -DPIC -nostdlib /usr/lib/amd64/crti.o /usr/lib/amd64/values-Xa.o /opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/crtbegin.o .libs/snappy.o .libs/snappy-sinksource.o .libs/snappy-stubs-internal.o .libs/snappy-c.o -L/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2 -L/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/../../../amd64 -L/lib/amd64 -L/usr/lib/amd64 -L/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/../../.. -lc -lgcc_s /opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/crtend.o /usr/lib/amd64/crtn.o -O2 -Wl,-h -Wl,libsnappy.so.1 -o .libs/libsnappy.so.1.2.0
libtool: link: (cd ".libs" && rm -f "libsnappy.so.1" && ln -s "libsnappy.so.1.2.0" "libsnappy.so.1")
libtool: link: (cd ".libs" && rm -f "libsnappy.so" && ln -s "libsnappy.so.1.2.0" "libsnappy.so")
libtool: link: ar cru .libs/libsnappy.a snappy.o snappy-sinksource.o snappy-stubs-internal.o snappy-c.o
libtool: link: ranlib .libs/libsnappy.a
libtool: link: ( cd ".libs" && rm -f "libsnappy.la" && ln -s "../libsnappy.la" "libsnappy.la" )
/opt/local/gcc49/bin/gcc -DHAVE_CONFIG_H -I. -g -O2 -MT snappy_unittest-snappy_unittest.o -MD -MP -MF .deps/snappy_unittest-snappy_unittest.Tpo -c -o snappy_unittest-snappy_unittest.o `test -f 'snappy_unittest.cc' || echo './'`snappy_unittest.cc
mv -f .deps/snappy_unittest-snappy_unittest.Tpo .deps/snappy_unittest-snappy_unittest.Po
/opt/local/gcc49/bin/gcc -DHAVE_CONFIG_H -I. -g -O2 -MT snappy_unittest-snappy-test.o -MD -MP -MF .deps/snappy_unittest-snappy-test.Tpo -c -o snappy_unittest-snappy-test.o `test -f 'snappy-test.cc' || echo './'`snappy-test.cc
mv -f .deps/snappy_unittest-snappy-test.Tpo .deps/snappy_unittest-snappy-test.Po
/bin/sh ./libtool --tag=CXX --mode=link /opt/local/gcc49/bin/gcc -g -O2 -o snappy_unittest snappy_unittest-snappy_unittest.o snappy_unittest-snappy-test.o libsnappy.la
libtool: link: /opt/local/gcc49/bin/gcc -g -O2 -o .libs/snappy_unittest snappy_unittest-snappy_unittest.o snappy_unittest-snappy-test.o ./.libs/libsnappy.so -Wl,-R -Wl,/root/erocksdb/c_src/system/lib
Undefined first referenced
symbol in file
std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) snappy_unittest-snappy_unittest.o
std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate(unsigned long, unsigned long, unsigned long) snappy_unittest-snappy_unittest.o
operator new[](unsigned long) snappy_unittest-snappy_unittest.o
operator new(unsigned long) snappy_unittest-snappy_unittest.o
std::ctype<char>::_M_widen_init() const snappy_unittest-snappy_unittest.o
std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(unsigned long, char, std::allocator<char> const&) snappy_unittest-snappy_unittest.o
std::basic_string<char, std::char_traits<char>, std::allocator<char> >::append(char const*, unsigned long) snappy_unittest-snappy_unittest.o
std::basic_string<char, std::char_traits<char>, std::allocator<char> >::append(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) snappy_unittest-snappy_unittest.o
vtable for __cxxabiv1::__si_class_type_info ./.libs/libsnappy.so
std::basic_ostream<char, std::char_traits<char> >::put(char) snappy_unittest-snappy_unittest.o
std::basic_ostream<char, std::char_traits<char> >::operator<<(int) snappy_unittest-snappy_unittest.o
__cxa_end_catch snappy_unittest-snappy_unittest.o
__cxa_begin_catch snappy_unittest-snappy_unittest.o
std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, unsigned long) snappy_unittest-snappy-test.o
std::__throw_bad_cast() snappy_unittest-snappy_unittest.o
operator delete[](void*) snappy_unittest-snappy_unittest.o
operator delete(void*) snappy_unittest-snappy_unittest.o
std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_leak_hard() snappy_unittest-snappy_unittest.o
std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) snappy_unittest-snappy_unittest.o
std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_S_empty_rep_storage snappy_unittest-snappy_unittest.o
std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, unsigned long, std::allocator<char> const&) snappy_unittest-snappy_unittest.o
std::__throw_bad_alloc() snappy_unittest-snappy_unittest.o
std::basic_ostream<char, std::char_traits<char> >::flush() snappy_unittest-snappy_unittest.o
std::basic_string<char, std::char_traits<char>, std::allocator<char> >::reserve(unsigned long) snappy_unittest-snappy_unittest.o
std::cerr snappy_unittest-snappy_unittest.o
std::basic_string<char, std::char_traits<char>, std::allocator<char> >::resize(unsigned long, char) snappy_unittest-snappy_unittest.o
vtable for __cxxabiv1::__class_type_info ./.libs/libsnappy.so
std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_M_destroy(std::allocator<char> const&) snappy_unittest-snappy_unittest.o
std::ios_base::Init::~Init() snappy_unittest-snappy_unittest.o
std::ios_base::Init::Init() snappy_unittest-snappy_unittest.o
__gxx_personality_v0 snappy_unittest-snappy_unittest.o
std::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign(char const*, unsigned long) snappy_unittest-snappy-test.o
std::basic_string<char, std::char_traits<char>, std::allocator<char> >::assign(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) snappy_unittest-snappy-test.o
__cxa_pure_virtual ./.libs/libsnappy.so
std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long) snappy_unittest-snappy_unittest.o
__cxa_rethrow snappy_unittest-snappy_unittest.o
std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&) snappy_unittest-snappy_unittest.o
ld: fatal: symbol referencing errors. No output written to .libs/snappy_unittest
collect2: error: ld returned 1 exit status
Makefile:399: recipe for target 'snappy_unittest' failed
gmake[2]: *** [snappy_unittest] Error 1
gmake[2]: Leaving directory '/root/erocksdb/c_src/snappy-1.1.1'
Makefile:301: recipe for target 'all' failed
gmake[1]: *** [all] Error 2
gmake[1]: Leaving directory '/root/erocksdb/c_src/snappy-1.1.1'
Makefile:12: recipe for target 'compile' failed
make: *** [compile] Error 2
mmm i would be interrested to fix it. How could I test easily?
There are SmartOS vmware images that can get you started, or I'll try to get you a zone I'll check.
I will check. In the mean time can you try the patch below?
diff --git a/c_src/build_deps.sh b/c_src/build_deps.sh
index 107b6ae..1752301 100755
--- a/c_src/build_deps.sh
+++ b/c_src/build_deps.sh
@@ -67,7 +67,7 @@ case "$1" in
(cd snappy-$SNAPPY_VSN && $MAKE && $MAKE install)
- export CFLAGS="$CFLAGS -I $BASEDIR/system/include"
+ export CFLAGS="$CFLAGS -fno-omit-frame-pointer -I $BASEDIR/system/include"
export CXXFLAGS="$CXXFLAGS -I $BASEDIR/system/include"
export LDFLAGS="$LDFLAGS -L$BASEDIR/system/lib"
export LD_LIBRARY_PATH="$BASEDIR/system/lib:$LD_LIBRARY_PATH"
trying it out and preparing a test zone in the meantime ;)
no effect from what I can tell
ah forgot it for the unittests( the section above in the Makefile). Shouldn't be hard anyway, probably just a flag.
CC=/opt/local/gcc49/bin/gcc make will run in a zone and fail as above, @ipalreadytaken has created a zone and I set it up with the packages for compilation will coordinate ip/pub key off channel.
Hi,
I tested on the node you gave me and went a little further in building erocksdb by doing the following:
- set PATH to point to the gcc binaries:
export PATH=$PATH:/opt/local/gcc49/bin - do the following diff:
[root@leo-test ~/erocksdb]# git diff
diff --git a/c_src/build_deps.sh b/c_src/build_deps.sh
index 71e36bc..222ca5c 100755
--- a/c_src/build_deps.sh
+++ b/c_src/build_deps.sh
@@ -8,7 +8,7 @@ if [ `uname -s` = 'SunOS' -a "${POSIX_SHELL}" != "true" ]; then
fi
unset POSIX_SHELL # clear it so if we invoke other scripts, they run as ksh as well
-ROCKSDB_VSN="rocksdb-3.11.2"
+ROCKSDB_VSN="rocksdb-4.1"
SNAPPY_VSN="1.1.1"
@@ -30,6 +30,18 @@ MAKE=${MAKE:-make}
# Changed "make" to $MAKE
+[ "$SYSTEM" ] || SYSTEM=`(uname -s) 2>/dev/null` || SYSTEM="unknown"
+
+CXX=
+CXXFLAGS="-fPIC"
+case "$SYSTEM" in
+ Solaris|SunOS)
+ CXX="gcc -Wno-return-type -Wno-sign-compare -Wno-unused-but-set-variable -std=c++11 -D_GLIBCXX_USE_C99 -D_GLIBCXX_USE_C99_MATH -D_GLIBCXX_USE_C99_MATH_TR1"
+ ;;
+ *)
+ ;;
+esac
+
case "$1" in
rm-deps)
rm -rf rocksdb system snappy-$SNAPPY_VSN
@@ -77,7 +89,7 @@ case "$1" in
(cd rocksdb && git checkout $ROCKSDB_VSN)
fi
if [ ! -f rocksdb/librocksdb.a ]; then
- (cd rocksdb && CXXFLAGS=-fPIC $MAKE static_lib)
+ (cd rocksdb && CXXFLAGS=$CXXFLAGS CXX=$CXX $MAKE static_lib)
fi
;;
esac
However it crashes with the following error:
CC utilities/geodb/geodb_impl.o
utilities/geodb/geodb_impl.cc: In member function 'rocksdb::Status rocksdb::GeoDBImpl::searchQuadIds(const rocksdb::GeoPosition&, double, std::vector<std::basic_string<char> >*)':
utilities/geodb/geodb_impl.cc:300:72: error: call of overloaded 'floor(unsigned int)' is ambiguous
int numberOfTilesAtMaxDepth = floor((bottomRight.x - topLeft.x) / 256);
^
utilities/geodb/geodb_impl.cc:300:72: note: candidates are:
In file included from /opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/include-fixed/math.h:47:0,
from /opt/local/gcc49/include/c++/cmath:44,
from /opt/local/gcc49/include/c++/random:38,
from /opt/local/gcc49/include/c++/bits/stl_algo.h:66,
from /opt/local/gcc49/include/c++/algorithm:62,
from ./utilities/geodb/geodb_impl.h:10,
from utilities/geodb/geodb_impl.cc:8:
/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/include-fixed/iso/math_iso.h:214:21: note: long double std::floor(long double)
inline long double floor(long double __X) { return __floorl(__X); }
^
/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/include-fixed/iso/math_iso.h:185:15: note: float std::floor(float)
inline float floor(float __X) { return __floorf(__X); }
^
/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/include-fixed/iso/math_iso.h:98:15: note: double std::floor(double)
extern double floor __P((double));
^
utilities/geodb/geodb_impl.cc:301:61: error: call of overloaded 'log(int&)' is ambiguous
int zoomLevelsToRise = floor(::log(numberOfTilesAtMaxDepth) / ::log(2));
^
utilities/geodb/geodb_impl.cc:301:61: note: candidates are:
In file included from /opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/include-fixed/math.h:47:0,
from /opt/local/gcc49/include/c++/cmath:44,
from /opt/local/gcc49/include/c++/random:38,
from /opt/local/gcc49/include/c++/bits/stl_algo.h:66,
from /opt/local/gcc49/include/c++/algorithm:62,
from ./utilities/geodb/geodb_impl.h:10,
from utilities/geodb/geodb_impl.cc:8:
/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/include-fixed/iso/math_iso.h:221:21: note: long double std::log(long double)
inline long double log(long double __X) { return __logl(__X); }
^
/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/include-fixed/iso/math_iso.h:189:15: note: float std::log(float)
inline float log(float __X) { return __logf(__X); }
^
/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/include-fixed/iso/math_iso.h:89:15: note: double std::log(double)
extern double log __P((double));
^
utilities/geodb/geodb_impl.cc:301:72: error: call of overloaded 'log(int)' is ambiguous
int zoomLevelsToRise = floor(::log(numberOfTilesAtMaxDepth) / ::log(2));
^
utilities/geodb/geodb_impl.cc:301:72: note: candidates are:
In file included from /opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/include-fixed/math.h:47:0,
from /opt/local/gcc49/include/c++/cmath:44,
from /opt/local/gcc49/include/c++/random:38,
from /opt/local/gcc49/include/c++/bits/stl_algo.h:66,
from /opt/local/gcc49/include/c++/algorithm:62,
from ./utilities/geodb/geodb_impl.h:10,
from utilities/geodb/geodb_impl.cc:8:
/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/include-fixed/iso/math_iso.h:221:21: note: long double std::log(long double)
inline long double log(long double __X) { return __logl(__X); }
^
/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/include-fixed/iso/math_iso.h:189:15: note: float std::log(float)
inline float log(float __X) { return __logf(__X); }
^
/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/include-fixed/iso/math_iso.h:89:15: note: double std::log(double)
extern double log __P((double));
^
utilities/geodb/geodb_impl.cc: In static member function 'static rocksdb::GeoDBImpl::Tile rocksdb::GeoDBImpl::PixelToTile(const rocksdb::GeoDBImpl::Pixel&)':
utilities/geodb/geodb_impl.cc:356:43: error: call of overloaded 'floor(unsigned int)' is ambiguous
unsigned int tileX = floor(pixel.x / 256);
^
utilities/geodb/geodb_impl.cc:356:43: note: candidates are:
In file included from /opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/include-fixed/math.h:47:0,
from /opt/local/gcc49/include/c++/cmath:44,
from /opt/local/gcc49/include/c++/random:38,
from /opt/local/gcc49/include/c++/bits/stl_algo.h:66,
from /opt/local/gcc49/include/c++/algorithm:62,
from ./utilities/geodb/geodb_impl.h:10,
from utilities/geodb/geodb_impl.cc:8:
/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/include-fixed/iso/math_iso.h:214:21: note: long double std::floor(long double)
inline long double floor(long double __X) { return __floorl(__X); }
^
/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/include-fixed/iso/math_iso.h:185:15: note: float std::floor(float)
inline float floor(float __X) { return __floorf(__X); }
^
/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/include-fixed/iso/math_iso.h:98:15: note: double std::floor(double)
extern double floor __P((double));
^
utilities/geodb/geodb_impl.cc:357:43: error: call of overloaded 'floor(unsigned int)' is ambiguous
unsigned int tileY = floor(pixel.y / 256);
^
utilities/geodb/geodb_impl.cc:357:43: note: candidates are:
In file included from /opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/include-fixed/math.h:47:0,
from /opt/local/gcc49/include/c++/cmath:44,
from /opt/local/gcc49/include/c++/random:38,
from /opt/local/gcc49/include/c++/bits/stl_algo.h:66,
from /opt/local/gcc49/include/c++/algorithm:62,
from ./utilities/geodb/geodb_impl.h:10,
from utilities/geodb/geodb_impl.cc:8:
/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/include-fixed/iso/math_iso.h:214:21: note: long double std::floor(long double)
inline long double floor(long double __X) { return __floorl(__X); }
^
/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/include-fixed/iso/math_iso.h:185:15: note: float std::floor(float)
inline float floor(float __X) { return __floorf(__X); }
^
/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/include-fixed/iso/math_iso.h:98:15: note: double std::floor(double)
extern double floor __P((double));
^
Makefile:1022: recipe for target 'utilities/geodb/geodb_impl.o' failed
gmake[1]: *** [utilities/geodb/geodb_impl.o] Error 1
gmake[1]: Leaving directory '/root/erocksdb/c_src/rocksdb'
Makefile:12: recipe for target 'compile' failed
make: *** [compile] Error 2
I am not sure yet how to fix it. Any idea is welcome. Hopefully it will help :)
same error but I came to a simpler patch:
diff --git a/c_src/build_deps.sh b/c_src/build_deps.sh
index 71e36bc..69ffbf7 100755
--- a/c_src/build_deps.sh
+++ b/c_src/build_deps.sh
@@ -8,7 +8,7 @@ if [ `uname -s` = 'SunOS' -a "${POSIX_SHELL}" != "true" ]; then
fi
unset POSIX_SHELL # clear it so if we invoke other scripts, they run as ksh as well
-ROCKSDB_VSN="rocksdb-3.11.2"
+ROCKSDB_VSN="rocksdb-4.1"
SNAPPY_VSN="1.1.1"
@@ -30,6 +30,18 @@ MAKE=${MAKE:-make}
# Changed "make" to $MAKE
+[ "$SYSTEM" ] || SYSTEM=`(uname -s) 2>/dev/null` || SYSTEM="unknown"
+
+CXX=
+CXXFLAGS="-fPIC -fno-builtin-memcmp"
+case "$SYSTEM" in
+ Solaris|SunOS)
+ CXX="g++ -std=c++11 -D_GLIBCXX_USE_C99"
+ ;;
+ *)
+ ;;
+esac
+
case "$1" in
rm-deps)
rm -rf rocksdb system snappy-$SNAPPY_VSN
@@ -77,7 +89,7 @@ case "$1" in
(cd rocksdb && git checkout $ROCKSDB_VSN)
fi
if [ ! -f rocksdb/librocksdb.a ]; then
- (cd rocksdb && CXXFLAGS=-fPIC $MAKE static_lib)
+ (cd rocksdb && CXXFLAGS=$CXXFLAGS CXX=$CXX $MAKE static_lib)
fi
;;
esac
@benoitc thank you for tackling this issue! It seems that you almost get things done.
The remained error is only error: call of overloaded $FUNCTION is ambiguous.
Those errors have happened because C++ overload resolution failed.
error: call of overloaded 'floor(unsigned int)' is ambiguous
int numberOfTilesAtMaxDepth = floor((bottomRight.x - topLeft.x) / 256);
^
utilities/geodb/geodb_impl.cc:300:72: note: candidates are:
In file included from
/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/include-fixed/math.h:47:0,
opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/include-fixed/iso/math_iso.h:214:21: note: long double std::floor(long double)
inline long double floor(long double __X) { return __floorl(__X); }
^
/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/include-fixed/iso/math_iso.h:185:15: note: float std::floor(float)
inline float floor(float __X) { return __floorf(__X); }
^
/opt/local/gcc49/lib/gcc/x86_64-sun-solaris2.11/4.9.2/include-fixed/iso/math_iso.h:98:15: note: double std::floor(double)
extern double floor __P((double));
In short, there is no function std::floor(unsigned int). there are only std::floor(long double), std::floor(float) and std::floor(double) defined in ISO C++ standard. So gcc49 on SmartOS is correct.
but some compilers on the other platforms have provided the below template function to handle thsese cases ( permit implicit conversion from any int types to double ) .
template<typename _Tp>
inline _GLIBCXX_CONSTEXPR
typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
double>::__type
floor(_Tp __x)
{ return __builtin_floor(__x); }
In those obtrusive compilers ,
template specialization with unsinged int will output a below function.
inline _GLIBCXX_CONSTEXPR
double floor(unsigned int __x)
{ return __builtin_floor(__x); }
Since there is a function floor(unsinged int), Function overload will be resolved and works fine...
So there are 2 ways to solve this issue.
- Fix rocksdb/geodb to get rid of improper
std::floorcalls and replacestd::log(2)withstd::log(2f). - Fix gcc49 on SmartOS to include the helper template described above.
IMHO, 1 should be the right direction.
Fix rocksdb/geodb to get rid of improper std::floor calls and replace std::log(2) with std::log(2f).
Yup, this is the right way. Would really appreciate a PR to fix this.
Very nice investigation, thanks!
@igorcanadi Sure! I'll PR later.
note: Compile on FreeBSD will be fixed by @benoitc 's patch
note: Filed on https://github.com/facebook/rocksdb/issues/956
note: Got to succeed in compiling and passing all the unit tests with gcc47 on smartos by applying the below patch and switch some errors into warnings and set _GLIBCXX_USE_SCHED_YIELD to enable using std::this_thread::yield
- patch (there are no
std::map::emplace_hint)
diff --git a/db/version_set.cc b/db/version_set.cc
index 5198053..ef096e1 100644
--- a/db/version_set.cc
+++ b/db/version_set.cc
@@ -1924,7 +1924,8 @@ uint64_t VersionStorageInfo::EstimateLiveDataSize() const {
found_end = (lb == ranges.end());
if (found_end || internal_comparator_->Compare(
file->largest, (*lb).second->smallest) < 0) {
- ranges.emplace_hint(lb, &file->largest, file);
+ //ranges.emplace_hint(lb, &file->largest, file);
+ ranges[&file->largest] = file;
size += file->fd.file_size;
}
}
- make with switches for converting some errors into warnings.
CXXFLAGS="-D _GLIBCXX_USE_SCHED_YIELD -Wno-error=sign-compare -Wno-error=conversion-null" make
I'll try gcc49 on smartos next week.
@mocchira maybe we could have some support for custom patches to the erocksdb build? All patches would be in a patches directory and applied one by one on the rocksdb source code depending on the platform. So we don't have to wait for a rocksdb release? Thoughts?
@benoitc right as a temporal solution until those patches merged into upstream. We'd like to have a patches directory for FreeBSD, SmartOS for now. So temporal patches are welcome!
@Licenser It seems https://github.com/facebook/rocksdb/pull/954/files has fixed this issue. Since this fix is still only on master, The latest erocksdb with the below patch may work.
diff --git a/c_src/build_deps.sh b/c_src/build_deps.sh
index 71e36bc..69ffbf7 100755
--- a/c_src/build_deps.sh
+++ b/c_src/build_deps.sh
-ROCKSDB_VSN="rocksdb-4.1"
+ROCKSDB_VSN="master"
As I and @benoitc said at the previous comment, We are considering to provide custom patches until each stable releases for rocksdb. please let us know if you want to try erocksdb before the next stable release for rocksdb.
Sorry for the late reply, I did give master + @benoitc patch a try it keeps failing in new places
gmake[1]: Entering directory '/root/erocksdb/c_src/rocksdb'
GEN util/build_version.cc
GEN util/build_version.cc
CC db/auto_roll_logger.o
In file included from ./util/statistics.h:14:0,
from ./util/stop_watch.h:8,
from ./util/perf_step_timer.h:9,
from ./util/iostats_context_imp.h:8,
from ./util/posix_logger.h:27,
from ./port/util_logger.h:18,
from ./db/auto_roll_logger.h:15,
from db/auto_roll_logger.cc:6:
./util/mutexlock.h: In member function 'void rocksdb::SpinMutex::lock()':
./util/mutexlock.h:106:9: error: 'yield' is not a member of 'std::this_thread'
Makefile:1252: recipe for target 'db/auto_roll_logger.o' failed
gmake[1]: *** [db/auto_roll_logger.o] Error 1
gmake[1]: Leaving directory '/root/erocksdb/c_src/rocksdb'
Makefile:12: recipe for target 'compile' failed
make: *** [compile] Error 2
I wish I could do more but c is a deep and dark rabbit hole for me
@Licenser Thank you for trying. you might also need to do this hack ( https://github.com/leo-project/erocksdb/issues/12#issuecomment-173854418 ) .
If that works for you, I'm going to commit those changes into build_deps.sh and rebar.config in order to compile properly on Smart OS.
Not even getting that far, it seems to be a issue with using 'yield'
I think I worked around that last issue all tests are passing now I'll try to re-plicate that!
@Licenser
Not even getting that far, it seems to be a issue with using 'yield'
Hmm.
In my Smart OS (the latest) on VMware with gcc47, gcc49,
As described at https://github.com/leo-project/erocksdb/issues/12#issuecomment-173854418 ,
-D _GLIBCXX_USE_SCHED_YIELD compile option enable gcc4[7-9] to use std::this_thread::yield and works fine.
Before trying to install erocksdb, I'd ask you to make a rocksdb alone.
$ cd ${rocksdb_root}
CXXFLAGS="-D _GLIBCXX_USE_SCHED_YIELD -Wno-error=sign-compare -Wno-error=conversion-null" make
@Licenser
I think I worked around that last issue all tests are passing now I'll try to re-plicate that!
Sorry for missing the comment. Good to hear that :)