简体   繁体   English

Mac OS X 10.8和llvm / clang 3.3通过自制程序

[英]Mac OS X 10.8 and llvm/clang 3.3 via homebrew

I have latest version of XCode installed on my Mac OS X 10.8 with LLVM 3.2. 我在带有LLVM 3.2的Mac OS X 10.8上安装了最新版本的XCode。 Now I would like to switch to llvm/clang 3.3. 现在我想切换到llvm / clang 3.3。

In my current project I use CMake with clang 3.2 and libc++ which are working fine. 在我目前的项目中,我使用CMake和clang 3.2以及libc ++,它们运行正常。

Now I thought I could switch using homebrew. 现在我以为我可以用自制软件切换。 So what I did was issuing the following command: 所以我做的是发出以下命令:

brew install llvm --with-clang --with-asan

This built new clang and updated it in /usr/local/bin. 这个构建了新的clang并在/ usr / local / bin中更新了它。

Running cmake with the following parameters: 使用以下参数运行cmake:

cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=/usr/local/bin/clang -DCMAKE_CXX_COMPILER=/usr/local/bin/clang++ ../

Succeeded and my CMake output looks like: 成功,我的CMake输出如下:


-- Compiler: Clang
-- CXX_FLAGS: -Wall -std=c++11 -stdlib=libc++
-- Boost version: 1.53.0
-- adding include directory: /usr/local/include
-- adding include directory: /usr/local/include
-- adding include directory: /usr/local/include
-- adding include directory: /usr/local/include
-- Boost version: 1.53.0
-- Found the following Boost libraries:
--   filesystem
--   system
--   exception
-- Boost version: 1.53.0
-- Found the following Boost libraries:
--   unit_test_framework
--   thread
-- Configuring done
-- Generating done

But if I start building my project I receive an error: 但是,如果我开始构建我的项目,我收到一个错误:


[  2%] Building CXX object code/CMakeFiles/.../resource.cpp.o
In file included from /Users/.../code/net/resource.cpp:1:
/Users/.../resource.hpp:6:10: fatal error: 'string' file not found
#include <string>
         ^
1 error generated.

So obviously standard header is not found, which with clang 3.2 was found. 所以很明显找不到标准的标题,其中发现了clang 3.2。 What can be causing this problem? 什么可能导致这个问题?

Remark: I think my problem is that brew builds llvm/clang with libstdc++ instead of libc++. 备注:我认为我的问题是brew使用libstdc ++而不是libc ++构建llvm / clang。 Is there any way I can force it to use libc++? 有什么办法可以强迫它使用libc ++吗? Or is there any other easy way to upgrade clang on OS X and use libc++? 或者有没有其他简单的方法来升级OS X上的clang并使用libc ++?

-stdlib=libc++添加到构建参数以配置clang以使用libc ++。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM