From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D14AAC433DB for ; Thu, 7 Jan 2021 16:25:42 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 73904224D3 for ; Thu, 7 Jan 2021 16:25:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 73904224D3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:36704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kxY6X-0002N5-Dl for qemu-devel@archiver.kernel.org; Thu, 07 Jan 2021 11:25:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33256) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kxY4w-0001ol-L4 for qemu-devel@nongnu.org; Thu, 07 Jan 2021 11:24:02 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:21913) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kxY4u-0007OD-JM for qemu-devel@nongnu.org; Thu, 07 Jan 2021 11:24:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610036639; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YTqBZ0Kc65AWIZch9OjgI5W+G2W0w65TXuUHcjkQj4M=; b=DeETMrk3CzcPogE5NVGUDRrN3DLEKSv/6Wh2cz/gJdGHGBiy1TYTpRWY9Axs/Zt942hbQQ j7JteRVMQcYaA6K9Nn2be1NZ+Qg9TOGJAbe6/f6XHEw/bOjhp5p0gevKGew+qZqAhEvisp HbuwWrXS3bua72rg2vDbwPlH0qG7OMM= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-142-m3RTRNAnO8qHJJsLQrT7Fg-1; Thu, 07 Jan 2021 11:23:57 -0500 X-MC-Unique: m3RTRNAnO8qHJJsLQrT7Fg-1 Received: by mail-wr1-f72.google.com with SMTP id i4so2846749wrm.21 for ; Thu, 07 Jan 2021 08:23:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=YTqBZ0Kc65AWIZch9OjgI5W+G2W0w65TXuUHcjkQj4M=; b=STyAp0YhaI4IjN8ZNnAQOLrTAGtHPwEOOolrj6Y/TUmkpgAmsq36tohCNJ72q5P5Va WkIgTbunpz347pFqgtJKma/nCHDjg3YlxguONhuPTAKofOB9VHQo/IzCTxVehCt/NxBN c7qkCGIPt1UXsYbINdWmgN6+a1WdnI7mzqnXXtFciyR75bVO+OcsVqBwgSO3bGcdymQ1 VDn3DWsw4g8ju0e+wMtmejn+njfKKdsMA5gIFiEJcu0pI2LPdgTrG86wFwh2OAMcJlME /RoYksDn8MStt9W9JRAhQFmmdFMka2ZiIDub30cD2cVH+DuhuUvGtmTZCBtN69OrYKX/ 00Fg== X-Gm-Message-State: AOAM532AGyLrhHjvUUZ4psDr6FMy/1BLgw4Wwpdfe74hFkwb2LA7C41f p6vMCIgyPph6pWFpjDyk+v5GS6Lrj30XmFG8DPlHdojDxXJlJVfHRudX7pz0v0M305B1TSTCvhX +JZ6kWG7rmqP24BU= X-Received: by 2002:a5d:6a4c:: with SMTP id t12mr9747472wrw.249.1610036636631; Thu, 07 Jan 2021 08:23:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJx7X8A+zcn8DHj/6wxydP1Cu+Rx27cyzSzGYFEBV6CVQpe85PK9Tg81Nxz0D+5URmb9vp04OQ== X-Received: by 2002:a5d:6a4c:: with SMTP id t12mr9747455wrw.249.1610036636442; Thu, 07 Jan 2021 08:23:56 -0800 (PST) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id b7sm8612000wru.33.2021.01.07.08.23.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Jan 2021 08:23:55 -0800 (PST) To: Roman Bolshakov References: <20210102125213.41279-1-r.bolshakov@yadro.com> <690581da-9258-41e5-14cb-bb1b162e8993@redhat.com> From: Paolo Bonzini Subject: Re: [PATCH] meson: Propagate gnutls dependency Message-ID: <86bebbbf-ff0f-263d-96a2-4e6df9f85776@redhat.com> Date: Thu, 7 Jan 2021 17:23:54 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=63.128.21.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -32 X-Spam_score: -3.3 X-Spam_bar: --- X-Spam_report: (-3.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.246, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.267, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , =?UTF-8?Q?Daniel_P=2e_Berrang=c3=a9?= , "open list:Block layer core" , QEMU Developers , Max Reitz , Gerd Hoffmann Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 07/01/21 16:56, Roman Bolshakov wrote: > IMO duplication of dependencies shouldn't be needed for a build system. > Meta build system should allow private and public dependencies. Different > rules are applied to them. Private dependency is not propagated beyond a > target that uses it, public dependency is propagated. > > Right now it seems that meson is missing the notion of public and > private dependencies and that's where the problem arises. The post [1] (and > the related issue) summarizes what I'm trying to say. Meson doesn't have a concept of public dependencies because it separates the private (static library) and the public (declare_dependency) view. That is you'd have: public_deps = [gnutls, anotherpublicdep] lib = static_library(..., dependencies: public_deps + [aninternaldep]) dep = declare_dependency(link_with: lib, dependencies: public_deps) The real issue is that Meson's implementation of link_whole for library-in-library makes sense for one use case (convenience library that is linked into another convenience library) but not for another (grouping code for subsystems). I cannot blame them for this because link_with is a more common case for the latter; OTOH QEMU is using link_whole a lot in order to support the *_init() construct. I really think the correct fix is for Meson to use objects instead of archives for link_whole, similar to how QEMU Makefiles used to do it. This would also remove the need for the special .fa suffix, so it would be an improvement all around. Paolo > If we resolve the issue, then we just specify gnutls as a public > dependency of crypto and all users of crypto would get gnutls headers. > > Here's an example how clearly CMake approaches the issue [2][3]: > > add_library(crypto OBJECT crypto-file1.c ...) > target_link_libraries(crypto PRIVATE aninternaldep > PUBLIC gnutls > anotherpublicdep) > > 1.https://github.com/mesonbuild/meson/issues/495#issuecomment-206178570 > 2.https://cmake.org/cmake/help/latest/command/target_link_libraries.html#linking-object-libraries > 3.https://cmake.org/cmake/help/latest/command/target_link_libraries.html#libraries-for-a-target-and-or-its-dependents