From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id Wj4DLQaCPmGANwAAgWs5BA (envelope-from ) for ; Mon, 13 Sep 2021 00:41:10 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id UMT1JwaCPmFIBwAAbx9fmQ (envelope-from ) for ; Sun, 12 Sep 2021 22:41:10 +0000 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 aspmx1.migadu.com (Postfix) with ESMTPS id 353CC11F9E for ; Mon, 13 Sep 2021 00:41:10 +0200 (CEST) Received: from localhost ([::1]:47418 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mPY9t-0005dv-9h for larch@yhetil.org; Sun, 12 Sep 2021 18:41:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mPY9m-0005cj-9b for guix-patches@gnu.org; Sun, 12 Sep 2021 18:41:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:60348) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mPY9m-0001iS-2S for guix-patches@gnu.org; Sun, 12 Sep 2021 18:41:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mPY9l-0007kF-Sl for guix-patches@gnu.org; Sun, 12 Sep 2021 18:41:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#47006] [WIP PATCH v2 2/2] gnu: Add zig. Resent-From: Sarah Morgensen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 12 Sep 2021 22:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47006 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Liliana Marie Prikler Cc: 47006@debbugs.gnu.org, =?UTF-8?Q?Andr=C3=A1s_?= =?UTF-8?Q?V=C3=B6r=C3=B6sk=C5=91i?= , maximedevos@telenet.be, efraim@flashner.co.il Received: via spool by 47006-submit@debbugs.gnu.org id=B47006.163148645029747 (code B ref 47006); Sun, 12 Sep 2021 22:41:01 +0000 Received: (at 47006) by debbugs.gnu.org; 12 Sep 2021 22:40:50 +0000 Received: from localhost ([127.0.0.1]:43661 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPY9a-0007jh-03 for submit@debbugs.gnu.org; Sun, 12 Sep 2021 18:40:50 -0400 Received: from out1.migadu.com ([91.121.223.63]:30245) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mPY9U-0007jS-BQ for 47006@debbugs.gnu.org; Sun, 12 Sep 2021 18:40:48 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mgsn.dev; s=key1; t=1631486441; 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: in-reply-to:in-reply-to:references:references; bh=kXFcGR9Ll0b3MuZdrxo/fD4k2dA7RAEEwoy0rkUFruM=; b=IS//Dj/F6cjrOnqxJLdH4TdqYYxBR8IZLfvelKby4sKLCa0xb0WcYsqG5t3+XUdl8PFDN9 6hdVhjdFi26vPXPy61ayKzdDzDWShC13d8c2qMYzg6nXnjwVm/gprYZFpWpvT5LSiQMIo9 zSKRLoloJqMt6v9MV3yKW5eKXcYoosE= From: Sarah Morgensen References: <0f6c5b692df8d06a0d7adddc9e5abf93894a366f.1631226695.git.liliana.prikler@gmail.com> <86wnnmnceg.fsf@mgsn.dev> <865yv6mmk2.fsf@mgsn.dev> <93454096d15aed82b9bf4b1401a0fddcb156f2b7.camel@gmail.com> Date: Sun, 12 Sep 2021 15:40:39 -0700 In-Reply-To: <93454096d15aed82b9bf4b1401a0fddcb156f2b7.camel@gmail.com> (Liliana Marie Prikler's message of "Sun, 12 Sep 2021 09:32:15 +0200 (12 hours, 1 minute, 32 seconds ago)") Message-ID: <86czpdl8ns.fsf@mgsn.dev> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1631486470; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=kXFcGR9Ll0b3MuZdrxo/fD4k2dA7RAEEwoy0rkUFruM=; b=mCOx/cK+nNvi6iHGUOzZpr1iSL+KKDiwQoHOXr5wYhl7V4q6ddcqflxGFmW2cBVHyGvv5L 5PBsqqJEc5Yo9NGsWhDiW5SirXgsCGHdfuDiGvRdsKwFW8FXoq8oP0KkSlECHesywxLwnv jiow3boNvTf+cZS10Lw7XQfp7HBx4kABJz6gPZFCdfwIe6kHOPWWahoqpGGpk+z3qHTDVP +vQnzQylc30QNvJ65ttSv6fw7godZs0Yzm+c/HcAlk06n/hBmXLpxJg9M3kLLioyFq4h42 rHk8KV10nSTVxABQY+whxcECLQ5By75396MQ2GXrOAAdOrlHIski/SKPbLi17A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1631486470; a=rsa-sha256; cv=none; b=j2k4D/yIYb4LA3jhD1IaDM0L4R1cYJnJuUUXF0aHXQ8nQbbnt/Kh9T2+QlMKZX/guQGw+W 7Egf0AlmgNkvIKdFmtPfh+emCaRXaAYVUKoev9DBPT770xGYlWSgrJgnAP+GhUh9bYc2p8 ID+EwFHI3mZKaaWjHlfcg8BYPboO2QTj1rakEXACvDt5XeDUHH8LNqRt2DhMGAzGra+C97 y482NAWd6qO8vtlgmajmjuZ6MGMzjvAWG/3BRGPz87SHvAnAvD1oEMvtVO8c1o/4inju9X uTCDXUV4ljpj3GzNFmysmEHpUxA8YJZND+VVx+SHmSrXuOWxdi+CJxc3iVzFTw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b="IS//Dj/F"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=mgsn.dev (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: 1.69 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b="IS//Dj/F"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=mgsn.dev (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 353CC11F9E X-Spam-Score: 1.69 X-Migadu-Scanner: scn0.migadu.com X-TUID: 1FfRQYSwcsQF Liliana Marie Prikler writes: >> It looks like we're retaining references to the main gcc-7.5.0 >> output, but only to its "include/c++" directory, as a single >> reference in the zig binary. I expect this would cause issues if >> another GCC version were later used with Zig. > Where does that include/c++ come from? Could it be related to the libc > header thing we talked about in IRC? I don't see any substitution for > that going on either. I think the build process for Zig might save it after auto-detecting it as a default include path or something? In the binary, here's where it appears: --8<---------------cut here---------------start------------->8--- -gpsize= GNU::Linker /lib/i386-gnu /../lib/ /usr/lib/ /usr/lib/../ static-lib-linker GNU::StaticLibTool /../../../../ /libc /gnu/store/rn75fm7adgx3pw5j8pg3bczfqq1y17lk-gcc-7.5.0/include/c++ /../include/g++ ld-uClibc-mipsn8.so.0 ld-uClibc.so.0 ld-musl-mipsel.so.1 ld-musl-mips.so.1 /system/bin/linker /system/bin/linker64 /lib/ld-musl- ld-linux-riscv32- ld-linux-riscv64- --8<---------------cut here---------------end--------------->8--- Searching the Clang source yields a const reference in 'lib/Driver/ToolChains/Linux.cpp' at line 406: --8<---------------cut here---------------start------------->8--- const StringRef InstallDir = GCCInstallation.getInstallPath(); const StringRef TripleStr = GCCInstallation.getTriple().str(); const Multilib &Multilib = GCCInstallation.getMultilib(); std::string Path = (InstallDir + "/../../../../" + TripleStr + "/libc" + Multilib.osSuffix()) .str(); --8<---------------cut here---------------end--------------->8--- And I just searched the Clang input for this reference--that exact path with the exact same context as above is present in libclang, libclangDriver, and everything that gets linked to them. So it looks like this one we can blame on Clang as well. >> We're retaining double direct references to gcc-7.5.0-lib, and double >> indirect references to zlib-1.2.11. This seems to come from clang. >> (Wow, clang is big. Maybe it should have a separate "lib" >> output? Zig, for example, only needs libclang to build, not the >> binaries.) >> >> Other than those items, it looks good! > According to `guix refresh', there's only two dependents of Clang 12, > but since we'd have to rebuild all clangs, that might go into core- > updates territory. We might also want to check with an expert on > X/Mesa, since that seems to be one of our biggest clang dependents. Yeah, Clang is an absolute beast to mess with, so I don't think we should let this be a blocker for Zig. I'll submit a bug report to see if I can summon the experts, though. >> + (patches >> + (search-patches >> + "zig-disable-libc-note-test.patch" > Is this test really necessary to skip that test? If not, let's try to > use the command line for that. We could use "-Dskip-compile-errors", but that also skips ~600 other test cases. >> + ;; XXX: Remove the following patch when updating LLVM to >> 12.0.1. >> + "zig-disable-MIPS-tests.patch" > There's a patch for LLVM 12.0.1 waiting in the ML and we could > potentially bump lld to 12.0.1 regardless. (Can LLVM components be > mix-matched like that?) I have no idea if they *can*, but I'm pretty sure they're not intended to be, as LLVM wants you to build everything together in one big blob. >> + "zig-fix-cross-native-execution.patch" > IIUC this is weaker than "-Dskip-non-native". Is there a reason to > include specifically these non-native tests? Yes, as I wrote in the patch header, it fixes the behavior of 'zig run' and 'zig test' when the target is cross-native. Would we want to stick to upstream, even if it's buggy? We might want to add "-Dskip-non-native" anyway as it speeds up tests by an order of magnitude, in which case tests will succeed without the patch. It looks their CI uses it "-Dskip-non-native" as well, and I suppose there's not a whole lot Guix can do to mess up Zig's cross-compiling anyway, since it's pretty self-contained... >> + (native-search-paths >> + (list >> + (search-path-specification >> + (variable "ZIG_INCLUDE_DIRS") >> + ;; XXX: It doesn't seem as though Zig can distinguish between >> C and C++ >> + ;; include paths, so provide both. >> + (files '("include/c++" "include"))) >> + (search-path-specification >> + ;; TODO: Might be confused with "ZIG_LIB_DIR"... Maybe use >> + ;; "ZIG_INCLUDE_PATH" and "ZIG_LIBRARY_PATH"? >> + (variable "ZIG_LIB_DIRS") >> + (files '("lib" "lib64"))))) > You can rewrite "zig-use-explicit-paths.patch" in-place with Emacs' > query-replace and/or sed (or even just manually, there are no lines to > add or remove) if you disagree with my environment variable naming > choice. Just make sure you don't accidentally break diff by deleting > trailing space. > Another potential naming choice would be to prefix everything with > ZIG_LIBC_ rather than simply ZIG_. Of course I thought about that only > after sending my previous mail ^^" Ah, I meant to mention it in my last e-mail but I forgot. I didn't want to just go changing it on you without discussing it. As far as I can tell, there's no such thing as a "Zig library" or a "Zig header"; these are for including system C headers and libraries. So, I would just go with LIBRARY_PATH and CPLUS_INCLUDE_PATH unless we anticipate needing to tell Zig something different than what we tell GCC/Clang. Furthermore, the in-development 'zig cc' command is intended to be a drop-in replacement for GCC/Clang, so it should probably honor the same environment variables. -- Sarah