首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >xmake总是报告:错误:无法获取cxx的程序,为什么?

xmake总是报告:错误:无法获取cxx的程序,为什么?
EN

Stack Overflow用户
提问于 2018-11-02 10:56:29
回答 2查看 194关注 0票数 0

我在我的mac上"brew install xmake“,并且有一个.cpp文件,我运行xmake,它会在目录中生成一个xmake.lua。然后它会报告:

代码语言:javascript
复制
error: cannot get program for cxx

我已经安装了clang (别名为g++)。它工作得很好。然后我:

代码语言:javascript
复制
$sudo ln -s /usr/bin/g++ /usr/local/bin/cxx

好吧,再次运行xmake,但它仍然报告相同的错误:

代码语言:javascript
复制
error: cannot get program for cxx

如何处理这个问题?谢谢

代码语言:javascript
复制
$xmake f -p cross

$xmake
error: cannot get program for cxx

$export CC=clang LD=clang++ xmake
$xmake
error: cannot get program for cxx

代码语言:javascript
复制
$xmake f -p cross -c

(In fact no output)

$xmake -r -v
configure
{
    plat = cross
,   arch = none
,   ccache = true
,   kind = static
,   buildir = build
,   host = macosx
,   mode = release
,   clean = true
}

checking for the g++ ... no
checking for the linker (ld: g++) ... no
checking for the gcc ... no
checking for the linker (ld: gcc) ... no
checking for the clang++ ... no
checking for the linker (ld: clang++) ... no
checking for the clang ... no
checking for the linker (ld: clang) ... no
error: cannot get program for ld

$which g++
/usr/bin/g++

$which clang
/usr/bin/clang
EN

回答 2

Stack Overflow用户

发布于 2018-11-06 07:49:47

xmake将在macOS上检测并使用xcrun -sdk macosx clang。你安装了Xcode命令行工具吗?

如果没有,可以切换到跨平台编译。例如

代码语言:javascript
复制
xmake f -p cross
xmake

它将直接使用gcc/clang。

或者设置--cc=clang或CC、LD环境变量来修改编译器和链接器。

代码语言:javascript
复制
xmake f -c --cc=clang --ld=clang++
xmake

导出CC=clang LD=clang++ xmake

票数 1
EN

Stack Overflow用户

发布于 2021-04-23 11:33:37

现在可以使用了,请更新到最新版本。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53112099

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档