[SERVER-10168] compile error on smartos/solaris (s2 library) Created: 10/Jul/13  Updated: 10/Dec/14  Resolved: 01/Nov/14

Status: Closed
Project: Core Server
Component/s: Geo
Affects Version/s: 2.4.5
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Jens Davidsen Assignee: Mark Benvenuto
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

smartos, gcc4.7

[root@db01 ~/mongodb-src-r2.4.5]# uname -a
SunOS db01 5.11 joyent_20130516T202746Z i86pc i386 i86pc Solaris

[root@db01 ~/mongodb-src-r2.4.5]# gcc -v
Using built-in specs.
COLLECT_GCC=/opt/local/gcc47/bin/gcc
COLLECT_LTO_WRAPPER=/opt/local/gcc47/libexec/gcc/x86_64-sun-solaris2.11/4.7.2/lto-wrapper
Target: x86_64-sun-solaris2.11
Configured with: ../gcc-4.7.2/configure -enable-languages='c go fortran c+' --enable-shared --enable-long-long --with-local-prefix=/opt/local/gcc47 --enable-libssp --enable-threads=posix --with-boot-ldflags='-static-libstdc+ -static-libgcc -Wl,-R/opt/local/lib ' --disable-nls --enable__cxa_atexit --with-gxx-include-dir=/opt/local/gcc47/include/c++/ --without-gnu-ld --with-ld=/usr/bin/ld --with-gnu-as --with-as=/opt/local/bin/gas --prefix=/opt/local/gcc47 --build=x86_64-sun-solaris2.11 --host=x86_64-sun-solaris2.11 --infodir=/opt/local/gcc47/info --mandir=/opt/local/gcc47/man
Thread model: posix
gcc version 4.7.2 (GCC)

scons version: 2.2.0
python version: 2 7 3 'final' 0
Checking whether the C++ compiler worksyes
Checking for C header file unistd.h... yes
Checking for C library rt... yes
Checking for C++ header file execinfo.h... yes
Checking whether backtrace is declared... yes
Checking whether backtrace_symbols is declared... yes
Checking for C library pcap... yes
Checking for C library nsl... yes


Issue Links:
Duplicate
is duplicated by SERVER-14015 S2 Compilation on GCC 4.9/Solaris fails Closed
Related
Operating System: Solaris
Steps To Reproduce:

scons --cc=/opt/local/bin/gcc --cxx=/opt/local/bin/g++ --64 --ssl --cpppath=/opt/local/include --extrapath=/opt/local all

Participants:

 Description   

compile error:
call of overloaded 'sqrt(int)' is ambiguous

