[{"id":3626436,"web_url":"http://patchwork.ozlabs.org/comment/3626436/","msgid":"<aUIli8Do+HM89mu8@intel.com>","list_archive_url":null,"date":"2025-12-17T03:37:47","subject":"Re: [PATCH 04/11] rust: Do not link qemuutil into Rust rlibs","submitter":{"id":86545,"url":"http://patchwork.ozlabs.org/api/people/86545/","name":"Zhao Liu","email":"zhao1.liu@intel.com"},"content":"On Mon, Dec 15, 2025 at 08:49:53AM +0100, Paolo Bonzini wrote:\n> Date: Mon, 15 Dec 2025 08:49:53 +0100\n> From: Paolo Bonzini <pbonzini@redhat.com>\n> Subject: [PATCH 04/11] rust: Do not link qemuutil into Rust rlibs\n> X-Mailer: git-send-email 2.52.0\n> \n> From: Martin Kletzander <mkletzan@redhat.com>\n> \n> Commit de037ab8d83d removed qemuutil dependency from chardev and util\n> rust crates.  However it stayed in the _util_rs static library.  The\n> dependency is also defined as `link_with`, which is fine for C targets,\n> where the resulting archive gets linked as another parameter on the\n> command line when it is a static library.\n> \n> However, when a C library is linked into a Rust rlib, rustc remembers\n> the dependency into the metadata and adds the library to the linker\n> command line.\n> \n> Unfortunately, static libraries are sensitive to their\n> position on the command line and rustc does not always get it right.\n> Fortunately, simply removing it from dependencies of any rust libraries\n> and instead adding them into the dependencies of executables and\n> doctests fixes the behaviour.\n> \n> Without this patch the error I get is:\n> \n>   FAILED: [code=1] rust/tests/rust-integration\n>   ...\n>   = note: rust-lld: error: unable to find library -l:libqemuutil.a\n>           rust-lld: error: unable to find library -l:libvhost-user-glib.a\n>           rust-lld: error: unable to find library -l:libvhost-user.a\n>           rust-lld: error: unable to find library -l:libqemuutil.a\n>           rust-lld: error: unable to find library -l:libvhost-user-glib.a\n>           rust-lld: error: unable to find library -l:libvhost-user.a\n>           rust-lld: error: unable to find library -l:libqemuutil.a\n>           rust-lld: error: unable to find library -l:libvhost-user-glib.a\n>           rust-lld: error: unable to find library -l:libvhost-user.a\n>           rust-lld: error: unable to find library -l:libqemuutil.a\n>           rust-lld: error: unable to find library -l:libvhost-user-glib.a\n>           rust-lld: error: unable to find library -l:libvhost-user.a\n>           rust-lld: error: unable to find library -l:libqemuutil.a\n>           rust-lld: error: unable to find library -l:libvhost-user-glib.a\n>           rust-lld: error: unable to find library -l:libvhost-user.a\n>           rust-lld: error: unable to find library -l:libqemuutil.a\n>           rust-lld: error: unable to find library -l:libvhost-user-glib.a\n>           rust-lld: error: unable to find library -l:libvhost-user.a\n>           collect2: error: ld returned 1 exit status\n> \n> Meson could work around it itself by never adding these static libraries\n> to the rlibs (after all, Meson tracks the transitive dependencies already\n> and knows how to add them to dependents of those rlibs); at least for now,\n> do it in QEMU: never link C libraries into Rust rlibs, and add them to the\n> final build products only.\n> \n> Signed-off-by: Martin Kletzander <mkletzan@redhat.com>\n> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>\n> ---\n>  rust/chardev/meson.build | 2 +-\n>  rust/qom/meson.build     | 2 +-\n>  rust/util/meson.build    | 4 ++--\n>  3 files changed, 4 insertions(+), 4 deletions(-)\n\nReviewed-by: Zhao Liu <zhao1.liu@intel.com>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256\n header.s=Intel header.b=igqoTQlb;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4dWJmR0Rn8z1y2F\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 17 Dec 2025 14:13:57 +1100 (AEDT)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1vVhyP-0005GV-KV; Tue, 16 Dec 2025 22:13:09 -0500","from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <zhao1.liu@intel.com>)\n id 1vVhyN-0005Fb-6F; Tue, 16 Dec 2025 22:13:07 -0500","from mgamail.intel.com ([198.175.65.12])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <zhao1.liu@intel.com>)\n id 1vVhyL-0004Eg-0p; Tue, 16 Dec 2025 22:13:06 -0500","from orviesa002.jf.intel.com ([10.64.159.142])\n by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 16 Dec 2025 19:13:00 -0800","from liuzhao-optiplex-7080.sh.intel.com (HELO localhost)\n ([10.239.160.39])\n by orviesa002.jf.intel.com with ESMTP; 16 Dec 2025 19:12:59 -0800"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1765941185; x=1797477185;\n h=date:from:to:cc:subject:message-id:references:\n mime-version:in-reply-to;\n bh=f615fpmWqCZllLrZqNripFqTae3cYSQKTpNqudKOSiI=;\n b=igqoTQlbqcgPvNcGhzD7PbUMTwNeyE44iQLs7Rxd4Q8tmh6qCCyPgWdA\n ZS8Rx46JsccVk4Gs2n7uMkwTLAj+YYt+8znjeAFhegxZeBvEXYjaw3KYZ\n cMlruzH/3X0GqirC1JtgIUPHpMUAaonGv5FNCIvY+alapyRcfNM+U7+bD\n Ki62t47/8k4bVs0Hw/825xI8gQkdyOqarfJft1lIqCxwS8ahZxiGxt/pR\n 4ai0T3c+AUVodEIp0fx2d72Ip9hiFaV+GdXnZUh7r5Ikdm7yIGKUKxmZa\n 6xxEZS0MevKFdYNeNGiSSmglGQzO5UxZLVwosNvyUdCSp0ZRNc214RiP9 A==;","X-CSE-ConnectionGUID":["fPcGjYlvQu6wRr8Tuq51Tg==","k3TZuxVuT9GB5pUisJ4AKA=="],"X-CSE-MsgGUID":["NCKaTLfjQDWet0qP+1qyyg==","fdqkS7W0TLeZaW3bi4k28w=="],"X-IronPort-AV":["E=McAfee;i=\"6800,10657,11644\"; a=\"79325418\"","E=Sophos;i=\"6.21,154,1763452800\"; d=\"scan'208\";a=\"79325418\"","E=Sophos;i=\"6.21,154,1763452800\"; d=\"scan'208\";a=\"228881916\""],"X-ExtLoop1":"1","Date":"Wed, 17 Dec 2025 11:37:47 +0800","From":"Zhao Liu <zhao1.liu@intel.com>","To":"Paolo Bonzini <pbonzini@redhat.com>","Cc":"qemu-devel@nongnu.org, qemu-rust@nongnu.org, marcandre.lureau@redhat.com,\n Martin Kletzander <mkletzan@redhat.com>","Subject":"Re: [PATCH 04/11] rust: Do not link qemuutil into Rust rlibs","Message-ID":"<aUIli8Do+HM89mu8@intel.com>","References":"<20251215075000.335043-1-pbonzini@redhat.com>\n <20251215075000.335043-5-pbonzini@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20251215075000.335043-5-pbonzini@redhat.com>","Received-SPF":"pass client-ip=198.175.65.12; envelope-from=zhao1.liu@intel.com;\n helo=mgamail.intel.com","X-Spam_score_int":"-43","X-Spam_score":"-4.4","X-Spam_bar":"----","X-Spam_report":"(-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,\n RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"}}]