[cfe-dev] [libcxx] compilation problems with 'long long'

Lenny Maiorani lenny at Colorado.EDU
Wed Feb 1 13:58:06 PST 2012


Hello,

I am trying to switch my project (based on FreeBSD7.3) to compile using Clang with the modern libc++. In order to do this, I need to get libc++ compiled. However there are a few problems. I am using the Clang from TOT which was built with GCC 4.2.1.

Below is an excerpt from the failed compilation. What I am doing wrong here?

Thanks,
-Lenny



[lenny at tahiti ~/bt/libcxx/lib]$ ./buildit
+ clang++ -c -g -Os -fPIC -std=c++0x -fstrict-aliasing -Wall -Wextra -Wshadow -Wconversion -Wnewline-eof -Wpadded -Wmissing-prototypes -Wstrict-aliasing=2 -Wstrict-overflow=4 -nostdinc++ -I../include ../src/algorithm.cpp
In file included from ../src/algorithm.cpp:10:
In file included from ../include/algorithm:596:
../include/cstdlib:96:9: error: no member named 'lldiv_t' in the global namespace
using ::lldiv_t;
      ~~^
../include/cstdlib:100:9: error: no member named 'atoll' in the global namespace
using ::atoll;
      ~~^
../include/cstdlib:105:9: error: no member named 'strtoll' in the global namespace
using ::strtoll;
      ~~^
../include/cstdlib:107:9: error: no member named 'strtoull' in the global namespace
using ::strtoull;
      ~~^
../include/cstdlib:124:9: error: no member named 'llabs' in the global namespace
using ::llabs;
      ~~^
../include/cstdlib:127:9: error: no member named 'lldiv' in the global namespace
using ::lldiv;
      ~~^
../include/cstdlib:136:71: error: use of undeclared identifier 'llabs'; did you mean 'labs'?
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) {return llabs(__x);}
                                                                      ^~~~~
                                                                      labs
/usr/include/stdlib.h:96:7: note: 'labs' declared here
long     labs(long) __pure2;
         ^
In file included from ../src/algorithm.cpp:10:
In file included from ../include/algorithm:596:
../include/cstdlib:139:34: error: unknown type name 'lldiv_t'; did you mean 'ldiv_t'?
inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) {return lldiv(__x, __y);}
                                 ^~~~~~~
                                 ldiv_t
/usr/include/stdlib.h:71:3: note: 'ldiv_t' declared here
} ldiv_t;
  ^
In file included from ../src/algorithm.cpp:10:
In file included from ../include/algorithm:596:
../include/cstdlib:139:84: error: use of undeclared identifier 'lldiv'; did you mean 'ldiv'?
inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) {return lldiv(__x, __y);}
                                                                                   ^~~~~
                                                                                   ldiv

-------------- snip snip ------------------------------------------

In file included from ../src/algorithm.cpp:11:
In file included from ../include/random:1645:
In file included from ../include/istream:156:
In file included from ../include/ostream:130:
In file included from ../include/ios:216:
In file included from ../include/__locale:18:
In file included from ../include/mutex:176:
In file included from ../include/__mutex_base:15:
In file included from ../include/chrono:255:
../include/ratio:193:19: error: static_assert expression is not an integral constant expression
    static_assert(_Xp != nan && _Yp != nan && __a_x <= max / __a_y, "overflow in __ll_mul");
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../include/ratio:308:13: note: in instantiation of template class 'std::__1::__ll_mul<1, 1>' requested here
            __ll_mul<_R1::num / __gcd_n1_n2, _R2::den / __gcd_d1_d2>::value,
            ^
../include/ratio:315:33: note: in instantiation of template class 'std::__1::__ratio_divide<std::__1::ratio<1, 1000000000>, std::__1::ratio<1, 1000000000> >' requested here
template <class _R1, class _R2> using ratio_divide
                                ^
../include/chrono:410:18: note: in instantiation of template type alias 'ratio_divide' requested here
                (ratio_divide<_Period2, period>::type::den == 1 &&
                 ^
../include/chrono:406:9: note: while substituting deduced template arguments into function template 'duration' [with _Rep2 = long long, _Period2 = ]
        duration(const duration<_Rep2, _Period2>& __d,
        ^
../include/ratio:193:26: note: initializer of 'nan' is not a constant expression
    static_assert(_Xp != nan && _Yp != nan && __a_x <= max / __a_y, "overflow in __ll_mul");
                         ^
../include/ratio:187:27: note: declared here
    static const intmax_t nan = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1));
                          ^
../include/ratio:187:27: note: declared here
../include/ratio:189:27: note: declared here
    static const intmax_t max = -min;
                          ^
In file included from ../src/algorithm.cpp:11:
In file included from ../include/random:1645:
In file included from ../include/istream:156:
In file included from ../include/ostream:130:
In file included from ../include/ios:216:
../include/__locale:25:11: fatal error: 'xlocale.h' file not found
# include <xlocale.h>
          ^
13 errors generated.





More information about the cfe-dev mailing list