How to use clang compiler with a haxe toolkit?

159 Views Asked by At

I want to build my haxe project with a clang compiler. I create the following "build.hxml" file:

-lib hxcpp
-cpp-compiler /usr/bin/clang++
-D linux
-D STATICLIBPREFIX=
-D HXCPP_CLANG
-D HAXE_OUTPUT_PART=myproject
-D HXCPP_API_LEVEL=400
-D HX_SMART_STRINGS
-D HXCPP_CPP11
-D HXCPP_GC_BIG_BLOCKS
-D static_link
-D include-prefix=myproject
-cp src

com.myproject.Dummy

When I run this command line:

haxe -cpp cpp/linux/clang/release build.hxml

I get the following error: "unknown option '-cpp-compiler'".

If I remove this switch (-cpp-compiler /usr/bin/clang++) form the hxml file I get: "sh: 1: g++: not found".

Because for some reason haxe try to use g++ compiler with is not installed in my system.

Also, I tried to set switch "-cpp-toolkit clang" which is also unknown option for the haxe.

1

There are 1 best solutions below

0
pts On

If everything else fails, create a directory, create a symlink named g++ pointing to your clang++ executable, add the directory to the beginning of your $PATH, and restart the compilation.

mkdir hcprg && ln -s "$(type -p clang++)" hcprg/g++
PATH="$PWD/hcprg:$PATH" haxe -cpp cpp/linux/clang/release build.hxml