[cfe-dev] Problem with libc++

Jean-Daniel Dupas devlists at shadowlab.org
Tue Apr 3 11:24:10 PDT 2012


AFAIK, you don't have too use -nostdinc++. clang lookups libc++ headers relatively to its resources directory, so if you install your custom clang in /usr/local/bin, just put them in /usr/local/lib/c++/v1 and it should works.

Le 3 avr. 2012 à 18:40, Seth Cantrell a écrit :

> I don't think you want to replace the built-in headers or libraries.
> Instead you should probably set up the version of libc++ you want
> somewhere, disable the standard c++ library in your project with
> -nostdinc++ and then point your Xcode project at the libc++ build you
> set up using the search path and linker options.
> 
> On the command line this might look like:
> 
> clang++ -nostdinc++ -H../libcxx/include -L../libcxx/lib -lc++ main.cpp
> 
> On Apr 3, 2012, at 12:25 PM, Dix Lorenz <dlorenz at medimach.de> wrote:
> 
>> 
>> On 03.04.2012, at 17:38, Jean-Daniel Dupas wrote:
>> 
>>> 
>>> Le 3 avr. 2012 à 17:20, Howard Hinnant a écrit :
>>> 
>>>> On Apr 3, 2012, at 10:36 AM, Dix Lorenz wrote:
>>>> 
>>>>> I don't know if this is the right place for this, if not please direct me to a better place.
>>>>> 
>>>>> I just downloaded clang and libc++ trunk. This code fails:
>>>>> 
>>>>> #include <string>
>>>>> #include <vector>
>>>>> 
>>>>> using namespace std;
>>>>> 
>>>>> int main(int argc, const char * argv[])
>>>>> {
>>>>>   vector<string> v;
>>>>>   v.push_back("Hello"); // <--- error here
>>>>> 
>>>>> return 0;
>>>>> }
>>>>> 
>>>>> The error is "no viable overloaded '='". It seems as if moving strings is broken...
>>>>> 
>>>>> This is in Xcode 4.3.2 (with the include directory from libc++ trunk replacing /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/c++/v1). If I switch to the "normal" clang Compiler in Xcode it works. If I switch from using "libc++" to "libstdc++" it also works, its the combination of the current clang and libc++ that have this problem.
>>>>> 
>>>>> /opt/bin/clang --version
>>>>> clang version 3.1 (trunk 153948)
>>>>> Target: x86_64-apple-darwin11.3.0
>>>> 
>>>> This is looking like a clang problem.  I've got TOT libc++, but a slightly older clang and I'm not seeing this behavior.
>>>> 
>>>> Howard
>>> 
>>> 
>>> I don't think. I have a TOT clang & libc++, and don't have any issue. Probably a problem with the way clang and libc++ are used with Xcode.
>> 
>> 
>> Spot on!
>> 
>> Xcode has (at least) 2 locations for the c++ headers, one in Xcode/Developer/Toolchains and another in Xcode/Developer/Platforms/MacOSX.platform/blablabla. I had replaced the one in Toolchains with the libc++ ToT headers, but not the other. Still figuring out how and when it uses which headers, but indeed it's an Xcode problem. Or rather a problem with me not understanding how Xcode works :-)
>> 
>> Thanks,
>> Dix
>> 
>> 
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-- Jean-Daniel








More information about the cfe-dev mailing list