Macports在OSX 10.9 - 编译与-stdlib = libstdc ++ [英] Macports on OSX 10.9 - compile with -stdlib=libstdc++

查看:309
本文介绍了Macports在OSX 10.9 - 编译与-stdlib = libstdc ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在OSX 10.9中,clang ++的默认 -stdlib 选项是 libc ++ ,这是Macport在构建包时使用的选项。
有没有办法告诉Macports使用 libstdc ++ 而不是?



通过Macports构建OpenCV,所以它使用 libstdc ++ ,但我想我会遇到一个需要这样做其他包以及

-stdlib = libstdc ++

p>如果您需要更好地控制各种端口的构建过程,可以随时设置以下变量:

CXX =clang -std = c ++ 11 -stdlib = libc ++


$ b $ p

>并建立< port> from source:



sudo port -s install< ; port> -universal \

configure.cc =$ {CC}configure.cxx =$ {CXX}\

configure.cflags =$ { CFLAGS}configure.cxxflags =$ {CXXFLAGS}



另一种方法是安装 gcc48 (或以上)端口,并将其用作编译器。不要使用旧版本的Xcode安装的旧gcc-4.2.1。这是垃圾。


In OSX 10.9 the default -stdlib option for clang++ is libc++, so that's what Macport uses when building packages. Is there any way to tell Macports to use libstdc++ instead?

In particular I would like to build OpenCV through Macports so it's using libstdc++, but I imagine I'll run into a need to do so for other packages as well

解决方案

The option is simply: -stdlib=libstdc++

If you need finer control over the build process for various ports, you can always set variables like:
CXX = "clang -std=c++11 -stdlib=libc++, CXXFLAGS = "-Wall -O2 -march=core2", etc.

And build <port> from source:

sudo port -s install <port> -universal \
configure.cc="${CC}" configure.cxx="${CXX}" \
configure.cflags="${CFLAGS}" configure.cxxflags="${CXXFLAGS}"

The other alternative, is to install the gcc48 (or above) port, and use it as the compiler. Don't use the old gcc-4.2.1 installed with older versions of Xcode. It's rubbish.

这篇关于Macports在OSX 10.9 - 编译与-stdlib = libstdc ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