From 723ca994e7ae6b530b695fd7f05cfd0e2ac2cc50 Mon Sep 17 00:00:00 2001 From: hollylee <925338+hollylee@users.noreply.github.com> Date: Wed, 11 Sep 2019 09:03:59 +0800 Subject: [PATCH 1/2] GetGCCRoot() for usual toolchain dir structures So don't depend on any special assumptions. See comments in the codes. --- tools/gcc.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/gcc.py b/tools/gcc.py index 525e11c44b..e45c07a57e 100644 --- a/tools/gcc.py +++ b/tools/gcc.py @@ -37,6 +37,24 @@ def GetGCCRoot(rtconfig): else: root_path = os.path.join(exec_path, '..', prefix) + # Usually the cross compiling gcc toolchain has directory as: + # + # bin + # lib + # share + # arm-none-eabi + # bin + # include + # lib + # share + prefix = rtconfig.PREFIX + if prefix.endswith('-'): + prefix = prefix[:-1] + + fn = os.path.join(root, prefix, 'include', filename) + if os.path.isfile(fn): + return True + return root_path def CheckHeader(rtconfig, filename): From dde0596b55e1378c9c00b5fd07a178aadda16e9d Mon Sep 17 00:00:00 2001 From: hollylee <925338+hollylee@users.noreply.github.com> Date: Wed, 11 Sep 2019 09:53:38 +0800 Subject: [PATCH 2/2] Put codes to correct place. --- tools/gcc.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/gcc.py b/tools/gcc.py index e45c07a57e..2e29c8f34b 100644 --- a/tools/gcc.py +++ b/tools/gcc.py @@ -37,6 +37,15 @@ def GetGCCRoot(rtconfig): else: root_path = os.path.join(exec_path, '..', prefix) + return root_path + +def CheckHeader(rtconfig, filename): + root = GetGCCRoot(rtconfig) + + fn = os.path.join(root, 'include', filename) + if os.path.isfile(fn): + return True + # Usually the cross compiling gcc toolchain has directory as: # # bin @@ -55,15 +64,6 @@ def GetGCCRoot(rtconfig): if os.path.isfile(fn): return True - return root_path - -def CheckHeader(rtconfig, filename): - root = GetGCCRoot(rtconfig) - - fn = os.path.join(root, 'include', filename) - if os.path.isfile(fn): - return True - return False def GetNewLibVersion(rtconfig):