Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp9883743rwp; Thu, 20 Jul 2023 11:05:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlGjtpf+cWrezea2CdThe6RmMsHCBoXphi/Sf1h1ZvnoZyhpM7ECs8E3kFdsWn0qCA3QV1TT X-Received: by 2002:a17:902:ea08:b0:1b9:cca6:551b with SMTP id s8-20020a170902ea0800b001b9cca6551bmr269618plg.7.1689876312426; Thu, 20 Jul 2023 11:05:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689876312; cv=none; d=google.com; s=arc-20160816; b=eleN2QMVZrX4s5u3rGgv+H3/n3KJg1F+B66mFrUXE2+uAi+uAd8MyBG0m5WFFLbLTS VjR/eCEzkFpqtAggihRqYZ/WliI74PM8N4m0n9/Be/H+zokz8ZfW5A1Vpy0nnrchDPX2 7dpmaoM/6UTxwYZ9G8e8MwN5zfiGoyFcrSZ0pCPZIz1S/lA8fZPYSxfb4VItWA1wFRqE 3H5DE6bu0tAY+AInUP0kOKEaYL5KPga61Yqj7bwLdrtEgMcEOBzK5PHHjlVJRG+XTyqp ECYbfuDBB2lmN29owvRo/JAazN4AV81bSEW1RFmD5zxfogAv3DqTBs4D9xBw4HGjxRMn JBWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=v4nxrppddNKsFTbttsvHKK+PpmQ4xwmOL/11jQHn3uQ=; fh=kDGvrQHyihlv/eqzYx9PJwCy/LaZmoPEmVZkEkvfyKY=; b=d7cTGiUhnOYbyQMBdfncrB9L+pGsqqaV7lknSikBBzq1Z1hBxR7ve4VKLKSuaSgDqo IjN+dDJX9fJOw8ZI3lckvfghfCFTmHn3jtOFhTMbN1zhDkdW7NHk6xxsxDrODtaeAAQV XIr/uMZhjMRbpJv6cYLbNXRhMQj6XL2HRfeKixgyaTqbW5xzhLNZCYWkmDAg+D/iA8vP e5gjq84/iEoaXyW6PX2e6bpsqkC3ZpquJoxlR9L9nrCL1ahZoLrF2Uuv6Nrt2ije+a8y NF71ayosCM09x/inr83v2ZyYQepvcPfjGW2kFVcJ6W9rr2fmcAdL3JimRV3QCBPNjmkm gdXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="G/aM/MIV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kv16-20020a17090328d000b001adc5bc4d8asi1228255plb.572.2023.07.20.11.04.47; Thu, 20 Jul 2023 11:05:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="G/aM/MIV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229653AbjGTRSg (ORCPT + 99 others); Thu, 20 Jul 2023 13:18:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229526AbjGTRSe (ORCPT ); Thu, 20 Jul 2023 13:18:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0457CC; Thu, 20 Jul 2023 10:18:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4FE9F61BA7; Thu, 20 Jul 2023 17:18:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEE71C43397; Thu, 20 Jul 2023 17:18:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689873512; bh=F/C+gSA5qZQ2B3LD6hPsWWKc+LdUI/ORd3hYIi+2pCk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=G/aM/MIVcGavKF4lp/Kw/NvJHOYMkWcPmqmnfq2tTt4jUPEyUOqXto8dOZeP+Kmz4 jH9qq3XHoJhEIQqvmC91ylyW+5FNi3VT70Xb3Zn9eAVdiPdOzf8HTdjjy4JNTXOmW3 w6qIiXQnCzDYjOWHgZB+kSa60j+gYbHNoeIiA2zA/0pX+HuYmgPQ3ubl04UMDWM2fn 96JpcgohHgYDHdgG0sbjWO6GZy6BNpoWIZ+fKAXb4A0OoY7EtjtRc28JH0UxNvP4qc VzQL3libBcNrfP7AcOUbYSEmpHgT2WdfhQ0pba5M3olycbtAVB8Sk8aTE2vIBO8NBN PfztX40rKq2wQ== Received: by mail-oo1-f52.google.com with SMTP id 006d021491bc7-5634808e16eso727417eaf.2; Thu, 20 Jul 2023 10:18:32 -0700 (PDT) X-Gm-Message-State: ABy/qLaUf4PgHtmhGJMx106rt4nOeVa5pA3NVtQjzUnjJ100twXgRJwi NE3RdGhU65lTqaoYhBPSZQiIvjGKXtnoQS0Z8P0= X-Received: by 2002:a4a:5541:0:b0:566:efc4:e4fb with SMTP id e62-20020a4a5541000000b00566efc4e4fbmr554052oob.4.1689873511842; Thu, 20 Jul 2023 10:18:31 -0700 (PDT) MIME-Version: 1.0 References: <20230718055235.1050223-1-ojeda@kernel.org> In-Reply-To: <20230718055235.1050223-1-ojeda@kernel.org> From: Masahiro Yamada Date: Fri, 21 Jul 2023 02:17:55 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kbuild: rust: avoid creating temporary files To: Miguel Ojeda Cc: Wedson Almeida Filho , Alex Gaynor , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Alice Ryhl , Andreas Hindborg , linux-kbuild@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Raphael Nestler , Andrea Righi , stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 18, 2023 at 2:52=E2=80=AFPM Miguel Ojeda wro= te: > > `rustc` outputs by default the temporary files (i.e. the ones saved > by `-Csave-temps`, such as `*.rcgu*` files) in the current working > directory when `-o` and `--out-dir` are not given (even if > `--emit=3Dx=3Dpath` is given, i.e. it does not use those for temporaries)= . > > Since out-of-tree modules are compiled from the `linux` tree, > `rustc` then tries to create them there, which may not be accessible. > > Thus pass `--out-dir` explicitly, even if it is just for the temporary > files. > > Reported-by: Raphael Nestler > Closes: https://github.com/Rust-for-Linux/linux/issues/1015 > Reported-by: Andrea Righi > Tested-by: Raphael Nestler > Tested-by: Andrea Righi > Cc: stable@vger.kernel.org > Signed-off-by: Miguel Ojeda > --- Applied to linux-kbuild/fixes. Thanks. I believe this is a fix, so I will include it in my next pull request. > scripts/Makefile.build | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/scripts/Makefile.build b/scripts/Makefile.build > index 6413342a03f4..82e3fb19fdaf 100644 > --- a/scripts/Makefile.build > +++ b/scripts/Makefile.build > @@ -264,6 +264,9 @@ $(obj)/%.lst: $(src)/%.c FORCE > > rust_allowed_features :=3D new_uninit > > +# `--out-dir` is required to avoid temporaries being created by `rustc` = in the > +# current working directory, which may be not accessible in the out-of-t= ree > +# modules case. > rust_common_cmd =3D \ > RUST_MODFILE=3D$(modfile) $(RUSTC_OR_CLIPPY) $(rust_flags) \ > -Zallow-features=3D$(rust_allowed_features) \ > @@ -272,7 +275,7 @@ rust_common_cmd =3D \ > --extern alloc --extern kernel \ > --crate-type rlib -L $(objtree)/rust/ \ > --crate-name $(basename $(notdir $@)) \ > - --emit=3Ddep-info=3D$(depfile) > + --out-dir $(dir $@) --emit=3Ddep-info=3D$(depfile) > > # `--emit=3Dobj`, `--emit=3Dasm` and `--emit=3Dllvm-ir` imply a single c= odegen unit > # will be used. We explicitly request `-Ccodegen-units=3D1` in any case,= and > > base-commit: 06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5 > -- > 2.41.0 > --=20 Best Regards Masahiro Yamada