1

I've "brew install xmake" on my mac, and having a .cpp file, I run xmake and it generates a xmake.lua in the directory. Then it reports:

error: cannot get program for cxx

I've installed clang (alias as g++). It works fine. I then:

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

Well, running xmake again, but it still reports same error:

error: cannot get program for cxx

How to handle this? Thanks

----------------------I tried these, don't work:

$xmake f -p cross

$xmake
error: cannot get program for cxx

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

----------------------See my diagnotics:

$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
Hind Forsum
  • 9,717
  • 13
  • 63
  • 119
  • I'm not sure `cxx` is an appropriate tag for this question, as currently no other questions are tagged with it. – Matt Nov 05 '18 at 01:41

2 Answers2

2

xmake will detect and use xcrun -sdk macosx clang on macOS. Do you have Xcode command line tools installed?

If not, you can switch to cross platform to compile it. for example

xmake f -p cross
xmake

It will use gcc/clang directly.

Or set --cc=clang or CC, LD envirnoment vars to modify compiler and linker.

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

Or

export CC=clang LD=clang++ xmake

ruki
  • 183
  • 6
  • I don't have Xcode command line installed. But the 3 methods below do not work :( – Hind Forsum Nov 06 '18 at 13:39
  • Please run `xmake f -p cross -c; xmake -r -v` and give me the output info. I need see more verbose log. – ruki Nov 07 '18 at 01:03
  • xmake will try to run `clang --version` to detect clang/gcc, but it seems that the test failed. You can try run `clang --version` and `g++ --version` manually to confirm that it works. – ruki Nov 07 '18 at 04:35
  • In addition, you can run `xmake l lib.detect.find_tool clang` to detect clang or gcc directly. And let me see the output info. – ruki Nov 07 '18 at 04:39
1

It works now, please update to latest version.

Ruki Wang
  • 67
  • 5