Opened 10 years ago

Closed 5 years ago

#6851 closed Bugs (fixed)

64bit build error on Solaris with gcc 4.4.5 and ICU

Reported by: alasdairrr@… Owned by: Artyom Beilis
Milestone: To Be Determined Component: locale
Version: Boost 1.49.0 Severity: Problem
Keywords: Cc:

Description

Hi,

When doing a 64bit build of boost on Solaris with gcc 4.4.5, we're getting the following error:

    "g++"  -ftemplate-depth-128 -O3 -finline-functions -Wno-inline -Wall -pthreads -m64  -DBOOST_ALL_NO_LIB=1 -DBOOST_LOCALE_NO_POSIX_BACKEND=1 -DBOOST_LOCALE_NO_WINAPI_BACKEND=1 -DBOOST_LOCALE_WITH_ICU=1 -DBOOST_THREAD_NO_LIB=1 -DBOOST_THREAD_POSIX -DBOOST_THREAD_USE_LIB=1 -DNDEBUG  -I"." -c -o "bin.v2/libs/locale/build/gcc-4.4.5/release/address-model-64/link-static/threading-multi/icu/formatter.o" "libs/locale/src/icu/formatter.cpp"
 
libs/locale/src/icu/formatter.cpp: In member function 'virtual std::basic_string<_CharT, std::char_traits<_CharT>, std::allocator<_CharT> > boost::locale::impl_icu::number_format<CharType>::format(boost::int64_t, size_t&) const':
libs/locale/src/icu/formatter.cpp:61: error: call of overloaded 'format(boost::int64_t&, icu_49::UnicodeString&)' is ambiguous
/ec/include/unicode/numfmt.h:317: note: candidates are: icu_49::UnicodeString& icu_49::NumberFormat::format(double, icu_49::UnicodeString&) const
/ec/include/unicode/numfmt.h:330: note:                 icu_49::UnicodeString& icu_49::NumberFormat::format(int32_t, icu_49::UnicodeString&) const
/ec/include/unicode/numfmt.h:343: note:                 icu_49::UnicodeString& icu_49::NumberFormat::format(int64_t, icu_49::UnicodeString&) const

This is doing a 64bit build with ICU version v49.1.1 (although the same issue happens with 4.8.1.1).

There are multiple definitions of of the formatter:format method, as can be seen here:

http://svn.boost.org/svn/boost/trunk/libs/locale/src/icu/formatter.cpp

This is the 32bit function definition with the call to icu_fmt:

virtual string_type format(int32_t value,size_t &code_points) const
icu_fmt_->format(::int32_t(value),tmp);

However the 64bit one doesn't make a cast:

virtual string_type format(int64_t value,size_t &code_points) const
icu_fmt_->format(value,tmp);

Fixing this with the following patch fixes the build:

diff -ruN boost_1_49_0.orig/libs/locale/src/icu/formatter.cpp boost_1_49_0/libs/locale/src/icu/formatter.cpp
--- boost_1_49_0.orig/libs/locale/src/icu/formatter.cpp 2011-07-12 14:57:36.000000000 +0100
+++ boost_1_49_0/libs/locale/src/icu/formatter.cpp      2012-05-01 14:27:54.000000000 +0100
@@ -58,7 +58,7 @@
             virtual string_type format(int64_t value,size_t &code_points) const
             {
                 icu::UnicodeString tmp;
-                icu_fmt_->format(value,tmp);
+                icu_fmt_->format(::int64_t(value),tmp);
                 code_points=tmp.countChar32();
                 return cvt_.std(tmp);
             }

Change History (4)

comment:1 by anonymous, 10 years ago

I also observe this in boost 1.49/1.50 on Solaris when compiling under Solaris Studio 12.3. The above patch fixes it.

comment:2 by viboes, 10 years ago

Component: Building Boostlocale
Owner: set to Artyom Beilis

comment:3 by Artyom Beilis, 10 years ago

Status: newassigned

I can't use ::int64_t as it not defined on all compilers for example on some platforms (Windows) we do not have stdint.h so we do not have int64_t in the global namespace.

I'll take a look on it.

comment:4 by Artyom Beilis, 5 years ago

Resolution: fixed
Status: assignedclosed

fixed in dev branch

Note: See TracTickets for help on using tickets.