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

时间:2018-11-02 02:56:29

标签: lua g++ xmake cxx

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

error: cannot get program for cxx

我已经安装了clang(别名为g ++)。工作正常。然后,我:

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

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

error: cannot get program for cxx

如何处理?谢谢

----------------------我尝试了这些,不起作用:

$xmake f -p cross

$xmake
error: cannot get program for cxx

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

----------------------请参阅我的诊断:

$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

2 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:0)

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