/opt/local/bin/g++ -o build/sunos5/64/cc__opt_local_bin_gcc/cpppath__opt_local_include/cxx__opt_local_bin_g++/extrapath__opt_local/ssl/third_party/s2/s2.o -c -Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -O3 -m64 -Isrc/third_party/s2 -DDEBUG_MODE=false -DBOOST_ALL_NO_LIB -D_SCONS -DMONGO_EXPOSE_MACROS -DSUPPORT_UTF8 -D__sunos__ -D_FILE_OFFSET_BITS=64 -DMONGO_SSL -DMONGO_HAVE_HEADER_UNISTD_H -DMONGO_HAVE_EXECINFO_BACKTRACE -Ibuild/sunos5/64/cc__opt_local_bin_gcc/cpppath__opt_local_include/cxx__opt_local_bin_g++/extrapath__opt_local/ssl/third_party/libstemmer_c/include -Isrc/third_party/libstemmer_c/include -Ibuild/sunos5/64/cc__opt_local_bin_gcc/cpppath__opt_local_include/cxx__opt_local_bin_g++/extrapath__opt_local/ssl/third_party/s2 -Isrc/third_party/s2 -Ibuild/sunos5/64/cc__opt_local_bin_gcc/cpppath__opt_local_include/cxx__opt_local_bin_g++/extrapath__opt_local/ssl/third_party/boost -Isrc/third_party/boost -Ibuild/sunos5/64/cc__opt_local_bin_gcc/cpppath__opt_local_include/cxx__opt_local_bin_g++/extrapath__opt_local/ssl/third_party/pcre-8.30 -Isrc/third_party/pcre-8.30 -Ibuild/sunos5/64/cc__opt_local_bin_gcc/cpppath__opt_local_include/cxx__opt_local_bin_g++/extrapath__opt_local/ssl -Isrc -Ibuild/sunos5/64/cc__opt_local_bin_gcc/cpppath__opt_local_include/cxx__opt_local_bin_g++/extrapath__opt_local/ssl/mongo -Isrc/mongo -I/opt/local/include -I/opt/local/include src/third_party/s2/s2.cc
src/third_party/s2/s2.cc:702:60: error: call of overloaded 'sqrt(int)' is ambiguous
src/third_party/s2/s2.cc:702:60: note: candidates are:
In file included from /opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/math.h:46:0,
                 from src/third_party/s2/util/math/vector3-inl.h:37,
                 from src/third_party/s2/s2.h:26,
                 from src/third_party/s2/s2.cc:3:
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:232:21: note: long double std::sqrt(long double)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:198:15: note: float std::sqrt(float)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:93:15: note: double std::sqrt(double)
src/third_party/s2/s2.cc:703:58: error: call of overloaded 'sqrt(int)' is ambiguous
src/third_party/s2/s2.cc:703:58: note: candidates are:
In file included from /opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/math.h:46:0,
                 from src/third_party/s2/util/math/vector3-inl.h:37,
                 from src/third_party/s2/s2.h:26,
                 from src/third_party/s2/s2.cc:3:
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:232:21: note: long double std::sqrt(long double)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:198:15: note: float std::sqrt(float)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:93:15: note: double std::sqrt(double)
src/third_party/s2/s2.cc:716:55: error: call of overloaded 'sqrt(int)' is ambiguous
src/third_party/s2/s2.cc:716:55: note: candidates are:
In file included from /opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/math.h:46:0,
                 from src/third_party/s2/util/math/vector3-inl.h:37,
                 from src/third_party/s2/s2.h:26,
                 from src/third_party/s2/s2.cc:3:
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:232:21: note: long double std::sqrt(long double)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:198:15: note: float std::sqrt(float)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:93:15: note: double std::sqrt(double)
src/third_party/s2/s2.cc:717:60: error: call of overloaded 'sqrt(int)' is ambiguous
src/third_party/s2/s2.cc:717:60: note: candidates are:
In file included from /opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/math.h:46:0,
                 from src/third_party/s2/util/math/vector3-inl.h:37,
                 from src/third_party/s2/s2.h:26,
                 from src/third_party/s2/s2.cc:3:
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:232:21: note: long double std::sqrt(long double)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:198:15: note: float std::sqrt(float)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:93:15: note: double std::sqrt(double)
src/third_party/s2/s2.cc:718:58: error: call of overloaded 'sqrt(int)' is ambiguous
src/third_party/s2/s2.cc:718:58: note: candidates are:
In file included from /opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/math.h:46:0,
                 from src/third_party/s2/util/math/vector3-inl.h:37,
                 from src/third_party/s2/s2.h:26,
                 from src/third_party/s2/s2.cc:3:
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:232:21: note: long double std::sqrt(long double)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:198:15: note: float std::sqrt(float)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:93:15: note: double std::sqrt(double)
src/third_party/s2/s2.cc:731:55: error: call of overloaded 'sqrt(int)' is ambiguous
src/third_party/s2/s2.cc:731:55: note: candidates are:
In file included from /opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/math.h:46:0,
                 from src/third_party/s2/util/math/vector3-inl.h:37,
                 from src/third_party/s2/s2.h:26,
                 from src/third_party/s2/s2.cc:3:
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:232:21: note: long double std::sqrt(long double)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:198:15: note: float std::sqrt(float)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:93:15: note: double std::sqrt(double)
src/third_party/s2/s2.cc:732:55: error: call of overloaded 'sqrt(int)' is ambiguous
src/third_party/s2/s2.cc:732:55: note: candidates are:
In file included from /opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/math.h:46:0,
                 from src/third_party/s2/util/math/vector3-inl.h:37,
                 from src/third_party/s2/s2.h:26,
                 from src/third_party/s2/s2.cc:3:
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:232:21: note: long double std::sqrt(long double)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:198:15: note: float std::sqrt(float)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:93:15: note: double std::sqrt(double)
src/third_party/s2/s2.cc:733:58: error: call of overloaded 'sqrt(int)' is ambiguous
src/third_party/s2/s2.cc:733:58: note: candidates are:
In file included from /opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/math.h:46:0,
                 from src/third_party/s2/util/math/vector3-inl.h:37,
                 from src/third_party/s2/s2.h:26,
                 from src/third_party/s2/s2.cc:3:
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:232:21: note: long double std::sqrt(long double)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:198:15: note: float std::sqrt(float)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:93:15: note: double std::sqrt(double)
src/third_party/s2/s2.cc:737:55: error: call of overloaded 'sqrt(int)' is ambiguous
src/third_party/s2/s2.cc:737:55: note: candidates are:
In file included from /opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/math.h:46:0,
                 from src/third_party/s2/util/math/vector3-inl.h:37,
                 from src/third_party/s2/s2.h:26,
                 from src/third_party/s2/s2.cc:3:
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:232:21: note: long double std::sqrt(long double)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:198:15: note: float std::sqrt(float)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:93:15: note: double std::sqrt(double)
src/third_party/s2/s2.cc:749:60: error: call of overloaded 'sqrt(int)' is ambiguous
src/third_party/s2/s2.cc:749:60: note: candidates are:
In file included from /opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/math.h:46:0,
                 from src/third_party/s2/util/math/vector3-inl.h:37,
                 from src/third_party/s2/s2.h:26,
                 from src/third_party/s2/s2.cc:3:
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:232:21: note: long double std::sqrt(long double)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:198:15: note: float std::sqrt(float)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:93:15: note: double std::sqrt(double)
src/third_party/s2/s2.cc:750:65: error: call of overloaded 'sqrt(int)' is ambiguous
src/third_party/s2/s2.cc:750:65: note: candidates are:
In file included from /opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/math.h:46:0,
                 from src/third_party/s2/util/math/vector3-inl.h:37,
                 from src/third_party/s2/s2.h:26,
                 from src/third_party/s2/s2.cc:3:
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:232:21: note: long double std::sqrt(long double)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:198:15: note: float std::sqrt(float)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:93:15: note: double std::sqrt(double)
src/third_party/s2/s2.cc:751:58: error: call of overloaded 'sqrt(int)' is ambiguous
src/third_party/s2/s2.cc:751:58: note: candidates are:
In file included from /opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/math.h:46:0,
                 from src/third_party/s2/util/math/vector3-inl.h:37,
                 from src/third_party/s2/s2.h:26,
                 from src/third_party/s2/s2.cc:3:
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:232:21: note: long double std::sqrt(long double)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:198:15: note: float std::sqrt(float)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:93:15: note: double std::sqrt(double)
src/third_party/s2/s2.cc:764:51: error: call of overloaded 'sqrt(int)' is ambiguous
src/third_party/s2/s2.cc:764:51: note: candidates are:
In file included from /opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/math.h:46:0,
                 from src/third_party/s2/util/math/vector3-inl.h:37,
                 from src/third_party/s2/s2.h:26,
                 from src/third_party/s2/s2.cc:3:
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:232:21: note: long double std::sqrt(long double)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:198:15: note: float std::sqrt(float)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:93:15: note: double std::sqrt(double)
src/third_party/s2/s2.cc:765:49: error: call of overloaded 'sqrt(int)' is ambiguous
src/third_party/s2/s2.cc:765:49: note: candidates are:
In file included from /opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/math.h:46:0,
                 from src/third_party/s2/util/math/vector3-inl.h:37,
                 from src/third_party/s2/s2.h:26,
                 from src/third_party/s2/s2.cc:3:
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:232:21: note: long double std::sqrt(long double)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:198:15: note: float std::sqrt(float)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:93:15: note: double std::sqrt(double)
src/third_party/s2/s2.cc:769:41: error: call of overloaded 'sqrt(int)' is ambiguous
src/third_party/s2/s2.cc:769:41: note: candidates are:
In file included from /opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/math.h:46:0,
                 from src/third_party/s2/util/math/vector3-inl.h:37,
                 from src/third_party/s2/s2.h:26,
                 from src/third_party/s2/s2.cc:3:
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:232:21: note: long double std::sqrt(long double)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:198:15: note: float std::sqrt(float)
/opt/local/gcc47/lib/gcc/x86_64-sun-solaris2.11/4.7.2/include-fixed/iso/math_iso.h:93:15: note: double std::sqrt(double)
scons: *** [build/sunos5/64/cc__opt_local_bin_gcc/cpppath__opt_local_include/cxx__opt_local_bin_g++/extrapath__opt_local/ssl/third_party/s2/s2.o] Error 1
scons: building terminated because of errors.



 Comments   
