[cfe-dev] How do I try out C++ modules with clang?
Stephen Kelly
steveire at gmail.com
Tue Oct 21 04:57:44 PDT 2014
Richard Smith <richard at ...> writes:
> libc++ already ships with a module map.
Today I built llvm, clang and libcxx on a Mac (OSX 10.9 I assume), and when
I try to use -fmodules, it can't build the module.modulemap shipped with
libcxx. Any idea what's going wrong?
$ clang++ -E -fmodules test.cpp
# 1 "test.cpp"
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 325 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "test.cpp" 2
While building module 'std' imported from test.cpp:6:
In file included from <module-includes>:4:
In file included from /Users/ske/dev/prefix/bin/../include/c++/v1/ccomplex:21:
In file included from /Users/ske/dev/prefix/bin/../include/c++/v1/complex:247:
In file included from /Users/ske/dev/prefix/bin/../include/c++/v1/sstream:174:
In file included from /Users/ske/dev/prefix/bin/../include/c++/v1/ostream:140:
/Users/ske/dev/prefix/bin/../include/c++/v1/locale:873:26: error: use of
undeclared identifier 'strtoll_l'; did you mean 'wcstoll_l'?
long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
^
/usr/include/xlocale/_wchar.h:98:2: note: 'wcstoll_l' declared here
wcstoll_l(const wchar_t * __restrict, wchar_t ** __restrict, int,
^
While building module 'std' imported from test.cpp:6:
In file included from <module-includes>:4:
In file included from /Users/ske/dev/prefix/bin/../include/c++/v1/ccomplex:21:
In file included from /Users/ske/dev/prefix/bin/../include/c++/v1/complex:247:
In file included from /Users/ske/dev/prefix/bin/../include/c++/v1/sstream:174:
In file included from /Users/ske/dev/prefix/bin/../include/c++/v1/ostream:140:
/Users/ske/dev/prefix/bin/../include/c++/v1/locale:873:36: error: cannot
initialize a parameter of type 'const wchar_t *' with an lvalue of type
'const char *'
long long __ll = strtoll_l(__a, &__p2, __base, _LIBCPP_GET_C_LOCALE);
^~~
/usr/include/xlocale/_wchar.h:98:38: note: passing argument to parameter here
wcstoll_l(const wchar_t * __restrict, wchar_t ** __restrict, int,
^
While building module 'std' imported from test.cpp:6:
In file included from <module-includes>:4:
In file included from /Users/ske/dev/prefix/bin/../include/c++/v1/ccomplex:21:
In file included from /Users/ske/dev/prefix/bin/../include/c++/v1/complex:247:
In file included from /Users/ske/dev/prefix/bin/../include/c++/v1/sstream:174:
In file included from /Users/ske/dev/prefix/bin/../include/c++/v1/ostream:140:
/Users/ske/dev/prefix/bin/../include/c++/v1/locale:913:35: error: use of
undeclared identifier 'strtoull_l'; did you mean 'wcstoull_l'?
unsigned long long __ll = strtoull_l(__a, &__p2, __base,
_LIBCPP_GET_C_LOCALE);
^
/usr/include/xlocale/_wchar.h:101:2: note: 'wcstoull_l' declared here
wcstoull_l(const wchar_t * __restrict, wchar_t ** __restrict, int,
^
While building module 'std' imported from test.cpp:6:
In file included from <module-includes>:4:
In file included from /Users/ske/dev/prefix/bin/../include/c++/v1/ccomplex:21:
In file included from /Users/ske/dev/prefix/bin/../include/c++/v1/complex:247:
In file included from /Users/ske/dev/prefix/bin/../include/c++/v1/sstream:174:
In file included from /Users/ske/dev/prefix/bin/../include/c++/v1/ostream:140:
/Users/ske/dev/prefix/bin/../include/c++/v1/locale:913:46: error: cannot
initialize a parameter of type 'const wchar_t *' with an lvalue of type
'const char *'
unsigned long long __ll = strtoull_l(__a, &__p2, __base,
_LIBCPP_GET_C_LOCALE);
^~~
/usr/include/xlocale/_wchar.h:101:39: note: passing argument to parameter here
wcstoull_l(const wchar_t * __restrict, wchar_t ** __restrict, int,
^
While building module 'std' imported from test.cpp:6:
In file included from <module-includes>:4:
In file included from /Users/ske/dev/prefix/bin/../include/c++/v1/ccomplex:21:
In file included from /Users/ske/dev/prefix/bin/../include/c++/v1/complex:247:
In file included from /Users/ske/dev/prefix/bin/../include/c++/v1/sstream:174:
In file included from /Users/ske/dev/prefix/bin/../include/c++/v1/ostream:140:
/Users/ske/dev/prefix/bin/../include/c++/v1/locale:943:28: error: use of
undeclared identifier 'strtold_l'
long double __ld = strtold_l(__a, &__p2, _LIBCPP_GET_C_LOCALE);
^
test.cpp:6:10: fatal error: could not build module 'std'
#include <utility>
~~~~~~~~^
int main(int argc, char** argv)
{
return 0;
}
6 errors generated.
$ cat test.cpp
//#include "foo.h"
//#include <QtCore/qxmlstream.h>
#include <utility>
int main(int argc, char** argv)
{
return 0;
}
$ clang++ --version
clang version 3.6.0
Target: x86_64-apple-darwin13.4.0
Thread model: posix
More information about the cfe-dev
mailing list