Compiling std::string with clang

Hi,
I am new to LLVM, so I am sorry if the question I am going to ask has already been raised before. I will be thankful if anyone can describe me a quick way to search relevant topics within the list archive,
When I am trying to compile a simple code, containing access to std::string, with clang:

#include
int main()
{
std::string s;
return 0;
}

I am getting a plenty of following errors:

In file included from test_string.cpp:1:
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/…/…/…/…/include/c++/4.1.2/string:46:
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/…/…/…/…/include/c++/4.1.2/bits/char_traits.h:46:
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/…/…/…/…/include/c++/4.1.2/bits/stl_algobase.h:69:
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/…/…/…/…/include/c++/4.1.2/iosfwd:46:
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/…/…/…/…/include/c++/4.1.2/x86_64-redhat-linux/bits/c++io.h:38:
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.1.2/…/…/…/…/include/c++/4.1.2/x86_64-redhat-linux/bits/gthr.h:132:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/…/…/…/…/include/c++/4.1.2/x86_64-redhat-linux/bits/gthr-default.h:100:68: error: weakref declaration must have internal linkage
extern __typeof(pthread_once) __gthrw_pthread_once attribute ((weakref(“pthread_once”)));

In one of the development phorums, I found somebody saying that LLVM does not support gcc 4.1 libraries. Is that true? If yes, which libraries should I use, in case I would like to use llvm 2.9?

Regards,
Dmitry

Dmitry Pidan
Emerging Quality Technologies Group
IBM Haifa Research Lab.
Lotus Notes: Dmitry Pidan/Haifa/IBM@IBMIL
E-mail: pidan1@il.ibm.com
Phone: 972-4-8296036

  Hi,
  I am new to LLVM, so I am sorry if the question I am going to ask has
already been raised before. I will be thankful if anyone can describe me a
quick way to search relevant topics within the list archive,
  When I am trying to compile a simple code, containing access to
std::string, with clang:

    #include <string>
    int main()
    {
          std::string s;
          return 0;
    }

   I am getting a plenty of following errors:

In file included from test_string.cpp:1:
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/string:46:
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/char_traits.h:46:
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h:69:
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/iosfwd:46:
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/c++io.h:38:
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr.h:132:
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/x86_64-redhat-linux/bits/gthr-default.h:100:68:
error: weakref declaration must have internal linkage
extern __typeof(pthread_once) __gthrw_pthread_once __attribute__
((__weakref__("pthread_once")));

   In one of the development phorums, I found somebody saying that LLVM does
not support gcc 4.1 libraries. Is that true? If yes, which libraries should
I use, in case I would like to use llvm 2.9?

Clang questions generally go to the clang development list (+ that
list to this email, replies can drop llvmdev).

In general we recommend you used the latest release of LLVM/Clang (3.1
at this time). The project moves quickly & you'll be lacking a lot of
developments if you're not running up to date (even better: running
top of tree/source builds). The same, basically, goes for the
libstdc++ you're running against - more recent versions are generally
better supported. Try 4.7, for example.

- David

Dmitry,

You may install gcc44-c++ if you use RHEL5 (or its clone).
Clang++ is aware of libstdc++-devel-4.4.x.

Please ask cfe-dev for clang issues.

...Takumi