Comment by Eric Milkie [ 21/May/14 ]

NetBSD patched this, but the patch uses C casts to cast numeric literals.
http://pkgsrc-wip.cvs.sourceforge.net/viewvc/pkgsrc-wip/wip/mongodb/patches/patch-src_third__party_s2_s2.cc?revision=1.2&view=markup

Comment by David Hows [ 09/Sep/13 ]

Hi Jens,

Did you get everything built on your end?

Regards,
David

Comment by David Hows [ 02/Sep/13 ]

Hi Jens,

Those two patches don't look to require that version of boost, they appear to be fixes in case you wish to compile MongoDB with your systems boost library as opposed to the bundled version (1.49).

Comment by Jens Davidsen [ 29/Aug/13 ]

how about the two patches for s2 - do they also require BOOST 1.50? (and would that be a problem?)

Comment by David Hows [ 20/Aug/13 ]

One other thing worth noting is that these patches assume that you are using a BOOST 1.50 or greater.

Comment by David Hows [ 20/Aug/13 ]

Hi Jens,

Those two patches you've linked don't look like they would have much of an effect as they are simply casting those calls of sqrt(int) to sqrt(double) to avoid the ambiguous call.

Those other patches in that directly look to make a few other fixes or add specific defines for netbsd.

Regards,
David

