From 90ca9626cca7b4bbfc016643e5ddf1db0e05d5c1 Mon Sep 17 00:00:00 2001 From: Siddharth Purohit Date: Tue, 23 Jan 2018 20:57:18 +0530 Subject: [PATCH] waf: use gcc/g++ by default if available else throw warning --- Tools/ardupilotwaf/toolchain.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Tools/ardupilotwaf/toolchain.py b/Tools/ardupilotwaf/toolchain.py index 06eadb77cf..19294c5406 100644 --- a/Tools/ardupilotwaf/toolchain.py +++ b/Tools/ardupilotwaf/toolchain.py @@ -16,6 +16,7 @@ from waflib import Errors, Context, Utils from waflib.Configure import conf from waflib.Tools import compiler_c, compiler_cxx from waflib.Tools import clang, clangxx, gcc, gxx +from waflib import Logs import os import re @@ -126,13 +127,16 @@ def find_toolchain_program(cfg, filename, **kw): return cfg.find_program(filename, **kw) def configure(cfg): - if cfg.env.TOOLCHAIN == 'native': - cfg.load('compiler_cxx compiler_c') - return - _filter_supported_c_compilers('gcc', 'clang') _filter_supported_cxx_compilers('g++', 'clang++') + if cfg.env.TOOLCHAIN == 'native': + cfg.load('compiler_cxx compiler_c') + if cfg.env.COMPILER_CC == 'clang' or cfg.env.COMPILER_CXX == 'clang++': + Logs.warn("Warning! Native clang builds can be unstable, please use gcc/g++. \ +\nRefer ardupilot.org docs for more details.") + return + cfg.find_toolchain_program('ar') cfg.msg('Using toolchain', cfg.env.TOOLCHAIN)