From patchwork Thu Apr 1 12:27:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Connolly X-Patchwork-Id: 90372 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2AE3BA0548; Thu, 1 Apr 2021 14:27:57 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 15E8B14115B; Thu, 1 Apr 2021 14:27:57 +0200 (CEST) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by mails.dpdk.org (Postfix) with ESMTP id 05E1E14115B for ; Thu, 1 Apr 2021 14:27:56 +0200 (CEST) Received: by mail-wr1-f67.google.com with SMTP id x16so1641839wrn.4 for ; Thu, 01 Apr 2021 05:27:56 -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:mime-version :content-transfer-encoding; bh=iaNz/403clrLdcObkzZzLvTU6Z4kGCslqvSpUmOKOlU=; b=zN9WJMJ12oMzT8FH8CBmHhCvq5IxBpi4Fljd1aXqHLrc4Z8dAMBku+plvoadzLCN6v ReSPruYs22POoD+JcO/EPxI1PpMuKIFehFq/UEkCkEr+a0SdFAjCO0ty4BouiJDiE1PC lZrGWnQ4mNW8BfcspXCAFhQ9icixwCE+XQevUdcQmJtAhR0Vj1JAvTQHLrqD00RafxKs rgC1mI87JTpPAgwzoD2tn+mT4FM4Gfs3OJn/qbjV22PaBNASj2mGS//ZKb9N8Q4/kFu3 2NKm3XfgV2YltRLzpWXlaDqss0W6Q6ExgDHuPAZBHN2SjowoH4tlbhqfeJHfUt1duMRH 5vMw== 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:mime-version :content-transfer-encoding; bh=iaNz/403clrLdcObkzZzLvTU6Z4kGCslqvSpUmOKOlU=; b=FH+6rfgFlhxbci5tLi4iLLmhoGqGDvnuuffHHaV2vDAPE0bqKwyCcIwQpuCFHTYYn0 yaMlXhUC6RTyuv1bf3Wgb9/QNDHpy5esHAVfUEo0LeNZbQ7B7JaoPbLXGQvVuzGi0a+m odVJWuEobZ7R7OYRahEKilMTUs1ltH1NqF0TQfTV489EM/2kdhC5+95aVKrkRQ+O6Uti u0Ax19tBzqyWfl+jRdZF7ViIb99cCi8KTo8Oh0tNsxdeDGHoOP9mKewZUCY8v+1ytA+Q Pn/h5rxeZT3zlNRY1DzWQjyNxZltRpHbdn8Rof9b+EAfQHWNJ7NUVZ58iKBdaQOvKFTJ fvvw== X-Gm-Message-State: AOAM531RKMTLKgonKBLikYEarrlh/naw9ZlUO/TJym6qgh9fxaIad5jh 5zO/G7QW/iNbFs6br03h7kWdAw== X-Google-Smtp-Source: ABdhPJz2nxyzwHPfXXhyCBqESl8OPMV9AGOl2dFtmT//PBvB+hjHn+eeLmjLTe21D+V5YmhSCg3BOg== X-Received: by 2002:adf:a1d8:: with SMTP id v24mr9198220wrv.378.1617280075719; Thu, 01 Apr 2021 05:27:55 -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 c2sm8249842wmr.22.2021.04.01.05.27.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Apr 2021 05:27:55 -0700 (PDT) From: Nick Connolly To: Bruce Richardson , Ranjit Menon , Nick Connolly Cc: dev@dpdk.org, dmitry.kozliuk@gmail.com, navasile@linux.microsoft.com, dmitrym@microsoft.com, pallavi.kadam@intel.com, stable@dpdk.org Date: Thu, 1 Apr 2021 13:27:23 +0100 Message-Id: <20210401122723.23082-1-nick.connolly@mayadata.io> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] 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. Replace the shell script with a python script to perform the symbolic linking to improve cross platform support. On Linux the functionality is unchanged. 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. Fixes: 5c7d86948764 ("build: fix install on Windows") Cc: stable@dpdk.org Signed-off-by: Nick Connolly --- buildtools/symlink-drivers-solibs.py | 49 ++++++++++++++++++++++++++++ buildtools/symlink-drivers-solibs.sh | 13 -------- config/meson.build | 7 ++-- 3 files changed, 51 insertions(+), 18 deletions(-) create mode 100644 buildtools/symlink-drivers-solibs.py delete mode 100644 buildtools/symlink-drivers-solibs.sh 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/buildtools/symlink-drivers-solibs.sh b/buildtools/symlink-drivers-solibs.sh deleted file mode 100644 index 42985e855..000000000 --- a/buildtools/symlink-drivers-solibs.sh +++ /dev/null @@ -1,13 +0,0 @@ -#! /bin/sh -# SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2017 Intel Corporation - -# post-install script for meson/ninja builds to symlink the PMDs stored in -# $libdir/dpdk/drivers/ 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 - -cd ${MESON_INSTALL_DESTDIR_PREFIX}/$1 && ln -sfv $2/librte_*.so* . diff --git a/config/meson.build b/config/meson.build index 66a2edcc4..c51669b7d 100644 --- a/config/meson.build +++ b/config/meson.build @@ -57,11 +57,8 @@ eal_pmd_path = join_paths(get_option('prefix'), driver_install_path) # driver .so files often depend upon the bus drivers for their connect bus, # e.g. ixgbe depends on librte_bus_pci. This means that the bus drivers need # to be in the library path, so symlink the drivers from the main lib directory. -if not is_windows - meson.add_install_script('../buildtools/symlink-drivers-solibs.sh', - get_option('libdir'), - pmd_subdir_opt) -endif +meson.add_install_script(py3, '../buildtools/symlink-drivers-solibs.py', + get_option('libdir'), pmd_subdir_opt, get_option('bindir')) # set the machine type and cflags for it if meson.is_cross_build()