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 48EA9A04FA; Thu, 6 Feb 2020 07:45:40 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C69DD1C0D4; Thu, 6 Feb 2020 07:44:47 +0100 (CET) Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com [209.85.167.68]) by dpdk.org (Postfix) with ESMTP id C5F091C067 for ; Thu, 6 Feb 2020 07:44:43 +0100 (CET) Received: by mail-lf1-f68.google.com with SMTP id m30so3271592lfp.8 for ; Wed, 05 Feb 2020 22:44:43 -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=UGPlklvbxfQM/xywUPxBECj7HLiMr26lS5tb8VRhzNc=; b=ORQjUnBCrG6lVCOl3MYgSCP6HT3jUflTYmfvYgH5YgncPOwHEn7mvwnvfCA3cPROs7 ioOqFVdGY8AULDnODmxv/ihHf70oh5KwpplVXwZ/UOTNfNV7r+Jv4tA3PTCp8dvsdksK a2YBqLgHkkRdXPUek4uzzuHpceYB7lM+YiOP5JpmiQg30kGljSvAPx27ZwfcdeXd9QrT vvo8+z9U9froOtnkztGO55eTDG5KBakPCdQlYbV5G3Q8UqEg9aBYdVLTaGcGF2CGi+mk hfsaMLdL9mlr+VFmzplbyxMM2pXvalk8AnzMQY2CvjqSI2wv6sw+U4xzAx8YTUVenW0V kvWQ== 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=UGPlklvbxfQM/xywUPxBECj7HLiMr26lS5tb8VRhzNc=; b=UxJm4GXTYhGMyf9CM+qf5Suku2WEtuamy/wu51X+owf/GyDCnSPcSogyOqxuAd4EQc i9Bn4yWlc9m0DtSUmRDZe1HvQRlXgwCs2xiFtESBTWBQEVPvl5drL4UssD9nXmdVN86S yS+YN8xkdjHtWTShcKkVf7YnB0AuONIy3KN+808cprYmKhJADa4L54pXxwWFWjNCLQho NsYXrZUTCeKTAPveKu8YVfdb9yNzp+Id6/ujk6xgxAAaw44LgO2egogUQpE+5Ww8hSTr nesSQ0hve/cOWfC5Bz2p7WN6/tzOz/ur3nMCFzyw48PS68lzsH3njSoXqoJBtorffmZ4 Zrtw== X-Gm-Message-State: APjAAAXWLwfht/ompzU+iW7/QKXWuljoAVDbUv4IblO70wlqu7sR5T8g 8Zw6JRRU08nj3nRH9K9LnyTYlI/7NJw= X-Google-Smtp-Source: APXvYqxXORt4YUQ1pDqe7O7izuWKy64YlSPVop2EdMssbL6a6wEQr3lhYdi2aNpxacjR4JFUnkgKEg== X-Received: by 2002:ac2:52a5:: with SMTP id r5mr916663lfm.19.1580971483031; Wed, 05 Feb 2020 22:44:43 -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 o19sm939669lji.54.2020.02.05.22.44.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Feb 2020 22:44:42 -0800 (PST) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk , Bruce Richardson , Thomas Monjalon Date: Thu, 6 Feb 2020 09:44:24 +0300 Message-Id: <20200206064426.45697-6-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200206064426.45697-1-dmitry.kozliuk@gmail.com> References: <20200206064426.45697-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 5/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/librte_eal/meson.build | 3 +++ lib/meson.build | 8 ++++++-- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/config/meson.build b/config/meson.build index 28a57f56f..9b955f9ef 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. +# FIXME: 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('.') @@ -241,6 +245,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/librte_eal/meson.build b/lib/librte_eal/meson.build index 4be5118ce..eae8c2ba8 100644 --- a/lib/librte_eal/meson.build +++ b/lib/librte_eal/meson.build @@ -20,6 +20,9 @@ endif if cc.has_function('getentropy', prefix : '#include ') cflags += '-DRTE_LIBEAL_USE_GETENTROPY' endif +if cc.get_id() == 'gcc' + cflags += '-D__USE_MINGW_ANSI_STDIO' +endif sources = common_sources + env_sources objs = common_objs + env_objs headers = common_headers + env_headers 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.0