DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] buildtools: fix build with meson 0.60
@ 2021-10-26 19:32 Dmitry Kozlyuk
  2021-10-27 10:53 ` Bruce Richardson
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Dmitry Kozlyuk @ 2021-10-26 19:32 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson, Dmitry Kozlyuk, stable, Michal Berger, Neil Horman

Meson 0.60 switched the format of uninstalled static libraries
to thin archives, that is, they contain only paths to object files,
not the files themselves. Files cannot be extracted in this case,
resulting in build errors:

    ar: `x' cannot be used on thin archives.

Handle thin archives when invoking pmdinfogen
by directly using the files referenced in the archive.

Bugzilla ID: 836
Fixes: e6e9730c7066 ("buildtools: support object file extraction for Windows")
Cc: stable@dpdk.org

Reported-by: Michal Berger <michallinuxstuff@gmail.com>
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
 buildtools/gen-pmdinfo-cfile.py | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/buildtools/gen-pmdinfo-cfile.py b/buildtools/gen-pmdinfo-cfile.py
index 58fe3ad152..3453e5b4b9 100644
--- a/buildtools/gen-pmdinfo-cfile.py
+++ b/buildtools/gen-pmdinfo-cfile.py
@@ -8,13 +8,18 @@
 import tempfile
 
 _, tmp_root, ar, archive, output, *pmdinfogen = sys.argv
-with tempfile.TemporaryDirectory(dir=tmp_root) as temp:
-    run_ar = lambda command: subprocess.run(
-        [ar, command, os.path.abspath(archive)],
-        stdout=subprocess.PIPE, check=True, cwd=temp
-    )
-    # Don't use "ar p", because its output is corrupted on Windows.
-    run_ar("x")
-    names = run_ar("t").stdout.decode().splitlines()
-    paths = [os.path.join(temp, name) for name in names]
+archive = os.path.abspath(archive)
+names = subprocess.run([ar, "t", archive],
+    stdout=subprocess.PIPE, check=True).stdout.decode().splitlines()
+with open(archive, "rb") as f:
+    is_thin = f.read(7) == b"!<thin>"
+if is_thin:
+    # Thin archive needs no unpacking, just use the paths within.
+    paths = [os.path.join(archive, name) for name in names]
     subprocess.run(pmdinfogen + paths + [output], check=True)
+else:
+    with tempfile.TemporaryDirectory(dir=tmp_root) as temp:
+        # Don't use "ar p", because its output is corrupted on Windows.
+        paths = [os.path.join(temp, name) for name in names]
+        subprocess.run([ar, "x", archive], check=True, cwd=temp)
+        subprocess.run(pmdinfogen + paths + [output], check=True)
-- 
2.29.3


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-11-03 13:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 19:32 [dpdk-dev] [PATCH] buildtools: fix build with meson 0.60 Dmitry Kozlyuk
2021-10-27 10:53 ` Bruce Richardson
2021-10-27 16:16 ` Bruce Richardson
2021-10-27 16:45   ` Dmitry Kozlyuk
2021-11-01 16:54     ` Bruce Richardson
2021-11-01 17:36       ` Dmitry Kozlyuk
2021-11-01 17:03 ` [dpdk-dev] [PATCH v2] " Bruce Richardson
2021-11-02 18:08   ` Dmitry Kozlyuk
2021-11-03 13:20     ` Thomas Monjalon
2021-11-03 13:32       ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).