From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C2F8FA055A; Thu, 27 Feb 2020 05:26:23 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4768C1BFE8; Thu, 27 Feb 2020 05:25:58 +0100 (CET) Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) by dpdk.org (Postfix) with ESMTP id 71ADD1BFD6 for ; Thu, 27 Feb 2020 05:25:53 +0100 (CET) Received: by mail-lf1-f66.google.com with SMTP id c23so999118lfi.7 for ; Wed, 26 Feb 2020 20:25:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=An531CZfw5v7EAWPyeoYtqp8eSOb3MpKSS0kBWke2Rk=; b=bCjTmGTLEv21ekizwOi0ya+jsyhufOzWNNG62m/edgC1BowS/mF2MpF3MGAyfAitxy 99erb8m869SFiAUqeG69UtNbXwPNSofIL0mfdN+iG5v+nW1amQD/rp2mKgzZ2cS18xSJ ZdFvhIpCIz7b5VyCKxBPy+8tyLbuEUVrpZrDoFjZ5DTYIvZyzL0zBXannvOEnCBoPtyl BCekFu5AM5wXv0I0ucpnxmF3T++BU61WjZf5Nky2Z5oHYxQh7qJLTR/WnLBrRf6CEBZh sROcMy7WjF0yKpEKBU045V+XBUMlHai1odjtBq00lvEQDLl3a8t/7Tbg5TQyJ+rSO0u6 GcsA== 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=An531CZfw5v7EAWPyeoYtqp8eSOb3MpKSS0kBWke2Rk=; b=bA15aCzTiB2w58cLGc07Iob+BnMcW9ZrNgrwj0UyxY5QVxu6Ee3GN/SVGBOBf+TtlM 3gJnM26ERHBWruH93unvk9K8EOaJRLKUH6Uc2EgFMrYfViA8VZwtGJtmCbyWtZjjYPKo xMLo8iQpCcHa/XCRkNZ7/0I+kA0oH1WOuJcrLo4ymyEVrrEmwRCP/nGI8/mSy6rDue1j 702/TBNxDPbzLq11cNDjsTEHqNxE1mG5pL1+Hy5kAsxKjQ5QHQg25QQPhTylrWZPQluf UImiVYsWnFmsDKPsesbC7BzRSFMAfUPkDSdi19ybfbMU91odT5YobNCOi1r9UmU5GjwK dDCg== X-Gm-Message-State: ANhLgQ1XTCAd88sbv0a2qM1Lq1BcLmHUS7ZXum1NBrTXdQnVdWdU5rxW V3RA1FrP/DuHffO6K7JpobltkT0Xin8= X-Google-Smtp-Source: ADFU+vv1+k3/Zum36Xph7+q7i9kaPfEeGaxApojvKP6eAn0LPLEzREREf7yUKNnBlj8yRj7etjr17A== X-Received: by 2002:a05:6512:104a:: with SMTP id c10mr1028198lfb.57.1582777552654; Wed, 26 Feb 2020 20:25:52 -0800 (PST) Received: from localhost.localdomain (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.googlemail.com with ESMTPSA id g21sm2224350ljj.53.2020.02.26.20.25.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Feb 2020 20:25:52 -0800 (PST) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk , Thomas Monjalon Date: Thu, 27 Feb 2020 07:25:34 +0300 Message-Id: <20200227042537.187459-5-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200227042537.187459-1-dmitry.kozliuk@gmail.com> References: <20200218000229.86621-1-dmitry.kozliuk@gmail.com> <20200227042537.187459-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v4 4/7] build: MinGW-w64 support for Meson X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" MinGW-w64 linker does not mimic MS linker options, so the build system must differentiate between linkers on Windows. Use GNU linker options with GCC and MS linker options with Clang. MinGW-w64 by default uses MSVCRT stdio, which does not comply to ANSI, most notably its formatting and string handling functions. MinGW-w64 support for the Universal CRT (UCRT) is ongoing, but the toolchain provides its own standard-complying implementation of stdio. The latter is used in the patch to support formatting in DPDK. Signed-off-by: Dmitry Kozlyuk --- config/meson.build | 14 ++++++++++++++ lib/meson.build | 8 ++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/config/meson.build b/config/meson.build index d3d2370ce..68aeb8470 100644 --- a/config/meson.build +++ b/config/meson.build @@ -14,6 +14,10 @@ foreach env:supported_exec_envs set_variable('is_' + env, exec_env == env) endforeach +# MS linker requires special treatment. +# TODO: use cc.get_linker_id() with Meson >= 0.54 +is_ms_linker = is_windows and (cc.get_id() == 'clang') + # set the major version, which might be used by drivers and libraries # depending on the configuration options pver = meson.project_version().split('.') @@ -247,6 +251,16 @@ if is_freebsd add_project_arguments('-D__BSD_VISIBLE', language: 'c') endif +if is_windows + # Minimum supported API is Windows 7. + add_project_arguments('-D_WIN32_WINNT=0x0601', language: 'c') + + # Use MinGW-w64 stdio, because DPDK assumes ANSI-compliant formatting. + if cc.get_id() == 'gcc' + add_project_arguments('-D__USE_MINGW_ANSI_STDIO', language: 'c') + endif +endif + if get_option('b_lto') if cc.has_argument('-ffat-lto-objects') add_project_arguments('-ffat-lto-objects', language: 'c') diff --git a/lib/meson.build b/lib/meson.build index 0af3efab2..9c3cc55d5 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -148,12 +148,16 @@ foreach l:libraries command: [map_to_def_cmd, '@INPUT@', '@OUTPUT@'], input: version_map, output: 'rte_@0@_exports.def'.format(name)) - lk_deps = [version_map, def_file] - if is_windows + + if is_ms_linker lk_args = ['-Wl,/def:' + def_file.full_path(), '-Wl,/implib:lib\\' + implib] else lk_args = ['-Wl,--version-script=' + version_map] + endif + + lk_deps = [version_map, def_file] + if not is_windows # on unix systems check the output of the # experimental syms script, using it as a # dependency of the .so build -- 2.25.1