{"id":2174148,"url":"http://patchwork.ozlabs.org/api/patches/2174148/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20251215075000.335043-5-pbonzini@redhat.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20251215075000.335043-5-pbonzini@redhat.com>","list_archive_url":null,"date":"2025-12-15T07:49:53","name":"[04/11] rust: Do not link qemuutil into Rust rlibs","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"c22d6a3a08c5e4013e2456459f241b68859ec884","submitter":{"id":2701,"url":"http://patchwork.ozlabs.org/api/people/2701/?format=json","name":"Paolo Bonzini","email":"pbonzini@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20251215075000.335043-5-pbonzini@redhat.com/mbox/","series":[{"id":485356,"url":"http://patchwork.ozlabs.org/api/series/485356/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=485356","date":"2025-12-15T07:49:50","name":"First batch of Meson/Rust build system changes","version":1,"mbox":"http://patchwork.ozlabs.org/series/485356/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2174148/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2174148/checks/","tags":{},"related":[],"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 (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=QMlh0PMW;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=google header.b=nrRu3Hcd;\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 4dVC2f3V21z1y15\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 15 Dec 2025 18:52:26 +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 1vV3Lr-0000ek-El; Mon, 15 Dec 2025 02:50:39 -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 <pbonzini@redhat.com>)\n id 1vV3LX-0000bA-Bh\n for qemu-devel@nongnu.org; Mon, 15 Dec 2025 02:50:23 -0500","from us-smtp-delivery-124.mimecast.com ([170.10.133.124])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <pbonzini@redhat.com>)\n id 1vV3LV-0000lq-OI\n for qemu-devel@nongnu.org; Mon, 15 Dec 2025 02:50:19 -0500","from mail-wm1-f70.google.com (mail-wm1-f70.google.com\n [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-122-8O-r0KKEO7aUTPtVe0GSdg-1; Mon, 15 Dec 2025 02:50:15 -0500","by mail-wm1-f70.google.com with SMTP id\n 5b1f17b1804b1-47777158a85so38084575e9.3\n for <qemu-devel@nongnu.org>; Sun, 14 Dec 2025 23:50:15 -0800 (PST)","from [192.168.10.48] ([151.95.145.106])\n by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-47a8f4f424bsm173496925e9.10.2025.12.14.23.50.12\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sun, 14 Dec 2025 23:50:12 -0800 (PST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1765785017;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=TlW7wtP3S7BSZhssQjq1auHlBWMlcMZTjjKdz6k84jU=;\n b=QMlh0PMWdx82Vju6uCF0llhVAXos+2j8fT3QuMZJ9f5nojz6/ftSU8Hm1GJ6aFWx5qhRM6\n bT8uZ8wjxUjjAEOLk7tDPHLSUp/9hztXCHeY0yVudi9gWtlQ0Do+qmb0tSmZ1i2tFn9BLj\n uDFF6CH1sciTZgtOUs0nnHDVcqFzlJc=","v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=redhat.com; s=google; t=1765785014; x=1766389814; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=TlW7wtP3S7BSZhssQjq1auHlBWMlcMZTjjKdz6k84jU=;\n b=nrRu3HcdHueJP3RG+5SrO3bFnp3GKAItDMKM2jwLHuA53ETXGxiSucbaf/cRHWec7p\n kaOLQJXVQnfX0rFswD6/h+6cyhaC6y5DlAtDPgqgSuccZFBUrDveaz70TU4RUDgXL4Wb\n U9VtoOn7DXl5J4OKnTn+ib4bhugYAyKLekt3VxkrWNht97I+EeZD5yJNxPcrwPM5mUGm\n Y2zRIYTy1atNlMwscFeDcnFZyDIHJCC9QnxVnnlfxWq8JnW+13NnK1udPL63OI52X4fU\n cggfeP7uTXDMfn2VGhqezBldQQSwzWclvv3vn9VWgaMKbgcpzCggvVTq1A3H2JQrU9gQ\n v0Yg=="],"X-MC-Unique":"8O-r0KKEO7aUTPtVe0GSdg-1","X-Mimecast-MFC-AGG-ID":"8O-r0KKEO7aUTPtVe0GSdg_1765785014","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1765785014; x=1766389814;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=TlW7wtP3S7BSZhssQjq1auHlBWMlcMZTjjKdz6k84jU=;\n b=JtIblzRD8v6hA7UyZ6hfT27W/y1RLm7DvhdbRf/WcfucI4YKNYLBPx2osUqAuTK5fm\n 27SPYo6KqvSSp7UJ0VP6cmJJAcJtfk0ApAHKOZVQWBtKuXkQQmqIUJZCjXL+oYUuuRb+\n xy/OFF3XqSiTndwsaR17jJCJ4/Je2R2Yv8I0eOSpjsXAwyjbOwvhkcA8aUtXoJJSJSra\n RNIo2W/nJ4tIXzGQwHPRavHFaxP385SO1sdAtq6iDkR8VgbUL0rfdkp1+aUh9XoHCB6r\n gafKvCxc4UjfRyy3FMBKhbsAL0R9pxJL3/tDsy+CKGmRSt2wn96YXKs4IcAfsBP4B+0x\n 7tPA==","X-Gm-Message-State":"AOJu0YxUoM/rM4DsLtSD2jxaEMavc54m88N4uZ/xM65iuTe+LLDZbfwZ\n o/UFCjwIWNPHCHDmWxCC+VSXzjkHIczlaJgP98CNCvfpC2NS6ssJBRjxf6D0d8aikjDBVcW/fBt\n 9aAdledS2u595JmLCBW9KEg4O3O0MTcqt5H0BN5nVqzEFfeDqNbZV3Zj5xhMtYcVCMNwmCFZ0Fr\n TLF0dAtzVcGa+Sk+Wdx0CeM+6xI3OTn2CFDjLs9huk","X-Gm-Gg":"AY/fxX61EdLBN3ypPJ1N5R9BwyzNlyW5Wr9iItj9hO7fB4LTEX0OD+Mlzvml2Rju1sq\n CvwnjRXItys60vVN+bv5E5TbIYMixb9TN3civKdehiIlmSqnJ91hYM4mPloAXKamZoDr2UkCV4l\n G/lHKUdhHV8qgT71bATPNYgTZ4j8ZukmGq4UpA4cj7sPqtLrEdlQVM3rP6UWF6HFUsxU4z4MvY4\n S4AeH1IEH/qIaabtAeKAFJeXe1Qqli7UI14oDXWw6i2d+GD39PUMfbf9xpXyGsSk6yzmkHTI7l4\n Aw1Be6G4m2xg9c3VSu0yHSgpLg5cKoAjNZhLabrhNV7cGUc1wDo19GKwszk+btL6F5Ozx3VUaiI\n QEbVOEezyb9owhu66YJvV7sLAU6H1pte0pzdp3AYQD8CVZBTRf0Bjeqsgnf+xNplCPBN2ldp+hT\n yxQKd4v+rp09c118s=","X-Received":["by 2002:a05:600c:4e91:b0:477:c37:2ea7 with SMTP id\n 5b1f17b1804b1-47a8f904609mr104987875e9.21.1765785013747;\n Sun, 14 Dec 2025 23:50:13 -0800 (PST)","by 2002:a05:600c:4e91:b0:477:c37:2ea7 with SMTP id\n 5b1f17b1804b1-47a8f904609mr104987625e9.21.1765785013256;\n Sun, 14 Dec 2025 23:50:13 -0800 (PST)"],"X-Google-Smtp-Source":"\n AGHT+IHjNGTw3rR71LFrJggoEPZa2W3FOLAe6o0RAXtCN9YS+s1RCdf7zA9dPxCtSG8SqIKOWz8MFw==","From":"Paolo Bonzini <pbonzini@redhat.com>","To":"qemu-devel@nongnu.org","Cc":"qemu-rust@nongnu.org, marcandre.lureau@redhat.com,\n Martin Kletzander <mkletzan@redhat.com>","Subject":"[PATCH 04/11] rust: Do not link qemuutil into Rust rlibs","Date":"Mon, 15 Dec 2025 08:49:53 +0100","Message-ID":"<20251215075000.335043-5-pbonzini@redhat.com>","X-Mailer":"git-send-email 2.52.0","In-Reply-To":"<20251215075000.335043-1-pbonzini@redhat.com>","References":"<20251215075000.335043-1-pbonzini@redhat.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Received-SPF":"pass client-ip=170.10.133.124;\n envelope-from=pbonzini@redhat.com;\n helo=us-smtp-delivery-124.mimecast.com","X-Spam_score_int":"-20","X-Spam_score":"-2.1","X-Spam_bar":"--","X-Spam_report":"(-2.1 / 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_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01,\n RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,\n SPF_HELO_PASS=-0.001,\n 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.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"},"content":"From: Martin Kletzander <mkletzan@redhat.com>\n\nCommit de037ab8d83d removed qemuutil dependency from chardev and util\nrust crates.  However it stayed in the _util_rs static library.  The\ndependency is also defined as `link_with`, which is fine for C targets,\nwhere the resulting archive gets linked as another parameter on the\ncommand line when it is a static library.\n\nHowever, when a C library is linked into a Rust rlib, rustc remembers\nthe dependency into the metadata and adds the library to the linker\ncommand line.\n\nUnfortunately, static libraries are sensitive to their\nposition on the command line and rustc does not always get it right.\nFortunately, simply removing it from dependencies of any rust libraries\nand instead adding them into the dependencies of executables and\ndoctests fixes the behaviour.\n\nWithout 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\nMeson could work around it itself by never adding these static libraries\nto the rlibs (after all, Meson tracks the transitive dependencies already\nand knows how to add them to dependents of those rlibs); at least for now,\ndo it in QEMU: never link C libraries into Rust rlibs, and add them to the\nfinal build products only.\n\nSigned-off-by: Martin Kletzander <mkletzan@redhat.com>\nSigned-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(-)","diff":"diff --git a/rust/chardev/meson.build b/rust/chardev/meson.build\nindex 54bb2962528..2e4f4670bd8 100644\n--- a/rust/chardev/meson.build\n+++ b/rust/chardev/meson.build\n@@ -38,4 +38,4 @@ _chardev_rs = static_library(\n   dependencies: [glib_sys_rs, common_rs, qemu_macros],\n )\n \n-chardev_rs = declare_dependency(link_with: [_chardev_rs], dependencies: [chardev])\n+chardev_rs = declare_dependency(link_with: [_chardev_rs], dependencies: [chardev, qemuutil])\ndiff --git a/rust/qom/meson.build b/rust/qom/meson.build\nindex 551c4f0bf5f..dda26c3f981 100644\n--- a/rust/qom/meson.build\n+++ b/rust/qom/meson.build\n@@ -30,7 +30,7 @@ _qom_rs = static_library(\n   dependencies: [common_rs, glib_sys_rs, qemu_macros],\n )\n \n-qom_rs = declare_dependency(link_with: [_qom_rs], dependencies: [qemu_macros, qom])\n+qom_rs = declare_dependency(link_with: [_qom_rs], dependencies: [qemu_macros, qom, qemuutil])\n \n # Doctests are essentially integration tests, so they need the same dependencies.\n # Note that running them requires the object files for C code, so place them\ndiff --git a/rust/util/meson.build b/rust/util/meson.build\nindex 95b44f7c670..98629394afb 100644\n--- a/rust/util/meson.build\n+++ b/rust/util/meson.build\n@@ -39,10 +39,10 @@ _util_rs = static_library(\n     ],\n     {'.': _util_bindings_inc_rs}\n   ),\n-  dependencies: [anyhow_rs, libc_rs, foreign_rs, glib_sys_rs, common_rs, qom, qemuutil],\n+  dependencies: [anyhow_rs, libc_rs, foreign_rs, glib_sys_rs, common_rs],\n )\n \n-util_rs = declare_dependency(link_with: [_util_rs])\n+util_rs = declare_dependency(link_with: [_util_rs], dependencies: [qemuutil, qom])\n \n rust.test('rust-util-tests', _util_rs,\n           dependencies: [qemuutil, qom],\n","prefixes":["04/11"]}