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 9598CA0555; Tue, 18 Feb 2020 01:03:17 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9CBA71DAA7; Tue, 18 Feb 2020 01:02:45 +0100 (CET) Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) by dpdk.org (Postfix) with ESMTP id 14C6A1DA8A for ; Tue, 18 Feb 2020 01:02:41 +0100 (CET) Received: by mail-lj1-f193.google.com with SMTP id h23so20807761ljc.8 for ; Mon, 17 Feb 2020 16:02:41 -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=m/8P7Xk1Hq53dO3Y7cGgXZBfljzNf4J2Vsqube2++Uo=; b=bIEH2KfPlQXKrGKGbg/oeGY/ca8FYfvV6CxDFW+0BbyxdPxEgsJ4hN6kUSqK7Iri0J AcJTAVpFJ9vDmTSa7FPiDsKhcFF+adGZ9AH4bewjbAQ4J+j0Ht9a4L8V11u248/jJDJA FJ9AOgo5j7bd5W1QYdkdpgvuiIn7dwiVjOPN+Fj7Ytf0LqYuII2JlSXGQfcy7Mxy4M+G 92r5QrMerzumEurEEQ7xeIFbDcWQGF2oaFZmX7LPLXEp8O1EhDzS81RGsouL79MjwELU SKhnASJiXxWyuHspDKjf3qKMA2D4n8z2J7ON+moR4do6KmIFFJjaV/EXclsfrHWhS+ha PTYA== 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=m/8P7Xk1Hq53dO3Y7cGgXZBfljzNf4J2Vsqube2++Uo=; b=b8Uc/93iZ/eS6NoFKezherE6cn6d9NDLlp/XUGfmU4bSjfd2vk2qhtrdzzdz10XKG4 VqAT0GgYdQ5TdssNcCDecxSe4vuH8fJLEnYL5QL1aGBvmYcJdmwY+sHK6Zr4rq7Ns6tJ lY0NUxrfPpOPytJBFFpjAgJ3uOLeUm8/CGMlxHo2Li4ubs8QxNt9Q3WkpDsos1OGhRha E6VS8Od5/ee9V4kTSw2UQvRQRMwQJ90RaPOT5s9d1CQydHVdvoayb6x1xE1JbyfJm98+ cjW/zOddwhCxkVfCfoMijuJ7X094hVTeRSLSIAhDSWgrEZvdH+qEZfKaO6b6KpGw0xDu 3v2g== X-Gm-Message-State: APjAAAUYDrb2V1YSLbhbgUGdB9PcBHKVCieEwk/2sq+mdHRzV7bRHGwm hQ8QxcbDDtmcSmK9oAC2oqVCKxIPB1w= X-Google-Smtp-Source: APXvYqzoaX2CXXKDyAWKq7ONOE4i8UJt5g+2Gr1aHdooo8qRLpWVTb5wnY53pfijJo2WATp9NX5BJA== X-Received: by 2002:a2e:8e2a:: with SMTP id r10mr10705476ljk.219.1581984160272; Mon, 17 Feb 2020 16:02:40 -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 r20sm1068864lfi.91.2020.02.17.16.02.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2020 16:02:39 -0800 (PST) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk , Thomas Monjalon Date: Tue, 18 Feb 2020 03:02:26 +0300 Message-Id: <20200218000229.86621-5-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200218000229.86621-1-dmitry.kozliuk@gmail.com> References: <20200218000229.86621-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 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 6c46767e3..61eeec0de 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('.') @@ -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.0