From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4E68FA0548; Mon, 26 Apr 2021 12:08:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BF22D41110; Mon, 26 Apr 2021 12:08:02 +0200 (CEST) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by mails.dpdk.org (Postfix) with ESMTP id A437D40140 for ; Mon, 26 Apr 2021 12:08:01 +0200 (CEST) Received: by mail-wr1-f43.google.com with SMTP id n2so2064254wrm.0 for ; Mon, 26 Apr 2021 03:08:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mayadata-io.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=r6QGnYZ9xI8o4PQAonxhriFSrRKv+R9J5b3O2+fEJ2g=; b=tv8m0IlphPiMer22INbzts8t6MgXdWsGfQzSUY+DI7p9RFKAA+vB0j42gnnGbOu1mP vnKA71+fTR1tmDdyPFEvp0sNvpmRqBVuHsiPTw8VrBmrtrpvggvWGhaiys36iTfLVsaA DautUSpLhOnFjn7n2IkCNyULYqx1yNe5lPIB1adqvVZHzkA7nbNG6oTF44ypjjMkEifl IrhlvMj1zPw6sRf1rY70FDFJeB3FlzxB6A+At0XyUGpwgy46N1Gz8s1yKbgemqP7XBjw vbnLmNcvfh0dKJpjeoil0bZnKLzSGbR4ZGIlMByLElQlupqn63ZmEypi49fYtcNaK8TZ Z3kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=r6QGnYZ9xI8o4PQAonxhriFSrRKv+R9J5b3O2+fEJ2g=; b=XPJ70vLzxGwKWpcQHBJxR+WQHdn2wrSUf40gmRYKITysSEDtghUsxE/kayQlRiYrev l9gJ+Voq/9Jb5Vt8EUvyEuuxDG5sJzoeYWg3tkXwO3LOh+c8TkxlI+eI4NboCanEqr0m XtiRFgsYItWmxsXSqU0tMxbjThJcYV5iwVKLpYiWySLbyX4H+vQab5v2wxXC39qMrZOS n6PopadPaZBgKFyMKWF5+5g1UvyieRliSUyldykmVdVDqLKGK58/+oLMEkqHP3/f2S+f NtMW80QHQRLdZUhTwHBMr7LCk8qQhF+Lww14ywxNWW9LrmXlKDSxKC0sVf9vync6jwHQ 7/Iw== X-Gm-Message-State: AOAM532jdU6gP4F79n2roxcjqScywUr4tvsl/uO3djc2seQyGqbSOqLV Aw7e/r78J2NCbl/1O9WlyB+RjA== X-Google-Smtp-Source: ABdhPJw2uO2uJ5QByVkFtaFl5nZe1ZsPQs7AlqWwPZ/s5MWAs66QoKKQTxnu7fjxezPs5n17Itaaxg== X-Received: by 2002:a05:6000:8b:: with SMTP id m11mr21963167wrx.224.1619431681188; Mon, 26 Apr 2021 03:08:01 -0700 (PDT) Received: from FENIX.localdomain (cpc98320-croy25-2-0-cust77.19-2.cable.virginm.net. [80.235.134.78]) by smtp.gmail.com with ESMTPSA id l14sm20892789wrv.94.2021.04.26.03.08.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Apr 2021 03:08:00 -0700 (PDT) From: Nick Connolly To: Bruce Richardson , Nick Connolly , Ranjit Menon Cc: dev@dpdk.org, dmitry.kozliuk@gmail.com, navasile@linux.microsoft.com, dmitrym@microsoft.com, pallavi.kadam@intel.com, stable@dpdk.org Date: Mon, 26 Apr 2021 11:07:32 +0100 Message-Id: <20210426100733.22478-1-nick.connolly@mayadata.io> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210401122723.23082-1-nick.connolly@mayadata.io> References: <20210401122723.23082-1-nick.connolly@mayadata.io> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3] build: fix symlink of drivers for Windows X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The symlink-drivers-solibs.sh script was disabled as part of 'install' for Windows because there is no support for shell scripts. However, this means that driver related DLLs are not present in the installed 'libdir' directory. Add a python script to perform the install and use it for Windows if the version of meson supports using an external program with add_install_script (>= 0.55.0). On Windows, symbolic links are somewhat problematic since the SeCreateSymbolicLinkPrivilege is required to be able to create them. In addition, different cross-compilation environments handle symbolic links differently, e.g. WSL, Msys2, Cygwin. Rather than trying to distinguish these scenarios, the python script will perform a file copy for any Windows specific names. On Windows, the shared library outputs have different names depending upon which toolset has been used to build them. The script currently handles Clang and GCC. On Linux the functionality is unchanged, but could be replaced with the python script once the required minimum version of meson is >= 0.55.0. Fixes: 5c7d86948764 ("build: fix install on Windows") Cc: stable@dpdk.org Signed-off-by: Nick Connolly Tested-by: Narcisa Vasile Acked-by: Narcisa Vasile --- v3: * rebase v2: * 0.55.0 is required to use external program with add_install_script buildtools/symlink-drivers-solibs.py | 49 ++++++++++++++++++++++++++++ config/meson.build | 4 +++ 2 files changed, 53 insertions(+) create mode 100644 buildtools/symlink-drivers-solibs.py diff --git a/buildtools/symlink-drivers-solibs.py b/buildtools/symlink-drivers-solibs.py new file mode 100644 index 000000000..5627ddd9d --- /dev/null +++ b/buildtools/symlink-drivers-solibs.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2021 Intel Corporation + +import os +import sys +import glob +import shutil + +# post-install script for meson/ninja builds to symlink the PMDs stored in +# $libdir/dpdk/pmds-*/ to $libdir. This is needed as some PMDs depend on +# others, e.g. PCI device PMDs depending on the PCI bus driver. + +# parameters to script are paths relative to install prefix: +# 1. directory for installed regular libs e.g. lib64 +# 2. subdirectory of libdir where the pmds are +# 3. directory for installed regular binaries e.g. bin + +os.chdir(os.environ['MESON_INSTALL_DESTDIR_PREFIX']) + +lib_dir = sys.argv[1] +pmd_subdir = sys.argv[2] +bin_dir = sys.argv[3] +pmd_dir = os.path.join(lib_dir, pmd_subdir) + +# copy Windows PMDs to avoid any issues with symlinks since the +# build could be a cross-compilation under WSL, Msys or Cygnus. +# the filenames are dependent upon the specific toolchain in use. + +def copy_pmd_files(pattern, to_dir): + for file in glob.glob(os.path.join(pmd_dir, pattern)): + to = os.path.join(to_dir, os.path.basename(file)) + shutil.copy2(file, to) + print(to + ' -> ' + file) + +copy_pmd_files('*rte_*.dll', bin_dir) +copy_pmd_files('*rte_*.pdb', bin_dir) +copy_pmd_files('*rte_*.lib', lib_dir) +copy_pmd_files('*rte_*.dll.a', lib_dir) + +# symlink shared objects + +os.chdir(lib_dir) +for file in glob.glob(os.path.join(pmd_subdir, 'librte_*.so*')): + to = os.path.basename(file) + if os.path.exists(to): + os.remove(to) + os.symlink(file, to) + print(to + ' -> ' + file) diff --git a/config/meson.build b/config/meson.build index 017bb2efb..9e04c4c76 100644 --- a/config/meson.build +++ b/config/meson.build @@ -59,6 +59,10 @@ eal_pmd_path = join_paths(get_option('prefix'), driver_install_path) if not is_windows meson.add_install_script('../buildtools/symlink-drivers-solibs.sh', get_option('libdir'), pmd_subdir_opt) +elif meson.version().version_compare('>=0.55.0') + # 0.55.0 is required to use external program with add_install_script + meson.add_install_script(py3, '../buildtools/symlink-drivers-solibs.py', + get_option('libdir'), pmd_subdir_opt, get_option('bindir')) endif # init disable/enable driver lists that will be populated in different places -- 2.25.1