From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:42424) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j39B9-0004tX-6H for guix-patches@gnu.org; Sat, 15 Feb 2020 20:57:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j39B8-0005SI-1t for guix-patches@gnu.org; Sat, 15 Feb 2020 20:57:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:58878) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j39B7-0005Rr-RR for guix-patches@gnu.org; Sat, 15 Feb 2020 20:57:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j39B7-0007QZ-Qs for guix-patches@gnu.org; Sat, 15 Feb 2020 20:57:01 -0500 Subject: [bug#39309] [PATCH WIP] gnu: add stack. Resent-Message-ID: From: Timothy Sample References: <87k14vou0u.fsf@ngyro.com> <87y2t6ayax.fsf@ngyro.com> Date: Sat, 15 Feb 2020 20:56:25 -0500 In-Reply-To: <87y2t6ayax.fsf@ngyro.com> (Timothy Sample's message of "Thu, 13 Feb 2020 17:59:34 -0500") Message-ID: <875zg78fcm.fsf@ngyro.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: John Soo Cc: 39309@debbugs.gnu.org Hello again, Timothy Sample writes: > [...] > > I=E2=80=99ll take another look with a fresh mind sometime, and see if I c= an make > any progress. I don=E2=80=99t have a solution, but I have a bit more info. Cabal generat= es extremely long argument lists for GCC. For whatever reason, it repeats the same flags many times (maybe once for each Haskell dependency). When building Stack, it passes Gawk as an include path 164 times. In fact, there are only a handful of distinct include paths, each passed 164 times. The linker flags are similar but much worse. This should be fine since everything is using a response file, right? Nope. Like the bug you linked discusses, GCC writes all of its arguments into an environment variable, the length of which is limited by =E2=80=9CMAX_ARG_STRLEN=E2=80=9D (which is 128K). It would be nice to f= ix GCC here, and it=E2=80=99s almost a very small fix, but there is minor complication. = The normal response file handling in GCC expects =E2=80=9Cargc=E2=80=9D and =E2= =80=9Cargv=E2=80=9D parameters, but the environment variable doesn=E2=80=99t come with an =E2= =80=9Cargc=E2=80=9D. Rather, it has to be parsed (in the same way the shell would do it). It=E2=80=99s still doable, but a it would be a larger change. Not to menti= on that patching GCC is even less fun than patching GHC. There was some work to deduplicate the flags that Cabal generates: . This would actually fix the build, but the call to =E2=80=9Chsc2hs=E2=80=9D doesn=E2=80=99t do the = same deduplication (see =E2=80=9CppHsc2hs=E2=80=9D in =E2=80=9CCabal/Distribution/Simple/PrePr= ocess.hs=E2=80=9D). At this point, it might be worth joining the Nix folks on that issue, and suggesting a patch to Cabal to call =E2=80=9Chsc2hs=E2=80=9D with dedup= licated flags. It will help that the other deduplication code was written by the same person who filed the bug you linked to earlier. Once the patch lands, we can apply it to our Cabal and then Stack will build. Yay! -- Tim