xmake始终报告:错误:无法获取cxx程序,为什么?

我在我的Mac上使用“brew install xmake”,并拥有一个.cpp文件。我运行xmake并在目录中生成xmake.lua。然后它报告:

错误:无法获取cxx程序

我已经安装了clang(别名为g++)。它运行得很好。然后我做了这个:

$sudo ln-s /usr/bin/g++/usr/local/bin/cxx

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

错误:无法获取cxx程序

如何处理这个问题?谢谢

-----------------------我尝试过这些,但行不通:

$xmake f -p cross

$xmake
错误:不能获取cxx程序

$export CC = clang LD = clang ++ xmake
$xmake
错误:不能获取cxx程序

-----------------------看看我的诊断:

$xmake f-p跨-c

(实际上没有输出)

$xmake -r -v
configure
{
    plat = cross
, arch = none
, ccache = true
,    kind = static 
, buildir = build
, host = macosx
,模式=发行版
,清洁=真
}

检查g ++...没有
检查链接器(ld:g ++)...没有
检查gcc ...无
检查链接器(ld:gcc)...没有
检查clang ++ ...无
检查链接器(ld:clang ++)...没有
检查clang ...无
检查链接器(ld:clang)...没有
错误:无法获取ld程序

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

$ which clang
 /usr/bin/clang
点赞
用户10610569
用户10610569

xmake 将在 macOS 上检测并使用 xcrun -sdk macosx clang。您是否已安装 Xcode 命令行工具?

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

xmake f -p cross
xmake

它将直接使用 gcc/clang。

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

xmake f -c --cc=clang --ld=clang++
xmake

或者

export CC=clang LD=clang++ xmake

2018-11-05 23:49:47
用户4768178
用户4768178
现在它可以工作了,请更新到最新版本。
2021-04-23 03:33:37