gpt4 book ai didi

lua - xmake总是报: error: cannot get program for cxx, 为什么?

转载 作者:行者123 更新时间:2023-11-28 04:30:23 27 4
gpt4 key购买 nike

我在我的 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

最佳答案

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

或者

导出 CC=clang LD=clang++xmake

关于lua - xmake总是报: error: cannot get program for cxx, 为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53112099/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com