Comment by Jens Davidsen [ 19/Aug/13 ]

Hi David,

I just noticed that there is a few patches to fix this issue in the joyent pkgsrc tree:
https://github.com/joyent/pkgsrc-wip/blob/joyent/mongodb/patches/patch-src_third__party_s2_s2.cc
https://github.com/joyent/pkgsrc-wip/blob/joyent/mongodb/patches/patch-src_third__party_s2_s2polygonbuilder.cc

there is also a few more patches:
https://github.com/joyent/pkgsrc-wip/tree/joyent/mongodb/patches

would these patches break other platforms?

Cheers,
Jens

Comment by David Hows [ 19/Aug/13 ]

Hi Jens,

I'm putting together a solaris VM to confirm what may be the issue here.

Just to give you some idea our solaris builds are compiled under gcc version 4.6.2 so I'm not sure if this is an issue in 4.7.2 or an issue with your local gcc environment which is the source of the issue.

Regards,
David

Comment by Jens Davidsen [ 13/Aug/13 ]

Hello David,

It is same result/error...

Comment by David Hows [ 13/Aug/13 ]

Hi Jens,

Can you please try adding "--libpath=/usr/local/lib " to your scons command and see if that resolves the issue?

Regards,
David

Generated at Thu Feb 08 03:22:27 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.