diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass
index 8203f54519..b6391501ca 100644
--- a/meta/classes-global/base.bbclass
+++ b/meta/classes-global/base.bbclass
@@ -135,6 +135,16 @@ 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)
+            # copytree() uses tar options such as --xattrs and
+            # --xattrs-include that are currently specific to GNU tar.
+            # If the first tar in PATH is libarchive tar or busybox/toybox
+            # tar, GNU tar may well be available as gtar.
+            if (tool == "tar"):
+                import subprocess
+                if not b'--xattrs-include' in subprocess.check_output([srctool, '--help']):
+                    gtar = bb.utils.which(path, "gtar", executable=True)
+                    if gtar:
+                        srctool = gtar
             # 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
