Honors the PATH[1] and other user settings like
system wide ccache when selecting hosttools.

Fixes the following compilation error when compiling clang-11:

 | CMake Error at cmake/modules/CheckCompilerVersion.cmake:38 (message):
 |   Host GCC version must be at least 5.1, your version is 4.8.5.
 | Call Stack (most recent call first):
 |   cmake/modules/CheckCompilerVersion.cmake:48 (check_compiler_version)

on CentOS which by default has the gcc 4.8.5. However, this machine
has configured the gcc-7 from Developer Toolset[2] as a default one:

 $ gcc --version | head -n1
 gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)

 $ which gcc
 /opt/rh/devtoolset-7/root/usr/bin/gcc

So far, I did not find any other software which would not respect
this setup.

This will also start honoring system-wide ccache configuration
(e.g. widely used on Fedora Linux) where the gcc is used from
the non-standard following location:

 $ which gcc
 /usr/lib64/ccache/gcc

once the user decided to install ccache package:

 $ rpm -qf /usr/lib64/ccache/gcc
 ccache-4.2-1.fc33.x86_64

[1] 
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_01_01
[2] https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/

Signed-off-by: Damian Wrobel <[email protected]>
---
 meta/classes/base.bbclass | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index b4160402f0..67b0fa1497 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -131,12 +131,6 @@ def setup_hosttools_dir(dest, toolsvar, d, fatal=True):
             if os.path.islink(desttool):
                 os.unlink(desttool)
             srctool = bb.utils.which(path, tool, executable=True)
-            # gcc/g++ may link to ccache on some hosts, e.g.,
-            # /usr/local/bin/ccache/gcc -> /usr/bin/ccache, then which(gcc)
-            # would return /usr/local/bin/ccache/gcc, but what we need is
-            # /usr/bin/gcc, this code can check and fix that.
-            if "ccache" in srctool:
-                srctool = bb.utils.which(path, tool, executable=True, 
direction=1)
             if srctool:
                 os.symlink(srctool, desttool)
             else:
-- 
2.26.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#149636): 
https://lists.openembedded.org/g/openembedded-core/message/149636
Mute This Topic: https://lists.openembedded.org/mt/81430061/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to