1
Files
hermetic_cc_toolchain/mailing-list-archive.mbox

16594 lines
745 KiB
Plaintext
Raw Normal View History

From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=uber.com header.i=@uber.com
Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48])
by mail-b.sr.ht (Postfix) with ESMTPS id DDF2111EEC2
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Mon, 6 Sep 2021 05:14:56 +0000 (UTC)
Received: by mail-ed1-f48.google.com with SMTP id u19so7815945edb.3
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Sun, 05 Sep 2021 22:14:56 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=uber.com; s=google;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to
:cc:content-transfer-encoding;
bh=7Ep7iTYyg1DX8Hx9AdVtBxHJWPcMfNRMH8EVv7gJalA=;
b=0T3cef8TsPS2gcoAtVKBRrHY8D9aD8FJvFDsizN3PMB0F8l32dLdRv8+TvHspaJs5l
lJdSEzmJ6Hkn1T3DPxjr7qvm9s4+ThTSRkEwFtWerRuftLWxMlUml73Cs0fIhN7FohhH
LNbRleFGhs9sM2EueHyR7e7sc1qdxDd+644IQ=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:cc:content-transfer-encoding;
bh=7Ep7iTYyg1DX8Hx9AdVtBxHJWPcMfNRMH8EVv7gJalA=;
b=Nig0qyUf+TPvScOEAThWQagGYc0pZQnLXdiWR41czq9ODyMBe8281D+altQ/+U7QbU
6x+GKNecxPw/rLFsxDQ+FILzF4tRaV/oQ4nVBsq0ssVb1P4fY5IWlXSn2Rq3tZwSTKtP
Ax2Qz8BX72ywIcQo1ZM2JLhQF6UjvkbGBO0QyXiJT416xQLSjGQUB8arl+Q0fKNFcIJ9
UqwF8qkIyeMfjiL0faClIsNnXJhfa5qEyS6HwFDOdK7f344ExdzDmZNOxWnmhtZCIvpl
AU1dQ6HHK1qKY+VEbkvoq6w05PYihxHk7szMaahtw3USzpe6cF9YepAOxqZNyzM2NWWp
GUFg==
X-Gm-Message-State: AOAM530RHZDN0bVwF4byjoCILBF7XpLVHfGKWcrFVgSdkYjbhCtTeR6T
GY+hwcM4PIIVUci3xE6TPMfllXXNuws916eSE25Cew==
X-Google-Smtp-Source: ABdhPJx06von7JT53TGVZFlki01ijRhmL1GfVC0Mnhpi5vWifJyzoQeSjcDPzMuM5EjLg2LfBIJutd4b5I55Ak3kpsk=
X-Received: by 2002:a05:6402:6cf:: with SMTP id n15mr11581412edy.85.1630905295539;
Sun, 05 Sep 2021 22:14:55 -0700 (PDT)
MIME-Version: 1.0
References: <CAMEgGpyFHe3f=VZgFEDMivQ_rGCmHngBPH5MAC2Va5NvJmRo5g@mail.gmail.com>
<CAK+t98XUb0EmzKu-zOPpZxQM_jcWS=K3AJUuz9tB93COdtJqFw@mail.gmail.com>
<CAEZVCP5BMvXc2W5L0_fYGws8A_GgXwZ4mgtduS3qBzNP97nqSw@mail.gmail.com>
<CAK+t98UYm5FhQFit4vix_RTUzXBfeH+CGVM8-1vQFHtYfLcgXw@mail.gmail.com> <CANeNeVSkKdpeN8BnXciTXBQQhoLFLGKCAKNXCRYyh8ymppdkfg@mail.gmail.com>
In-Reply-To: <CANeNeVSkKdpeN8BnXciTXBQQhoLFLGKCAKNXCRYyh8ymppdkfg@mail.gmail.com>
From: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <motiejus@uber.com>
Date: Mon, 6 Sep 2021 08:14:46 +0300
Message-ID: <CAK+t98X2fo+_f+W1o8hzYX_CXmHVPMNfBN2CoM+soRGgMELOQQ@mail.gmail.com>
Subject: Re: Cross-compilation with zig
To: Adam Bouhenguel <adam@bouhenguel.com>, ~motiejus/bazel-zig-cc@lists.sr.ht
Cc: Steeve Morin <steeve.morin@gmail.com>, Zhongpeng Lin <zplin@uber.com>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
+ ~motiejus/bazel-zig-cc@lists.sr.ht (please subscribe[0]). Also
switching from top-down to bottom-up posting.
On Sun, Sep 5, 2021 at 10:14 PM Adam Bouhenguel <adam@bouhenguel.com> wrote=
:
>
> Thanks for adding me to the thread, Motiejus.
>
> Steeve, I'm very curious to hear how your investigation goes. Please keep=
me posted!
>
> I've been bitten a few times now by regressions in zig cc. Both 0.7.1 and=
0.9-dev have problems with C++ exceptions and break runtime behavior of th=
ird party libraries I'm using.
Zig 0.7.1 to zig 0.9-dev moved from clang-11 to clang-12, so, from the
surface, I would attribute behavior changes to this. Did you narrow
this down to something specific?
> Seems like the ability to build a set of specific projects in bazel (with=
a hermetic zig cc based toolchain) might be helpful for keeping everyone o=
n the same page.
Have you noticed regressions with `zig cc` when upgrading zig? Since
it is covered by "bug stability program[1]", I expect zig upstream to
be quite responsive with regressions there. If C++ behavior changes,
it's probably a fault of a new clang, which should be reported to
Apple (likely with help of zig developers, since they have done this
many times).
> To this end, what do you folks think about having a small suite of accept=
ance tests for the toolchain?
We already have //test:hello[2]. Feel free to add yours.
> As a bonus we might be able to use qemu to ensure that the cross-compiled=
artifacts actually work.
I am looking for multi-arch build support in sr.ht, which is "not yet
available"[3], which would be ideal.
Currently I am cross-compiling to a few architectures and checking
whether the resulting "file" command returns an expected string. I
agree qemu-system-<arch> is a good next step. What are your
architectures of interest?
Motiejus
[0]: https://lists.sr.ht/~motiejus/bazel-zig-cc
[1]: https://ziglang.org/download/0.8.0/release-notes.html#zig-cc
[2]: https://git.sr.ht/~motiejus/bazel-zig-cc/tree/main/item/test/BUILD
[3]: https://man.sr.ht/builds.sr.ht/compatibility.md
[4]: https://git.sr.ht/~motiejus/bazel-zig-cc/tree/main/item/.build.yml
> Cheers,
> Adam
>
> On Thu, Sep 2, 2021, 06:31 Motiejus Jak=C5=A1tys <motiejus@uber.com> wrot=
e:
>>
>> Let me know how it goes. I set up a mailing list on srht for patches, if=
any.
>>
>> On Thu, Sep 2, 2021, 15:42 Steeve Morin <steeve.morin@gmail.com> wrote:
>>>
>>> Hey Motiejus,
>>>
>>> Thank for working on that!
>>> I'll see if I can hack on it one weekend. What I'd like though is have =
the `zig cc` toolchain have the same level of features as the "host" toolch=
ain.
>>> And it feels to me that doing the toolchain.bzl file by hand isn't the =
right way to do it. I'm still looking into how bazel generates it and see i=
f we can let it do it.
>>>
>>> Steeve
>>>
>>>
>>> On Wed, 1 Sept 2021 at 21:03, Motiejus Jak=C5=A1tys <motiejus@uber.com>=
wrote:
>>>>
>>>> Zhongpeng, thank you for bringing the group together. +Adam, who creat=
ed the initial toolchain (mine is a fork of Adam's initial hard work), and =
he has obvious interest in the toolchain too.
>>>>
>>>> Steeve, my zig-cc toolchain is hosted here. I am obviously interested =
in solving all the outlined issues, and rules_go#2894 is one of them. I am =
currently very limited in capacity myself, but happy to merge improvements,=
either the mentioned issues or anything else you find reasonably necessary=
for usage of the toolchain.
>>>>
>>>> Motiejus
>>>>
>>>> On Wed, Sep 1, 2021 at 9:17 PM Zhongpeng Lin <zplin@uber.com> wrote:
>>>>>
>>>>> Hello Motiejus,
>>>>>
>>>>> In today's Bazel-Go maintainers meeting, Steeve (cc'ed) mentioned tha=
t he wanted to work on zig-based toolchain for rules_go. Steeve is also an =
expert in cgo support in rules_go. Checking the last email you sent, it see=
ms you've made good progress on that. Do you still need help on rules_go#28=
94? Steeve is probably the most knowledgeable person for you to talk to if =
you need.
>>>>>
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=uber.com header.i=@uber.com
Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176])
by mail-b.sr.ht (Postfix) with ESMTPS id 7F60211F01D
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Tue, 14 Sep 2021 12:18:17 +0000 (UTC)
Received: by mail-pf1-f176.google.com with SMTP id 18so11985902pfh.9
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Tue, 14 Sep 2021 05:18:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=uber.com; s=google;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to
:cc;
bh=OrT2HLfEH5T84qiDOOT1fkL1jScAGScbvztl9Bh21pc=;
b=90ZPl0uDFnNAu2aY6Ya/MrR2y70iL0LQKpEOGY09XP+7MwX7/86CY6t52iN6YXoH2z
NyujV8NNjIvkDfTt9lTbuTlXfH6zw/zWuXooDeKhJ5F8EV51HksugrDVwRL7pnv8H7ir
a69BVlE46C9ZTXFo+uPGKG0LzUu/FB9bCESWQ=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:cc;
bh=OrT2HLfEH5T84qiDOOT1fkL1jScAGScbvztl9Bh21pc=;
b=Ce65X6V72tRXX3lsb+mUwj1Tl/p6n/UYy3NIcFZ4HyhO7r02nN9WV8dFapeKhWHcHq
aQUqblPaAUew8VnVJ76tt5ycFfyt0r+2uyq50xnoV6K6/1T3bvxJ6/KzUG2eEV/O7hVB
xkMaYXWM4X1d62n18Z0IYGwfH8oNvgS+gNjuaoPipRxDKW5oJ7/hNpWYNK3Bdg1klq0j
JcDZWDVt6Icz2V7bI/Hg5rm4jWjJT2UVhO2dU/ORhTei5G4x4bEB5K2vnBNnewmIZkla
aruAAoUK6ES8wGwDVEs4dkjrtcF4iG+Y+6VdNs7S4c/IK5YPqP3ZWnjiS9SYof/fx3hp
MjNg==
X-Gm-Message-State: AOAM530UpTvU3UcNBbcQR2g9AazB7DLWy/Efj1NzsIcbZOWRJyxpGydG
Oc79jHwoMosaawx9gQ4QRMbjlwM9ThZOelu/hmh05g==
X-Google-Smtp-Source: ABdhPJwrF4zc8+XPliKolcZkIgfEaf2EZWHhN4u3jxGdRRd12ErlTeUw0hq/4vbWlDizwNXDf/l1lw58uq4TfJsojxQ=
X-Received: by 2002:a62:8c08:0:b0:434:652b:1319 with SMTP id
m8-20020a628c08000000b00434652b1319mr4534198pfd.24.1631621895297; Tue, 14 Sep
2021 05:18:15 -0700 (PDT)
MIME-Version: 1.0
References: <CAMEgGpyFHe3f=VZgFEDMivQ_rGCmHngBPH5MAC2Va5NvJmRo5g@mail.gmail.com>
<CAK+t98XUb0EmzKu-zOPpZxQM_jcWS=K3AJUuz9tB93COdtJqFw@mail.gmail.com>
<CAEZVCP5BMvXc2W5L0_fYGws8A_GgXwZ4mgtduS3qBzNP97nqSw@mail.gmail.com>
<CAK+t98UYm5FhQFit4vix_RTUzXBfeH+CGVM8-1vQFHtYfLcgXw@mail.gmail.com>
<CANeNeVSkKdpeN8BnXciTXBQQhoLFLGKCAKNXCRYyh8ymppdkfg@mail.gmail.com>
<CAK+t98X2fo+_f+W1o8hzYX_CXmHVPMNfBN2CoM+soRGgMELOQQ@mail.gmail.com>
<CANeNeVTjtYd8vVzgprM7-LMBS67kugn_rvsocrP80W+rwvsUjQ@mail.gmail.com> <CAEZVCP4=r79nLRghL03Hi7CfKFjF2u3sL97hba9PHQzh7ZhFyg@mail.gmail.com>
In-Reply-To: <CAEZVCP4=r79nLRghL03Hi7CfKFjF2u3sL97hba9PHQzh7ZhFyg@mail.gmail.com>
From: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <motiejus@uber.com>
Date: Tue, 14 Sep 2021 15:18:04 +0300
Message-ID: <CAK+t98Ww6cWU+MRtaPQ=_WVe_mwYmf0h9HHj_O0D-yuXyvoS3A@mail.gmail.com>
Subject: Re: Cross-compilation with zig
To: Steeve Morin <steeve.morin@gmail.com>
Cc: Adam Bouhenguel <adam@bouhenguel.com>, ~motiejus/bazel-zig-cc@lists.sr.ht,
Zhongpeng Lin <zplin@uber.com>
Content-Type: text/plain; charset="UTF-8"
On Tue, Sep 14, 2021 at 2:21 AM Steeve Morin <steeve.morin@gmail.com> wrote:
>
> Alright you guys, I found a way to use bazel's auto toolchain configuration with zig!
> It's rather archaic for now, but it works, I got protoc compiled and running for both macos and linux.
>
> Still needs some love, I'll post updates in the next few days.
Looking forward to anything that will simplify it's setup/boilerplate.
> The main idea is to give to @bazel_tools//tools/cpp:unix_cc_configure.bzl configure_unix_toolchain() what it want, and that's it!
Interesting!
I have slightly updated the toolchain today:
- added support for darwin-arm64 and linux-arm64 host (though don't
have an arm64 machine to test this with).
- tried to upgrade zig itself, but cross-compilation to darwin-amd64
fails with it; there seems to be a regression somewhere. I will look
into it sometime soon.
... so please rebase before sending patches.
Regards,
Motiejus
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45])
by mail-b.sr.ht (Postfix) with ESMTPS id 7AA8311EF38
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Fri, 29 Oct 2021 04:45:34 +0000 (UTC)
Received: by mail-lf1-f45.google.com with SMTP id p16so18563959lfa.2
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Thu, 28 Oct 2021 21:45:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:cc:subject:message-id:references:mime-version
:content-disposition:content-transfer-encoding:in-reply-to;
bh=e1CN1JJJM9joKaUlYnsska9HvRy43YfFeSGJYgiQjQs=;
b=N7pGbkjAvxhSXwB+tTVrJHBV8BHUuBWcqQlTvb/BtI/Jc5fNEvIj/GA7D/AxiqmIR1
27T8aTQ1DlzX+OQOW406lwGXbvZZL3V0ehPNMd7iusogsbnKu2EHBr+ThWpVtedV7vPU
/9iK0Z4ZmfsEN7uJIfRUN7dG+A2YhndnNXTgPJ25NCCICu4PpIOqbgYjywgE1GiC0Hay
YZymEWSaVLn7vKlbEkbxhKZ+UztEBLATrHZRKj5RfKyaqp2tlWgH+0o3I/gLxrtZVcX+
TKhoRqrxjGjYZrkdYwrVpHQ3k2w9/PTe7fRODmp9cYS9PRwEQC30OFWWz3eXgps+DMc8
LPbw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:cc:subject:message-id
:references:mime-version:content-disposition
:content-transfer-encoding:in-reply-to;
bh=e1CN1JJJM9joKaUlYnsska9HvRy43YfFeSGJYgiQjQs=;
b=r89AESahTPDW+InsPvQBy5oShDlHrIWGg57AY8KjJBEXQgzGmw3EvmJjiLcsgSl+Wb
8zqr7NZ1dMcpon8GeT6jHeCKGHshHUqTFd6g52JIBGF/zUCVb56UUBDR3ioI7bGrPQxB
vPys0M00zxd8XxmgXoNXGlzsrPQb5Ey6G4c8LoGfByNU1MGq4QOeJalsLpZlqBRufnC8
KGaMUySwLmdUEJkvr6cwUVU0aH/NFH/a3SNJjqbErS7+BsG8L8c2mHfgXHRK5gKDSSW5
OeZFJhvSyckmkmydjakuc2ujue4AmXI0zHOqHG6x4BmRn9zLXGsubF3PTdnznc0FpSve
3QLw==
X-Gm-Message-State: AOAM530q79ok7W8D4VaBKIDpBl3HwOetwH0gt33opT4qmBP6+foicf1Z
2uv9qkI/iyrmnil6tOaY/QE=
X-Google-Smtp-Source: ABdhPJyuFdbOG4l8g9NVpT78xmShrZBBHNU8pGNzJkGl1MbHL1FDvr/UfAiOZ67yA0UmaKYiXhMxsQ==
X-Received: by 2002:a05:6512:33c2:: with SMTP id d2mr7692886lfg.182.1635482732884;
Thu, 28 Oct 2021 21:45:32 -0700 (PDT)
Received: from localhost ([88.223.105.24])
by smtp.gmail.com with ESMTPSA id e22sm493971lfr.237.2021.10.28.21.45.31
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 28 Oct 2021 21:45:32 -0700 (PDT)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Fri, 29 Oct 2021 07:45:31 +0300
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@uber.com>
Cc: Steeve Morin <steeve.morin@gmail.com>,
Adam Bouhenguel <adam@bouhenguel.com>,
~motiejus/bazel-zig-cc@lists.sr.ht, Zhongpeng Lin <zplin@uber.com>
Subject: Re: Cross-compilation with zig
Message-ID: <20211029044531.vvtv7btw2ur7u6zc@mtpad.i.jakstys.lt>
References: <CAMEgGpyFHe3f=VZgFEDMivQ_rGCmHngBPH5MAC2Va5NvJmRo5g@mail.gmail.com>
<CAK+t98XUb0EmzKu-zOPpZxQM_jcWS=K3AJUuz9tB93COdtJqFw@mail.gmail.com>
<CAEZVCP5BMvXc2W5L0_fYGws8A_GgXwZ4mgtduS3qBzNP97nqSw@mail.gmail.com>
<CAK+t98UYm5FhQFit4vix_RTUzXBfeH+CGVM8-1vQFHtYfLcgXw@mail.gmail.com>
<CANeNeVSkKdpeN8BnXciTXBQQhoLFLGKCAKNXCRYyh8ymppdkfg@mail.gmail.com>
<CAK+t98X2fo+_f+W1o8hzYX_CXmHVPMNfBN2CoM+soRGgMELOQQ@mail.gmail.com>
<CANeNeVTjtYd8vVzgprM7-LMBS67kugn_rvsocrP80W+rwvsUjQ@mail.gmail.com>
<CAEZVCP4=r79nLRghL03Hi7CfKFjF2u3sL97hba9PHQzh7ZhFyg@mail.gmail.com>
<CAK+t98Ww6cWU+MRtaPQ=_WVe_mwYmf0h9HHj_O0D-yuXyvoS3A@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <CAK+t98Ww6cWU+MRtaPQ=_WVe_mwYmf0h9HHj_O0D-yuXyvoS3A@mail.gmail.com>
On Tue, Sep 14, 2021 at 03:18:04PM +0300, Motiejus Jakštys wrote:
> On Tue, Sep 14, 2021 at 2:21 AM Steeve Morin <steeve.morin@gmail.com> wrote:
> >
> > Alright you guys, I found a way to use bazel's auto toolchain configuration with zig!
> > It's rather archaic for now, but it works, I got protoc compiled and running for both macos and linux.
> >
> > Still needs some love, I'll post updates in the next few days.
>
> Looking forward to anything that will simplify it's setup/boilerplate.
Hi all,
the way plans are panning out now, at some point in 2022H1 bazel-zig-cc
will be scrutinized by much more competent colleagues than myself,
before being moved to github.com/uber (or equivalent). After that major
changes will be much harder to make.
Steeve, if you are still considering on major changes in bazel-zig-cc,
this year is better than next year.
Motiejus
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=none
Received: from git.sr.ht (unknown [173.195.146.142])
by mail-b.sr.ht (Postfix) with ESMTPSA id 57B3B11EF37
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Fri, 5 Nov 2021 13:23:34 +0000 (UTC)
From: ~mjonaitis <mjonaitis@git.sr.ht>
Date: Thu, 04 Nov 2021 18:54:42 +0200
Subject: [PATCH bazel-zig-cc] add go_binary override
Message-ID: <163611861421.17091.108675275474200386-0@git.sr.ht>
X-Mailer: git.sr.ht
Reply-to: ~mjonaitis <mjonaitis@uber.com>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
From: Mantas Jonaitis <mjonaitis@uber.com>
---
BUILD | 2 ++
README.md | 7 +++++++
rules/BUILD | 0
rules/go_binary_override.bzl | 27 +++++++++++++++++++++++++++
test/BUILD | 15 ++++-----------
5 files changed, 40 insertions(+), 11 deletions(-)
create mode 100644 rules/BUILD
create mode 100644 rules/go_binary_override.bzl
diff --git a/BUILD b/BUILD
index 07e6a04..a34acae 100644
--- a/BUILD
+++ b/BUILD
@@ -1,6 +1,8 @@
load("@bazel_gazelle//:def.bzl", "gazelle")
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
=20
+# gazelle:map_kind go_binary go_binary //rules:go_binary_override.bzl
+
# gazelle:build_file_name BUILD
# gazelle:prefix github.com/motiejus/bazel-zig-cc
gazelle(name =3D "gazelle")
diff --git a/README.md b/README.md
index 8ae3935..7c83752 100644
--- a/README.md
+++ b/README.md
@@ -116,6 +116,13 @@ go_binary(
)
```
=20
+A workaround with [gazelle](https://github.com/bazelbuild/bazel-gazelle) `ma=
p_kind` directive is possible. This will override rules_go `go_binary` rule w=
ith `go_binary` which contains default `gc_linkopts` parameters. Add this lin=
e to your BUILD files (usually adding to root BUILD file will suffice) and ru=
n `gazelle` to automatically generate `load` statements.
+
+```
+# gazelle:map_kind go_binary go_binary @bazel-zig-cc//rules:go_binary_overri=
de.bzl
+```
+
+
## incorrect glibc version autodetection
=20
**Severity: Low**
diff --git a/rules/BUILD b/rules/BUILD
new file mode 100644
index 0000000..e69de29
diff --git a/rules/go_binary_override.bzl b/rules/go_binary_override.bzl
new file mode 100644
index 0000000..6ac14cf
--- /dev/null
+++ b/rules/go_binary_override.bzl
@@ -0,0 +1,27 @@
+load("@io_bazel_rules_go//go:def.bzl", go_binary_rule =3D "go_binary")
+
+"""
+go_binary overrides go_binary from rules_go and provides default
+gc_linkopts values that are needed to compile for macos target.
+To use it, add this map_kind gazelle directive to your BUILD.bazel files
+where target binary needs to be compiled with zig toolchain.
+
+Example: if this toolchain is registered as bazel-zig-cc in your WORKSPACE, =
add this to
+your root BUILD file
+# gazelle:map_kind go_binary go_binary @bazel-zig-cc//rules:go_binary_overri=
de.bzl
+"""
+def go_binary(**args):
+ new_args =3D {}
+ new_args["gc_linkopts"] =3D select({
+ "@platforms//os:macos": [
+ "-s",
+ "-w",
+ "-buildmode=3Dpie",
+ ],
+ "//conditions:default": [],
+ })
+ for k, v in args.items():
+ new_args[k] =3D v
+ print("Key: {}".format(k))
+ go_binary_rule(**new_args)
+
diff --git a/test/BUILD b/test/BUILD
index 133fe5a..415b9c2 100644
--- a/test/BUILD
+++ b/test/BUILD
@@ -1,4 +1,5 @@
-load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
+load("//rules:go_binary_override.bzl", "go_binary")
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
=20
go_library(
name =3D "hello_lib",
@@ -7,22 +8,14 @@ go_library(
importpath =3D "github.com/motiejus/bazel-zig-cc/test",
visibility =3D ["//visibility:private"],
deps =3D [
- "@com_github_datadog_zstd//:go_default_library",
- "@com_github_mattn_go_sqlite3//:go_default_library",
+ "@com_github_datadog_zstd//:zstd",
+ "@com_github_mattn_go_sqlite3//:go-sqlite3",
],
)
=20
go_binary(
name =3D "hello",
embed =3D [":hello_lib"],
- gc_linkopts =3D select({
- "@platforms//os:macos": [
- "-s",
- "-w",
- "-buildmode=3Dpie",
- ],
- "//conditions:default": [],
- }),
static =3D "on",
visibility =3D ["//visibility:public"],
)
--=20
2.32.0
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=none
Received: from git.sr.ht (unknown [173.195.146.142])
by mail-b.sr.ht (Postfix) with ESMTPSA id 3B44211EF37
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Fri, 5 Nov 2021 13:39:06 +0000 (UTC)
From: ~mjonaitis <mjonaitis@git.sr.ht>
Date: Thu, 04 Nov 2021 18:54:42 +0200
Subject: [PATCH bazel-zig-cc v2] add go_binary override
Message-ID: <163611954593.18596.9121656084211429991-0@git.sr.ht>
X-Mailer: git.sr.ht
Reply-to: ~mjonaitis <mjonaitis@uber.com>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
From: Mantas Jonaitis <mjonaitis@uber.com>
---
BUILD | 2 ++
README.md | 7 +++++++
rules/BUILD | 0
rules/go_binary_override.bzl | 26 ++++++++++++++++++++++++++
test/BUILD | 15 ++++-----------
5 files changed, 39 insertions(+), 11 deletions(-)
create mode 100644 rules/BUILD
create mode 100644 rules/go_binary_override.bzl
diff --git a/BUILD b/BUILD
index 07e6a04..a34acae 100644
--- a/BUILD
+++ b/BUILD
@@ -1,6 +1,8 @@
load("@bazel_gazelle//:def.bzl", "gazelle")
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
=20
+# gazelle:map_kind go_binary go_binary //rules:go_binary_override.bzl
+
# gazelle:build_file_name BUILD
# gazelle:prefix github.com/motiejus/bazel-zig-cc
gazelle(name =3D "gazelle")
diff --git a/README.md b/README.md
index 8ae3935..7c83752 100644
--- a/README.md
+++ b/README.md
@@ -116,6 +116,13 @@ go_binary(
)
```
=20
+A workaround with [gazelle](https://github.com/bazelbuild/bazel-gazelle) `ma=
p_kind` directive is possible. This will override rules_go `go_binary` rule w=
ith `go_binary` which contains default `gc_linkopts` parameters. Add this lin=
e to your BUILD files (usually adding to root BUILD file will suffice) and ru=
n `gazelle` to automatically generate `load` statements.
+
+```
+# gazelle:map_kind go_binary go_binary @bazel-zig-cc//rules:go_binary_overri=
de.bzl
+```
+
+
## incorrect glibc version autodetection
=20
**Severity: Low**
diff --git a/rules/BUILD b/rules/BUILD
new file mode 100644
index 0000000..e69de29
diff --git a/rules/go_binary_override.bzl b/rules/go_binary_override.bzl
new file mode 100644
index 0000000..cb37807
--- /dev/null
+++ b/rules/go_binary_override.bzl
@@ -0,0 +1,26 @@
+load("@io_bazel_rules_go//go:def.bzl", go_binary_rule =3D "go_binary")
+
+"""
+go_binary overrides go_binary from rules_go and provides default
+gc_linkopts values that are needed to compile for macos target.
+To use it, add this map_kind gazelle directive to your BUILD.bazel files
+where target binary needs to be compiled with zig toolchain.
+
+Example: if this toolchain is registered as bazel-zig-cc in your WORKSPACE, =
add this to
+your root BUILD file
+# gazelle:map_kind go_binary go_binary @bazel-zig-cc//rules:go_binary_overri=
de.bzl
+"""
+def go_binary(**args):
+ new_args =3D {}
+ new_args["gc_linkopts"] =3D select({
+ "@platforms//os:macos": [
+ "-s",
+ "-w",
+ "-buildmode=3Dpie",
+ ],
+ "//conditions:default": [],
+ })
+ for k, v in args.items():
+ new_args[k] =3D v
+ go_binary_rule(**new_args)
+
diff --git a/test/BUILD b/test/BUILD
index 133fe5a..415b9c2 100644
--- a/test/BUILD
+++ b/test/BUILD
@@ -1,4 +1,5 @@
-load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
+load("//rules:go_binary_override.bzl", "go_binary")
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
=20
go_library(
name =3D "hello_lib",
@@ -7,22 +8,14 @@ go_library(
importpath =3D "github.com/motiejus/bazel-zig-cc/test",
visibility =3D ["//visibility:private"],
deps =3D [
- "@com_github_datadog_zstd//:go_default_library",
- "@com_github_mattn_go_sqlite3//:go_default_library",
+ "@com_github_datadog_zstd//:zstd",
+ "@com_github_mattn_go_sqlite3//:go-sqlite3",
],
)
=20
go_binary(
name =3D "hello",
embed =3D [":hello_lib"],
- gc_linkopts =3D select({
- "@platforms//os:macos": [
- "-s",
- "-w",
- "-buildmode=3Dpie",
- ],
- "//conditions:default": [],
- }),
static =3D "on",
visibility =3D ["//visibility:public"],
)
--=20
2.32.0
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50])
by mail-b.sr.ht (Postfix) with ESMTPS id 758F711EF37
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Fri, 5 Nov 2021 17:51:50 +0000 (UTC)
Received: by mail-wr1-f50.google.com with SMTP id b12so14932424wrh.4
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Fri, 05 Nov 2021 10:51:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:cc:subject:message-id:references:mime-version
:content-disposition:in-reply-to;
bh=7twJFp2dPdxRaWs/e7LS95o7UbEONAXKNGJm0Ob1Wjg=;
b=a1+afz8XHDlEPSMPQ1FTgCSKIt1O6BU6Rd4OMsdb+YfNN0HarXLbPXkX4nwcoQVJZl
x0TBYE3Lv3abwUPqgPzEvO2sLMXjYZr+ys2guFw/LE3OUQwzEaewfhGeM7mJKoc9wlcf
i5BNu3VV3MsDnylAcsasQ2W/9eEkhZbsQIILo+XOQjiBkEW7CmzR2aSg5bsTLYbGBjz5
4ERwpIY9uod2Z7w4cucD22+vJjRatF7upBT0EqPSw7Pkb5UUvac/z0u0tLh+uoIN+Xw9
d/X/U1GpLXoKyGTwMqq3JCNPXwaESWJdtRmzXXtW3fAC10J7Pa2a8suCwFYSiBOctRhd
wVXA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:cc:subject:message-id
:references:mime-version:content-disposition:in-reply-to;
bh=7twJFp2dPdxRaWs/e7LS95o7UbEONAXKNGJm0Ob1Wjg=;
b=LzlcGF6wJrQFFQM72QIjedm8gc+GZmW44ruRoyW2VSCL/XTPU47Ort7mBfXb51+d0/
HLI5U6348cQ393BjvT1Sl3xByrOLnM7E6rQLQ45WbTAjIbmXTKzOp3ngAAmeiSDuo9XN
IBZFmmu6Ztil9eyyBr1zN9u4yPyLS0OS44m1coDmUG7j4hqsWaUL/e6qZayoYMQyXBzI
g32V/kYSxO+2gcpzc2yI+xVewyST29fczusxH8F33q6ky3FK1nAgpTpSsOmpXQND9K3/
8+5lYmEXYeEIjmR73OlWwQ8qC4NJK6Q3vlaJf5ts7I8unS/E/mN6aNQyespWDRsEUZ4b
D9Aw==
X-Gm-Message-State: AOAM532XofickUl56P1GLD+NqdFHGBckg60NosiMHdXkJsbJ8j24RYrE
rXjKqltKIHdehkIOocslQnc=
X-Google-Smtp-Source: ABdhPJylZROyH/qdWll3OEJtLDTYrSm3ZUIC8mX0SUk/ck3AxLsAnvVQEyMX4exhznKgRF84qJrdFg==
X-Received: by 2002:a05:6000:143:: with SMTP id r3mr5508367wrx.236.1636134709441;
Fri, 05 Nov 2021 10:51:49 -0700 (PDT)
Received: from localhost ([195.235.63.50])
by smtp.gmail.com with ESMTPSA id n7sm8534493wro.68.2021.11.05.10.51.48
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 05 Nov 2021 10:51:48 -0700 (PDT)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Fri, 5 Nov 2021 19:51:54 +0200
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: ~mjonaitis <mjonaitis@uber.com>
Cc: ~motiejus/bazel-zig-cc@lists.sr.ht
Subject: Re: [PATCH bazel-zig-cc v2] add go_binary override
Message-ID: <20211105175154.bzfuu666zuaxyt27@mtpad.i.jakstys.lt>
References: <163611954593.18596.9121656084211429991-0@git.sr.ht>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <163611954593.18596.9121656084211429991-0@git.sr.ht>
On Thu, Nov 04, 2021 at 06:54:42PM +0200, ~mjonaitis wrote:
> From: Mantas Jonaitis <mjonaitis@uber.com>
>
> ---
> BUILD | 2 ++
> README.md | 7 +++++++
> rules/BUILD | 0
> rules/go_binary_override.bzl | 26 ++++++++++++++++++++++++++
> test/BUILD | 15 ++++-----------
> 5 files changed, 39 insertions(+), 11 deletions(-)
> create mode 100644 rules/BUILD
> create mode 100644 rules/go_binary_override.bzl
Applied[1], thank you. Although I left only the acknowledgement in the
README; see [2] for why.
Motiejus
[1]: https://git.sr.ht/~motiejus/bazel-zig-cc/commit/523943bd35d33f96f946be653311787426149135
[2]: https://git.sr.ht/~motiejus/bazel-zig-cc/commit/22b5d3e8e38e762a35adbfd4e13bfe5c2fb07972
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45])
by mail-b.sr.ht (Postfix) with ESMTPS id 9413211EF81
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Mon, 6 Dec 2021 20:01:32 +0000 (UTC)
Received: by mail-lf1-f45.google.com with SMTP id n12so28168895lfe.1
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Mon, 06 Dec 2021 12:01:32 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:cc:subject:message-id:references:mime-version
:content-disposition:content-transfer-encoding:in-reply-to;
bh=XbmO1rVL6sHMTrVhfrqqOl/bwac3U2zY7lWAQ/rHyYI=;
b=Ui4E27zUkVkuxOSfzUqdvgjLvJt2zihUNYH6RF9nSLXybcoG1pmy2uszNB9mMp4OKE
cQuFWrQbItNulmWxf1DF3oAEgyKe7TzjEGgayv/9zDmBJzlYpVetrACw5cx1UZjxHK66
weYxKw7rBN4y9y9mADbf2HLqibIbE61Q2WRJ9N+q09jTqY3t5bOCQaN7NrTnXfvdrMHv
l2+1m2JnjwmHVWnpYNaKODmnO7yBl2G/JtBF7iaVx2gzP8oYtGHZREWaeYfHuAQJtaqB
53rMyZIceJJBpsNv0Od2W/gbBXEtiER5ESSg3zFwZySBYdF5KGfnsa3fclAAxZOKyEkc
n8jg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:cc:subject:message-id
:references:mime-version:content-disposition
:content-transfer-encoding:in-reply-to;
bh=XbmO1rVL6sHMTrVhfrqqOl/bwac3U2zY7lWAQ/rHyYI=;
b=xItNJQnvwvQPGYo/eRO3rcIcghIeEYeqaHhNjWXULh3N/u95sFwCOaPITMuXYQGi3Q
Ob4+R3CDSl54/jzyIM9UTdXO7l9Cjoc46/uE3PcTBxchclkg5wvlW+gf7qqcOPh1CT6N
2yOR9Zm0lm5SsekIu7TZ/i/bt0ki+xegDDLDIkfpaS6FMbAwxpsC8UTU0+Cjro+6z6/b
VeL4OKWI/brQARrFG3ou2k3SEH/5fGDDosuDXuvJLNxHfL19epeM1wRwKu5DNMCN0Xwf
a87rrTOyys46rLwxGIiMzJ774y6pUlTWWyw4Wats/CmugLFoaaAXWLBqIQdvkSuhJm+V
GtXw==
X-Gm-Message-State: AOAM530mwZuS8Zn37xIFZxYCoDokFqKGJTy4gP29snlm1IBQBAVALfoZ
gpL3eENl0BUbF1SG2YeWITc=
X-Google-Smtp-Source: ABdhPJzSblFiitOVK4mUPDvYX2C+QgZFR6SJ06DAAEp2kDJ1On6O52o6QBmThDQZbAdysSZh0aIlgQ==
X-Received: by 2002:a05:6512:2305:: with SMTP id o5mr37990569lfu.362.1638820890548;
Mon, 06 Dec 2021 12:01:30 -0800 (PST)
Received: from localhost ([88.223.105.24])
by smtp.gmail.com with ESMTPSA id q24sm1443528lfp.103.2021.12.06.12.01.29
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Mon, 06 Dec 2021 12:01:29 -0800 (PST)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Mon, 6 Dec 2021 22:01:28 +0200
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: Thomas Way <tway@cloudflare.com>
Cc: ~motiejus/bazel-zig-cc@lists.sr.ht
Subject: Re: bazel-zig-cc contributions
Message-ID: <20211206200128.vyx7b4r5h2moe5dk@mtpad.i.jakstys.lt>
References: <CAO8CkMSaFSeYVsgczJPStPz9M3LDZCUdABRo8Pk1+=U6v-NT0Q@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <CAO8CkMSaFSeYVsgczJPStPz9M3LDZCUdABRo8Pk1+=U6v-NT0Q@mail.gmail.com>
On Mon, Dec 06, 2021 at 05:57:46PM +0000, Thomas Way wrote:
> Hey Motiejus!
> Thank you so much for your work on the Zig CC rules. They're been
> extremely helpful and a true gamechanger for the way we work with our
> repository.
> Per Zig's cache race conditions, we've made some changes to the rules and
> were wondering what the best way to contribute them would be?
Hi Thomas!
See [1]; I also recommend you to subscribe. I haven't heard of anyone
using bazel-zig-cc, so I guess I'll need to be more careful/upfront
about breaking changes.
> A quick summary:
> - Use an alias for the Go-style toolchain. This should be more efficient.
> - Some general cleanup of unused features (i.e unnecessary filegroups).
> - Most importantly: Use a cache location inside Bazel. We found that
> sometimes Zig's cache would become corrupt on the host and would become
> irrecoverable even after running `bazel clean --expunge`. Using a cache
> location inside Bazel fixes this issue and is good practise in general I
> believe.
These sound great, send them over!
> I look forward to hearing from you.
Have you found a need/way to specify a different default url for the zig
bundle? I've been playing with it[2], but unsatisfied with the API so
far.
Motiejus
[1]: https://sr.ht/~motiejus/bazel-zig-cc/#contribution-guidelines
[2]:
https://git.sr.ht/~motiejus/bazel-zig-cc/commit/8f5f249227aa6a9d3de441058eb9d3aae330620b
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42])
by mail-b.sr.ht (Postfix) with ESMTPS id 9975311EF93
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Fri, 10 Dec 2021 07:57:40 +0000 (UTC)
Received: by mail-lf1-f42.google.com with SMTP id m27so16481755lfj.12
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Thu, 09 Dec 2021 23:57:40 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:subject:message-id:mime-version
:content-disposition;
bh=HQ/hL64B6GWzGaNBVZUn4QLaOj38mBj6tYEQkF5T6Hc=;
b=HRbxSWHJkd1mlvqgFdlGyFOVOlXJr8/e2Tz9lm1YMGwoH50u/oTHT0Qv3csF9/DxXs
0vAyK8YeTncB6iGP/uyCF2mzrTRLsWaJXwYMmRGq0Q32iQkHjURwdbaruxZF/EAHx4V9
1O20KHVUapedNnIzdC940UhaYnwTolyUi7tHj6dQLPyA26ukzQK6TYjrlNRZa5qyogX5
W3OTN1Kk0mfU8IOWyCJocFb0sozLbzT//HP/L+UfXkid4IvtpuEfTLIkBr/Ez0fZEXtY
0HW3+PZKwNBV8A1eMNfmX+aW0XPfPpek8mCZ41iGi/5TEBdO2O75520iDnYXYqfc4VZ2
VuCA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:subject:message-id
:mime-version:content-disposition;
bh=HQ/hL64B6GWzGaNBVZUn4QLaOj38mBj6tYEQkF5T6Hc=;
b=rgCpluQpBDnpflGkjPs3XJ4t/c293EfjPhwWqR6bwA+eGn12gq6HsZ8ZC+aPW2TBVX
rdcNzG6RWq4v4asAp8Ng3pDESOGLPADxlsLqS/RxW6pqTzZXNE67kCvoEDEzZ6mE8bIg
AK56XSqB6bfUkl9PJbd4R7l6O4EZjM/7AQGoSY3xW1OQ2XXvQ8PjMNWrSuF6rZVq02y6
MuxhGBzQer/LQmI8M6XL9lNAYKJzeimwG2zVzmGWX+d1cJig37qc3QF1HBK57PG6rxnw
gteWVE/yPY5J3ul1aBTW0VV3seXnb8KixoihOsvc7aH0/PqxjyV6Fga8WbFQvwpDat7c
JRhQ==
X-Gm-Message-State: AOAM533n1LpdCI+K//K6+CY/Cqn/Tw+F334UDBFn1SSG0G+TDXt+3kt+
8NFjbzbVpYsCB/CYuQVrhM+W99Yg5Ck=
X-Google-Smtp-Source: ABdhPJz07XVpRcQkYipcpP+OcZMq1nSXbEg5HLv7ziv6SBn8gWkNFCfBr4BGn3fJkpaD+Ur7p/dZpg==
X-Received: by 2002:ac2:5f85:: with SMTP id r5mr10983167lfe.566.1639123055422;
Thu, 09 Dec 2021 23:57:35 -0800 (PST)
Received: from localhost (m90-131-39-222.cust.tele2.lt. [90.131.39.222])
by smtp.gmail.com with ESMTPSA id a1sm262188lfb.190.2021.12.09.23.57.34
for <~motiejus/bazel-zig-cc@lists.sr.ht>
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 09 Dec 2021 23:57:34 -0800 (PST)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Fri, 10 Dec 2021 09:57:33 +0200
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Subject: recent changes in bazel-zig-cc
Message-ID: <20211210075733.ihb2b57lyges4l6d@mtpad.i.jakstys.lt>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Hi bazel-zig-cc users,
Due to a recent bug-fixing spree in zig, bazel-zig-cc improved quite a
bit:
- `zig c++` no longer errs with the dreaded FileNotFound[1]. This was
very prominent on many-core machines, and now unblocked larger-scale
tests.
- can compile Darwin again: x86_64[2] and aarch64[3]. Although if you
are interested in compiling for Darwin, Jakub's comments in [3] are
must-read.
My only short-term wish-list from Zig today is [4]: if Foundation
framework is requested, but zig doesn't find it, the compiler should
fail. Currently only a warning is emitted, and the binary is wedged with
a possibly "difficult to track runtime exception"[5]:
```
warning(link): framework not found for '-framework CoreFoundation'
warning(link): Framework search paths:
```
I added an Upcoming Wishlist category to the README[6], which is:
- Move Zig cache path to bazel root, so bazel clean --expunge clears the
zig cache.
- Provide a way to specify alternative URLs for the zig toolchain
(currently zig is downloaded from jakstys.lt, which is nuts).
- Rename @zig_sdk//:<toolchain>_toolchain to
@zig_sdk//toolchain:<toolchain> or similar; so the user-facing targets
are in their own namespace.
- Provide a way to specify sysroot for Darwin (OSX). See [#Compiling OS X
executables] for an ongoing discussion.
As bazel-zig-cc is only ~10% of my $dayjob, I am not planning to work on
the above any time soon. But it gives a nice starting point for a
question "how do I help/contribute"?
Zig 0.9.0 is 10 days away, I will cut bazel-zig-cc 0.4.0 once that
happens.
[1]: https://github.com/ziglang/zig/issues/9431
[2]: https://github.com/ziglang/zig/issues/10297
[3]: https://github.com/ziglang/zig/issues/10299
[4]: https://github.com/ziglang/zig/issues/10299#issuecomment-990404953
[5]: https://github.com/ziglang/zig/issues/10299#issuecomment-989153750
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177])
by mail-b.sr.ht (Postfix) with ESMTPS id 6E05E11EF94
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Mon, 13 Dec 2021 02:38:20 +0000 (UTC)
Received: by mail-lj1-f177.google.com with SMTP id bn20so21731895ljb.8
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Sun, 12 Dec 2021 18:38:20 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:subject:message-id:mime-version
:content-disposition;
bh=yoiGVjBHZN2xJAtcYYTqPfPA8yxvgKQ0VkBgA3ZSX20=;
b=f1258iMcV/Wbk9swTsCSoWGYASEwg9aI6PY4Ee8hYi1a6CQMkWzwFdEiaaYyCOpABn
4AtFWDrTM3fZ+ctksbg+tDl782Z9o929B/4SAcfXInX9oKHsobmzO0ChoS7QaFX3JK32
/sKmWTcN6rLg8BUSmN4D8EkIG3mJV48jx1VdbHKSZtlPxHLHIWMIWJCzsTr9ihVMCYkE
2lik9ffXQLWbQScNgwirCm14fb44rEBRQ3ooXYBG/wRsPyH+IP15/fZN47AF7kPrITU1
Pbg2s7PL8WxYNogXtD7f77UsfyN7/YrJOqUIlfe0yxQb1wtMXibAB7su9uSpKZ3/PoIU
q20w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:subject:message-id
:mime-version:content-disposition;
bh=yoiGVjBHZN2xJAtcYYTqPfPA8yxvgKQ0VkBgA3ZSX20=;
b=L9A3RyHTzHV+FMUGbXt87CW6BV9dZ7kcW4N2Y6v6EGeuaGYohH7qt5jGFHF3qL2+rk
lv3ZY/3cCaCgBq1G1QevpO40orf+7Ci4hLvL0YLC8MqI4QWzTemvMJsq3jb8aZ9lBMIs
HMXrqAuEhqatukjO/o5gykvb6oFhJF56HCwe3dIZgud75BaYNSKZKRvg/1X30S9EjBg3
+Y+qElbC26lKKpzvTnlG8VI4Gg+W1aMNeaa6gB/ybsddLGIss+jtoKWgI+Pey/P6b1bV
Hc0mwChymAeWPdIBlYD5cphbFMr9uPl4ceoQCw7l6+du+lI1M2/x5jFUV0taGLBTaHR2
FadA==
X-Gm-Message-State: AOAM532NYpPD+ClV9sorQ9xbOrDBd+RgPqTbGjWmHYTxFYWTzBlmr8Ae
f3Y9g5K1oa/cMkDMkzESuHr/EpL1yy4=
X-Google-Smtp-Source: ABdhPJwy5PDLB0wyelzZ7tpYgzeQzFLInozFHtZ4lQRvqE0cFrzbeHeXlgo/tK2Bzr/WRZea468KCA==
X-Received: by 2002:a05:651c:323:: with SMTP id b3mr26998720ljp.316.1639363097753;
Sun, 12 Dec 2021 18:38:17 -0800 (PST)
Received: from localhost ([88.223.105.24])
by smtp.gmail.com with ESMTPSA id z2sm1235075lfd.301.2021.12.12.18.38.16
for <~motiejus/bazel-zig-cc@lists.sr.ht>
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sun, 12 Dec 2021 18:38:17 -0800 (PST)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Mon, 13 Dec 2021 04:38:16 +0200
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Subject: bazel-zig-cc v0.4.0-rc1
Message-ID: <20211213023816.obgjrpaxt445lzpn@mtpad.i.jakstys.lt>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Hi folks,
I released v0.4.0-rc1; notable changes from v0.3.4:
- upgrade to zig 0.9.0-dev.1950+a76910b69. Now compilation on Darwin
will fail if `-framework` was specified, but wasn't able to be
linked[1]. This happens on darwin/arm64, which I had to disable CI
for. A patch that passes `zig cc --sysroot=/path/to/sdk` is sought
for, if you care about darwin/arm64 (or darwin in general).
- remove default `-O3`[2]. This now re-enables UBSAN by default, which
is an important default in upstream[3].
v0.4.0 will be released when zig 0.9.0 is released, which is scheduled
for Dec 20.
About undefined behavior (removal of `-O3`)
-------------------------------------------
The second change broke my use of brotli, which relies on undefined
behaior[4]. This is my ugly way to mitigate it:
Project's WORKSPACE
```
BROTLI_COMMIT = "4ec67035c0d97c270c1c73038cc66fc5fcdfc120"
http_archive(
name = "brotli",
sha256 = "9f57c32e5903768a03900366d8a055d49c01ecbbded046dce47eae24115b58b8",
strip_prefix = "brotli-%s" % BROTLI_COMMIT,
urls = ["https://github.com/google/brotli/archive/%s.zip" % BROTLI_COMMIT],
patch_args = ["-p1"],
patches = [
"//patches:brotli-disable-undefined-behavior.patch",
],
)
```
And the patch:
```
diff --git a/BUILD b/BUILD
index 07a6793..2b4d1c1 100644
--- a/BUILD
+++ b/BUILD
@@ -43,7 +43,7 @@ config_setting(
create_msvc_config()
-STRICT_C_OPTIONS = select({
+STRICT_C_OPTIONS = ["-DBROTLI_BUILD_PORTABLE"] + select({
":msvc": [],
"//conditions:default": [
"--pedantic-errors",
```
If anyone has a better idea how to append a COPT to a downstream Bazel
project, I would be happy to learn from you.
Motiejus
[1]: https://github.com/ziglang/zig/pull/10312/
[2]: https://git.sr.ht/~motiejus/bazel-zig-cc/commit/985e26b474fb7594bb385ce9382def7c95373ca9
[3]: https://github.com/ziglang/zig/issues/4830#issuecomment-605491606
[4]: https://github.com/google/brotli/blob/ce222e317e36aa362e83fc50c7a6226d238e03fd/CMakeLists.txt#L104-L108
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172])
by mail-b.sr.ht (Postfix) with ESMTPS id 8F7BE11EFCB
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Wed, 15 Dec 2021 13:13:09 +0000 (UTC)
Received: by mail-lj1-f172.google.com with SMTP id z8so33239469ljz.9
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Wed, 15 Dec 2021 05:13:09 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:subject:message-id:mime-version
:content-disposition;
bh=Nd/WltjseH/65+GIHu93VIGVBFJcCg0jRhztUcKW+SU=;
b=YifS23k0ae73nB9jZrmpDfVWyVtYzoJdrWXc+5MNan5dueiYI+Pmjnkg9jxIEOwcnL
+VQHmcJ/Y9M6AdNgdKZwndRPHH0Czcw5mAcY0TeM47/bsU3T430BePLSIS5/O6p6JX/2
Hwxm8E9j6Z7zWCGPQZaZp+rFNsF2Zu9O26JiTRJQUhLsUysQG6FZknoPtpfX3BeZ+yoM
v2LcX8luagONzI+/x3P45oLzYKCDigtt18ZB3KRPNEshaf5dmN8RStVg1IDrw1FjUtRT
oL9zGkok8U8knDDek8p7lhB3MRboeGt594Ne5yQY/fbAJ2/X+Z1+xj7B4K6RRPlnHRXO
OAUQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:subject:message-id
:mime-version:content-disposition;
bh=Nd/WltjseH/65+GIHu93VIGVBFJcCg0jRhztUcKW+SU=;
b=pf8ogSdB1vOvUEquKYzJlAQtWpqT33q/Bg6qFpxtPUo1WjfP9wQr2AaOrjf5vw6aop
xEwyTnjTlepxIE+vzRGJia9BFnl1521dGEJQEs3U1+oUsuBbVRakm8nHmW/nxOXuMJAY
5ZO5wINNUWWAXNCoqAt9IL+AwhgnPu2ywTUtB7U+lSp04UuiykNScGtuZJ2RUx5P+0aj
Fe0POq1r5B4A7Jd7CqsD1ScZryljzSpljtqAUoDyofvfGG9IThOIGh2/7CWvFFgJW8Ad
ZSHXjUYfzwt/y3MJLaJplBF5rsFzROStOsSGLx30sltzXSmCrrJYG1LtXuAIm5rgj1SJ
6rrw==
X-Gm-Message-State: AOAM533R97q6G/KfXwqKpV2oIKXGZVFqUK4F6MiTLkJRDOtDFFszGnUt
aYBdph3HB+26HO13BPLB93gvtQqpLtc=
X-Google-Smtp-Source: ABdhPJx3uV4VjLPjCmWnmHQG63N7zAf+Y2l6UqhNBFLQzu4Z0QoQypdM5i/S04/3RQt/gC2gd7mUZw==
X-Received: by 2002:a2e:7305:: with SMTP id o5mr10152834ljc.180.1639573987957;
Wed, 15 Dec 2021 05:13:07 -0800 (PST)
Received: from localhost ([88.223.105.24])
by smtp.gmail.com with ESMTPSA id o24sm316972lfr.117.2021.12.15.05.13.07
for <~motiejus/bazel-zig-cc@lists.sr.ht>
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Wed, 15 Dec 2021 05:13:07 -0800 (PST)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Wed, 15 Dec 2021 15:13:06 +0200
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Subject: bazel-zig-cc v0.4.0-rc2
Message-ID: <20211215131306.toz7czanzdhhukbe@mtpad.i.jakstys.lt>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Hi folks,
I released v0.4.0-rc2, this time only upgrading zig to
0.9.0-dev.1968+ff93486d0 (from 1950). Two notable changes with regards
to `zig cc`:
- [darwin] zig cc will now fail hard if `-framework` is specified, but
not found. It used to produce a strange-looking, likely-unworkable
binary.
- glibc stubs are fixed[2]. I have been waiting for this for a long
time. More on this in HN[3].
These resolve the last known high-severity issues. Thanks zig team! As I
am not expecting any final-day fixes in zig itself, there likely won't
be an rc3. A few weeks after 0.9.0 is released, I am planning to remove
the dev versions from my mirror[4].
Tip of the day
--------------
This is helpful in `.bazelrc`:
build --compilation_mode=opt
This makes non-tests to be compiled with -O2. Tests will be compiled
without optimizations, making compilation faster, and retaining
UBSAN[5].
Open questions
--------------
The question from last week[6] still holds: how to adjust CFLAGS for an
external Bazel project?
Motiejus
[1]: https://github.com/ziglang/zig/pull/10312
[2]: https://github.com/ziglang/zig/pull/10330
[3]: https://news.ycombinator.com/item?id=29538264
[4]: https://dl.jakstys.lt/zig/
[5]: https://github.com/ziglang/zig/issues/4830#issuecomment-605491606
[6]: https://lists.sr.ht/~motiejus/bazel-zig-cc/%3C20211213023816.obgjrpaxt445lzpn%40mtpad.i.jakstys.lt%3E
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177])
by mail-b.sr.ht (Postfix) with ESMTPS id E229D11EF12
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Mon, 27 Dec 2021 08:41:55 +0000 (UTC)
Received: by mail-lj1-f177.google.com with SMTP id i11so12257671ljm.13
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Mon, 27 Dec 2021 00:41:55 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:subject:message-id:mime-version
:content-disposition;
bh=wbwsWNmX9ACiddCLR8HrD69hw93GH+pGJxzcr23R6rM=;
b=dJQmTKPHoBlHHAkyWNFHks9q1bXMAkrYrZl5scATSk3Njq3uDtNg6ZePXJE2E52O8j
5t3SLmKPiCE4cljIPqMwljlWHrKZZJ3kc4a6cnGGGdXhOV53CHBYg/ox7Ck8f06/v6Ja
Rnw3hk5ExzZdfNIpieCztf5pAczKs+EJ83cxoJOR0KvGdof0gWsOop2M59eFpIEDuBzn
wlgxkVdd3zwmO2lOS7QUwosUkIbOyZkqY7JooI6WvL6GNcxeZdzGZrGy79F2oy1Y9cNc
pxAU1lr/REJg05oAR2T4pnRE5CKu2IEcxQhrj93Ev6xMxsvoNBl+1lPBGRoQjN0mH53i
bD1w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:subject:message-id
:mime-version:content-disposition;
bh=wbwsWNmX9ACiddCLR8HrD69hw93GH+pGJxzcr23R6rM=;
b=0a0GA3vwn7I9H5bZ+7j9JKANjBci6Cy6bVy2w2CwnWwTaa7DFuQtq3WPn1ew623EN3
0MOuhwhGNKATpe2xicuCNX0bGAYcdELucvNqCRgtJmCCemuvpNhft+iqNFqbikUU104R
MXZJ4umCMwL7q9qFSHFZ2ss7yzsOpPipUsEx8vUfzbWDK+t/C0k8TbqPYu9J5GxTM0Ij
pykyVmYm1dZgTnZ2/MnnTupfSVB0lyT1IVCaKlcShPKNoZBMVVoGlSPC9OcwrxvFmCyO
/1VVlw3/SSvaDsubVmRRLygqLzc2g+u4u4qvhgFm6jIwycYgUMQmftvWCpg+byXQi1w2
+YIw==
X-Gm-Message-State: AOAM53232Y6heOR1VRU9KAEewm/STKfMJjfFhmrKpvp33SRSRIjhReRT
MzLK1b9lTWFqiutkuzy6t/tEP8Xd2Nw=
X-Google-Smtp-Source: ABdhPJx6ysrzoYMTFmAldsjWAd2AmWOnspuGaPYDfO1NywR7rTlaoEe1V3yyloNzmWWczgMgR9EN1A==
X-Received: by 2002:a05:651c:12c3:: with SMTP id 3mr13364719lje.311.1640594514193;
Mon, 27 Dec 2021 00:41:54 -0800 (PST)
Received: from localhost ([88.223.105.24])
by smtp.gmail.com with ESMTPSA id z17sm1581748lfu.128.2021.12.27.00.41.53
for <~motiejus/bazel-zig-cc@lists.sr.ht>
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Mon, 27 Dec 2021 00:41:53 -0800 (PST)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Mon, 27 Dec 2021 10:41:52 +0200
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Subject: upcoming bazel-zig-cc 0.4.0
Message-ID: <20211227084152.mjkx33nbxhnls5qz@mtpad.i.jakstys.lt>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Hi folks,
I cannot yet release bazel-zig-cc 0.4.0, because there is a regression
in `zig c++`; you may follow along here[1].
I am happy bazel-zig-cc CI caught this[2]; this regression was quite
easy to trigger.
I accidentally pushed 0.4.0 a few days ago, but promptly deleted the
tag. If you managed to catch 0.4.0 (it was there for <1 hour), please
remove the tag. My mistake, I will try harder not to do this again.
Note that this affects only glibc targets; I am successfully using zig
0.9.0 with a musl target (0.4.0-rc2 with a custom zig version).
Regards,
Motiejus
[1]: https://github.com/ziglang/zig/issues/10386
[2]: https://builds.sr.ht/~motiejus/job/654617
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54])
by mail-b.sr.ht (Postfix) with ESMTPS id 3EB8D11EFDB
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Tue, 4 Jan 2022 17:16:46 +0000 (UTC)
Received: by mail-wr1-f54.google.com with SMTP id q16so77569936wrg.7
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Tue, 04 Jan 2022 09:16:46 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=mime-version:from:date:message-id:subject:to;
bh=KTpeB6mEXbEVO9a1XtNR3GFzrxOFWa+ZXF8Ntx3rgQE=;
b=Xqqvwjx/OFAQCXqZrQRRfr4f/6Hy6ogWOP8o9/6CBrtsLEFipeCcyCM4UlWOpa/9Fy
VKSnc4F2ZzQVZVUES7wSf7KFum76ug5kMU5PwBuFX9A8bEf9lcHrpCxXN3x9H+9TPvC6
7sKeEX/UHtzvz+DW+rRwhFs8avs4emaJytc1g/5xrdZHYzRQBJjc0JOQk4YmenkQWYh5
CoCPoKtD+0AHORd7s4bAjdxHcSuNco/9YOtrNcpbpJoZWpBuF89vpOhiNnXkjHZ+Ib5r
fpS0I0H/WuM6OPAtWk/9buSDH8eMqeQvdFfM8NQOQpfnuznjacKtcOmDxitr3qGpYlP0
o1rQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
bh=KTpeB6mEXbEVO9a1XtNR3GFzrxOFWa+ZXF8Ntx3rgQE=;
b=EoaQhWc7ZeEt+nZ4OO9aWJ8EBVIwUx77DkAP8gfTjY4TOTQdw3NvqB8IXfMOaKncLL
jHzl5jeG2xBsKuMluZ5T39g+CHXiauQpeE6xAwO1tMdspk8LLhNtqNXiE03o/MKLi2DX
n0Z2CNfyj5kIXSn4+xGuGjoxxj3skjGSu8Qo81FdEzmQYeSCXsRGuiPehleMRtjyo4Y6
wppYadALhSCdQYpYtBK260baG1d8NlhO0I8qT3EGA9svs6Pq+2Jmn64poWYcLrwXdehI
hgKWt1gq9HEetyBTozHsntK3+rM5I/9rWaqoisQ2RXCHjLk7ABmXRT+GnG/TPOklhyH2
bvOA==
X-Gm-Message-State: AOAM533nQTAoOK3lrkUd5a9qUOIOlNZqE9sijsCribhFatAX7FRj5Yk4
AAxFSmbbSf9wffS6dz99DqKatIhgqm/6eHoqtxtPf1bPXSk=
X-Google-Smtp-Source: ABdhPJz5SDvu+LXfelCJO5FWEZ1/pCy7suiHJOP2dd4cF85wjaqUTXVLRsNB38Gvt9oPDvc//YU8gletRsD/roItGgQ=
X-Received: by 2002:adf:fc0d:: with SMTP id i13mr42706077wrr.296.1641316604314;
Tue, 04 Jan 2022 09:16:44 -0800 (PST)
MIME-Version: 1.0
From: Joe Schafer <joesmoe10@gmail.com>
Date: Tue, 4 Jan 2022 09:16:33 -0800
Message-ID: <CAOGO9CoqMcAp=_9KVB3g9o5Jp45OtcAP7TT_Cn_Gom-YfQ9pew@mail.gmail.com>
Subject: uname -m on M1 MacBook returns arm64
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Content-Type: text/plain; charset="UTF-8"
Hello,
I'm a big fan of this project. It's *lot* easier than trying to figure
out other Bazel CC toolchains.
One of my teammates ran into a curious error on an M1 Macbook using
the latest bazel-zig-cc.
cc/toolchain/defs.bzl", line 219, column 70, in _zig_repository_impl
zig_include_root =
repository_ctx.attr.host_platform_include_root[host_platform]
Error: key "macos-arm64" not found in dictionary
I traced this to toolchain/defs.bzl [1] which uses `uname -m` to get
the architecture. It looks like bazel-zig-cc only supports aarch64 but
M1 Macs return arm64.
What's really spooky is that bazel-zig-cc worked on my M1 mac but it
didn't work for two other devs on my team also on M1 macs; they got
the above error.
I was able to work around the problem with the following steps:
https://gist.github.com/jschaf/c9be10d806020087680310e49f6e2072.
- Uploaded all zig SDKs to my own hosting. I had to use my own hosting
to create macos-arm64 which is really just a copy of maco-aarch64 but
I had to change the folder name to match the archive name.
- Added "macos-arm64" to host_platform_include_root, similar to "macos-aarch64".
I'm by no means a Bazel toolchain expert, but I would have thought
there's a better way to get the host platform architecture than by
shelling out to uname. Appears that there's not [2] but that answer is
from 2017. Maybe platforms provide a way out [3]?
[1]: https://git.sr.ht/~motiejus/bazel-zig-cc/tree/main/item/toolchain/defs.bzl#L210
[2]: https://stackoverflow.com/a/45029999/30900
[3]: https://github.com/bazelbuild/rules_go/blob/master/go/private/go_toolchain.bzl#L95
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41])
by mail-b.sr.ht (Postfix) with ESMTPS id E27F211EEAC
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Tue, 4 Jan 2022 19:01:44 +0000 (UTC)
Received: by mail-ed1-f41.google.com with SMTP id j21so152096346edt.9
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Tue, 04 Jan 2022 11:01:44 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:cc:subject:message-id:references:mime-version
:content-disposition:in-reply-to;
bh=sqozoOSn/Xg8xLEoqSt6hEPuCR5lAjjcsfSFhFhcG28=;
b=a5i7J7P+5dbR5hl9nrzn0rGAkpdY0vv+Cc/GvjD76am5EYdD6fAfwSTe7zkNzUa057
9BHEl6yT3TJB64QY7y46wtmX2arRDct0A1vVBi3rkNeU9qNm7HAc9SyjMMWH3qnKYjPj
/2hKFGMdZl8nPSQQLbe5jNHWWjy4pHjTufC3T0bnslJYRb/ZF/St8ceebXJdsd2QK39r
lOsuZBdKccvOU4hCU16mI+TNlXSCru8VJoagGVFrct1KumgBPaMw9TPacKtGAhJGtO2S
K1v6VICmXAKJQdpUpAjJGDA8SWMTbK66r8ePnQCfmTIw5ulTzWnZsstAhlbJZ4iIXaKy
0UKA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:cc:subject:message-id
:references:mime-version:content-disposition:in-reply-to;
bh=sqozoOSn/Xg8xLEoqSt6hEPuCR5lAjjcsfSFhFhcG28=;
b=Sh6rOJJbCS73hQaXWJ24BSAdUhnVxIcU9hHGN5WQIPR4n4jP+sEJjaN4kVurdXFwhP
XlpdrGSkqKLwjhYUI66FDhQBMIh2kylKLftNE8C0u027dJ/iGtRnGbdUQXOAf6Q8E8+b
+lMJoI55Jvl0g+ytjpGDyXUYgnZj7jxuWtZTchTRiB1f+GbBpPxIQtexfo9FbnWfM0gk
6tUJlR9VFLallMaiIDyJmgdDKhgN6xpd2Z8dUvK3GApXvgUjimuOHgiU/0omX5giImRB
3+XhMfBShAVDj3hFL+gWid4JB0YMZyr7TqRB0JJyCTZ8k9xxMnzKslN0fAqoaQW/rfxX
lKMg==
X-Gm-Message-State: AOAM531XYd7AS2cJLP7y2V3qLSjker6j1R0GeTmQmEqRsP+VLbmd6h09
1xv4u9Wi6FL3PkC+fRkk1PE=
X-Google-Smtp-Source: ABdhPJxmWYo6/XUgdzhYjIyhKSbIam61biE8MnttlBA315Az3EYiIUwHczhxeqqmFvn3kXL69nQs5A==
X-Received: by 2002:a05:6402:1702:: with SMTP id y2mr49857910edu.372.1641322903749;
Tue, 04 Jan 2022 11:01:43 -0800 (PST)
Received: from localhost (c54-242.i04-14.onvol.net. [84.255.54.242])
by smtp.gmail.com with ESMTPSA id nd36sm11599581ejc.196.2022.01.04.11.01.42
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Tue, 04 Jan 2022 11:01:43 -0800 (PST)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Tue, 4 Jan 2022 20:01:42 +0100
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: Joe Schafer <joesmoe10@gmail.com>
Cc: ~motiejus/bazel-zig-cc@lists.sr.ht
Subject: Re: uname -m on M1 MacBook returns arm64
Message-ID: <20220104190142.gwu27ru3iprhkyr2@mtpad.i.jakstys.lt>
References: <CAOGO9CoqMcAp=_9KVB3g9o5Jp45OtcAP7TT_Cn_Gom-YfQ9pew@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <CAOGO9CoqMcAp=_9KVB3g9o5Jp45OtcAP7TT_Cn_Gom-YfQ9pew@mail.gmail.com>
On Tue, Jan 04, 2022 at 09:16:33AM -0800, Joe Schafer wrote:
> Hello,
>
> I'm a big fan of this project. It's *lot* easier than trying to figure
> out other Bazel CC toolchains.
>
> One of my teammates ran into a curious error on an M1 Macbook using
> the latest bazel-zig-cc.
>
> cc/toolchain/defs.bzl", line 219, column 70, in _zig_repository_impl
> zig_include_root =
> repository_ctx.attr.host_platform_include_root[host_platform]
> Error: key "macos-arm64" not found in dictionary
>
> I traced this to toolchain/defs.bzl [1] which uses `uname -m` to get
> the architecture. It looks like bazel-zig-cc only supports aarch64 but
> M1 Macs return arm64.
>
> What's really spooky is that bazel-zig-cc worked on my M1 mac but it
> didn't work for two other devs on my team also on M1 macs; they got
> the above error.
Hi, Joe,
that's interesting indeed. I don't have an M1 mac, nor know anyone
with M1 mac, to test this "more closely".
> I was able to work around the problem with the following steps:
> https://gist.github.com/jschaf/c9be10d806020087680310e49f6e2072.
>
> - Uploaded all zig SDKs to my own hosting. I had to use my own hosting
> to create macos-arm64 which is really just a copy of maco-aarch64 but
> I had to change the folder name to match the archive name.
>
> - Added "macos-arm64" to host_platform_include_root, similar to "macos-aarch64".
>
> I'm by no means a Bazel toolchain expert, but I would have thought
> there's a better way to get the host platform architecture than by
> shelling out to uname. Appears that there's not [2] but that answer is
> from 2017. Maybe platforms provide a way out [3]?
Re [3]: looks like `declare_toolchains` is an external function, and it
accepts `host` as a parameter, which should be set by the caller? If so,
I am not following how that would help.
If you can dig in for more information why `uname -m` returns arm64 vs
aarch64 (OSX minor version? something else?). If there is no other way
out, I would be OK to for an internal workaround to map darwin/arm64 to
darwin/aarch64 during download, provided it's the only problem
Is downloading the toolchain the only problem? Once you add that
workaround, does it keep working as one would expect?
Motiejus
> [1]: https://git.sr.ht/~motiejus/bazel-zig-cc/tree/main/item/toolchain/defs.bzl#L210
> [2]: https://stackoverflow.com/a/45029999/30900
> [3]: https://github.com/bazelbuild/rules_go/blob/master/go/private/go_toolchain.bzl#L95
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47])
by mail-b.sr.ht (Postfix) with ESMTPS id 51C2B11F170
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Thu, 6 Jan 2022 22:43:41 +0000 (UTC)
Received: by mail-wr1-f47.google.com with SMTP id a5so3645821wrh.5
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Thu, 06 Jan 2022 14:43:41 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to
:cc:content-transfer-encoding;
bh=WVJwDaPOhVhlyrEU+IRdCCE5Bs5cs9UYUZN+DWlC13U=;
b=Z/YdhgFssOWay1GX6DwjpELzE/O5CmnFXAOJZ+pn2YLEu07Qs9sIEatIYuFpIWdSGz
3ys7HemMNLgN40g+u90oqSWvUIBDpaxaeuzkXAyzJz/u5dnF2H+EFJdKa4b2RoldgMR2
vX/4tDQIRRuhEfjp4xdZ4sIEhjdpvpXGkI5UFaxymHpynCWdKJCF5yY5e7YcJU54tUkQ
B+n9XOftt91ax28/+6M2tsQSvr/lZQHWDc6MWOuTfpmcuHdme0or7AjCV1d4Szmi1lCK
2OxbGJm9YGHDbbEwYJnk0x+tpppdnKJ3fRryThv+wh2eIsqV3pjANZRW7lN6dl2GnY5+
xcSw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:cc:content-transfer-encoding;
bh=WVJwDaPOhVhlyrEU+IRdCCE5Bs5cs9UYUZN+DWlC13U=;
b=nHdFi9MD25Cmnt+QIo5ORWYAUAwJkPxPhA7B5pAWgHocWB4t7WqwMhBBwOW2Ak2NJn
mcGhdWj/ZTE2/v0CEOo25uOng9gFD/dAxcRSnxNmgSYGGlJOUCTebMA+e8ke9UzpY6Mu
Jebqf1DK8Z7Z5kbQInEtTVN2d3GPFrWbv09WRDBKwZgITEpm5cJwGMRiicQ7cT3X3w5n
1yjZCN0MMkld5x67RL8MhTt67uFMOsg2Fjuyeb+GSfMuSifmEFebd3sssa4bWP9KNDWQ
PcuyVLGDarSS3tAKPnpLBbCDX8mcwvZE5jxigcq+aDyv7AeneNSs2qlUYP7G2ZVVIVHf
v6dQ==
X-Gm-Message-State: AOAM531xruJG1qetqb3s6+BOTwLPHXsX/dT/uuM4/WasEwcAw9Os6Sxu
j4REnms9oZpJjZToGhu1eb29LLGb/DMsOjF10q8=
X-Google-Smtp-Source: ABdhPJxRSSzGKj43T3pehcBp+IYkqmzlgASVkMQHNoO58R9ZKtMCcLdOodTRXRfoEgA0ot8Jo67L0SZFfh1RBrbXXCU=
X-Received: by 2002:a5d:64c6:: with SMTP id f6mr50835474wri.711.1641509019852;
Thu, 06 Jan 2022 14:43:39 -0800 (PST)
MIME-Version: 1.0
References: <CAOGO9CoqMcAp=_9KVB3g9o5Jp45OtcAP7TT_Cn_Gom-YfQ9pew@mail.gmail.com>
<20220104190142.gwu27ru3iprhkyr2@mtpad.i.jakstys.lt>
In-Reply-To: <20220104190142.gwu27ru3iprhkyr2@mtpad.i.jakstys.lt>
From: Joe Schafer <joesmoe10@gmail.com>
Date: Thu, 6 Jan 2022 14:43:28 -0800
Message-ID: <CAOGO9Cr=foMi5dX8m_ygVxeX_YVMRU1D=Ex7mTxL9ew_VBpYQA@mail.gmail.com>
Subject: Re: uname -m on M1 MacBook returns arm64
To: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <motiejus@jakstys.lt>
Cc: ~motiejus/bazel-zig-cc@lists.sr.ht
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
> If you can dig in for more information why `uname -m` returns arm64 vs
aarch64 (OSX minor version? something else?)
I think I figured it out. It depends on whether the Bazel binary is an amd6=
4
or arm64 binary. I installed the amd64 version Bazel first on my team befor=
e
arm64 was available. macOS runs the amd64 binary and propagates the
architecture down the call chain, including the subshell to uname. I can
confirm by running uname under x86_64 emulation with:
arch -x86_64 uname -m
x86_64
So I think this package will not work for an M1 mac running an arm64 versio=
n
of Bazel. I think an internal translation from arm64 to aarch64 is likely t=
he
easiest approach.
> Is downloading the toolchain the only problem? Once you add that
workaround, does it keep working as one would expect?
Yep, as long as both the host_platform_sha256 and
host_platform_include_root dictionaries account for arm64.
On Tue, Jan 4, 2022 at 11:01 AM Motiejus Jak=C5=A1tys <motiejus@jakstys.lt>=
wrote:
>
> On Tue, Jan 04, 2022 at 09:16:33AM -0800, Joe Schafer wrote:
> > Hello,
> >
> > I'm a big fan of this project. It's *lot* easier than trying to figure
> > out other Bazel CC toolchains.
> >
> > One of my teammates ran into a curious error on an M1 Macbook using
> > the latest bazel-zig-cc.
> >
> > cc/toolchain/defs.bzl", line 219, column 70, in _zig_repository_imp=
l
> > zig_include_root =3D
> > repository_ctx.attr.host_platform_include_root[host_platform]
> > Error: key "macos-arm64" not found in dictionary
> >
> > I traced this to toolchain/defs.bzl [1] which uses `uname -m` to get
> > the architecture. It looks like bazel-zig-cc only supports aarch64 but
> > M1 Macs return arm64.
> >
> > What's really spooky is that bazel-zig-cc worked on my M1 mac but it
> > didn't work for two other devs on my team also on M1 macs; they got
> > the above error.
>
> Hi, Joe,
>
> that's interesting indeed. I don't have an M1 mac, nor know anyone
> with M1 mac, to test this "more closely".
>
> > I was able to work around the problem with the following steps:
> > https://gist.github.com/jschaf/c9be10d806020087680310e49f6e2072.
> >
> > - Uploaded all zig SDKs to my own hosting. I had to use my own hosting
> > to create macos-arm64 which is really just a copy of maco-aarch64 but
> > I had to change the folder name to match the archive name.
> >
> > - Added "macos-arm64" to host_platform_include_root, similar to "macos-=
aarch64".
> >
> > I'm by no means a Bazel toolchain expert, but I would have thought
> > there's a better way to get the host platform architecture than by
> > shelling out to uname. Appears that there's not [2] but that answer is
> > from 2017. Maybe platforms provide a way out [3]?
>
> Re [3]: looks like `declare_toolchains` is an external function, and it
> accepts `host` as a parameter, which should be set by the caller? If so,
> I am not following how that would help.
>
> If you can dig in for more information why `uname -m` returns arm64 vs
> aarch64 (OSX minor version? something else?). If there is no other way
> out, I would be OK to for an internal workaround to map darwin/arm64 to
> darwin/aarch64 during download, provided it's the only problem
>
> Is downloading the toolchain the only problem? Once you add that
> workaround, does it keep working as one would expect?
>
> Motiejus
>
> > [1]: https://git.sr.ht/~motiejus/bazel-zig-cc/tree/main/item/toolchain/=
defs.bzl#L210
> > [2]: https://stackoverflow.com/a/45029999/30900
> > [3]: https://github.com/bazelbuild/rules_go/blob/master/go/private/go_t=
oolchain.bzl#L95
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48])
by mail-b.sr.ht (Postfix) with ESMTPS id 5DC9611EF4B
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Fri, 7 Jan 2022 19:10:47 +0000 (UTC)
Received: by mail-ed1-f48.google.com with SMTP id a18so24731800edj.7
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Fri, 07 Jan 2022 11:10:47 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:cc:subject:message-id:references:mime-version
:content-disposition:in-reply-to;
bh=mta6/kgE1u4vhkm5wKRTH7vrhBWpwE4m037Yrcq+h8k=;
b=cwU6fvE8zumy7+kfivo84iJf9gJnFO3+SS8nGqTNtHk63A/mVHWUMjG/8Myof0S1iB
Evq8JKMfHWTlFNHAXQAqisYTJgQcDF/FhutaE0KYfGaoS0jZrASHQVLBzmSqAEL7CMsA
n7arDFnhywBPsYlQYcZJdS6DQQMwk5lOU7NDl3/vMmhCLzztb5pnDMVIHDYIeNuM6JiH
AnGlVvROwU2JHYu/oTZMngfhRr3qe7rAh5UVQDQAPStYvPYUPg3DVJfzlqUjlEq9dNTb
KoOiftL/jkiqgO6Ef9tfl86STF1jl7ovMTrUdfaM92oh2Lrg4mPrd6j9y9I1llGAEBOr
+oIQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:cc:subject:message-id
:references:mime-version:content-disposition:in-reply-to;
bh=mta6/kgE1u4vhkm5wKRTH7vrhBWpwE4m037Yrcq+h8k=;
b=ahwosd6ENKxO3uOYiH1wRIn1v2+tXREtNQzPlkjcsS+a6BJXRgQr8fm+O2nvBbd9ji
a8g1wRrjgeY1W1wuVs+bUKrTxE0u22v5wUxrsJpxT0axtg6v13Q5jXaUyg7tisCWdu0k
B5zvX0LAzL3xkcll3CJ0lpr8B/KR+XZXGFXf5pjN4DYcnf+Wonk71z8h+WfJi6+g1cRP
xfKATpGqBEbvjNHwfN8PFw+kX1PYqHUmWcTcrr2J2iUlg+Qwb/rrdrUD2Tv3z9QRwa3h
w/O8Nxk1xTTf6ClJZ5S94Eb1D2Q2WQAkKNvyjg0/8sv/vWXELsfRed5FFju/KJGy6UHQ
CpNw==
X-Gm-Message-State: AOAM532KdgUfIklM7pNasbPCLx4Uxn6SCjPEQaXH0Xg9ng5RfMU3QrtV
1qD54g4GQcqyGWGiGcrrFc8=
X-Google-Smtp-Source: ABdhPJzfI4GCxLf8Gg1gskwaSfK0xpn5sH/6JMdgodDJX7fdSEAxLasmU6+TAV5+tlW9A8nUGdygPQ==
X-Received: by 2002:a17:907:9808:: with SMTP id ji8mr51547186ejc.665.1641582646132;
Fri, 07 Jan 2022 11:10:46 -0800 (PST)
Received: from localhost (c54-242.i04-14.onvol.net. [84.255.54.242])
by smtp.gmail.com with ESMTPSA id j9sm23919ejg.64.2022.01.07.11.10.44
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 07 Jan 2022 11:10:45 -0800 (PST)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Fri, 7 Jan 2022 20:10:43 +0100
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: Joe Schafer <joesmoe10@gmail.com>
Cc: ~motiejus/bazel-zig-cc@lists.sr.ht
Subject: Re: uname -m on M1 MacBook returns arm64
Message-ID: <20220107191043.5tl2jcliuh4ehp74@mtpad.i.jakstys.lt>
References: <CAOGO9CoqMcAp=_9KVB3g9o5Jp45OtcAP7TT_Cn_Gom-YfQ9pew@mail.gmail.com>
<20220104190142.gwu27ru3iprhkyr2@mtpad.i.jakstys.lt>
<CAOGO9Cr=foMi5dX8m_ygVxeX_YVMRU1D=Ex7mTxL9ew_VBpYQA@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <CAOGO9Cr=foMi5dX8m_ygVxeX_YVMRU1D=Ex7mTxL9ew_VBpYQA@mail.gmail.com>
On Thu, Jan 06, 2022 at 02:43:28PM -0800, Joe Schafer wrote:
> > If you can dig in for more information why `uname -m` returns arm64 vs
> aarch64 (OSX minor version? something else?)
>
> I think I figured it out. It depends on whether the Bazel binary is an amd64
> or arm64 binary. I installed the amd64 version Bazel first on my team before
> arm64 was available. macOS runs the amd64 binary and propagates the
> architecture down the call chain, including the subshell to uname. I can
> confirm by running uname under x86_64 emulation with:
>
> arch -x86_64 uname -m
> x86_64
>
> So I think this package will not work for an M1 mac running an arm64 version
> of Bazel. I think an internal translation from arm64 to aarch64 is likely the
> easiest approach.
>
> > Is downloading the toolchain the only problem? Once you add that
> workaround, does it keep working as one would expect?
>
> Yep, as long as both the host_platform_sha256 and
> host_platform_include_root dictionaries account for arm64.
Hi Joe, thanks for clarifying!
In that case, I will accept a patch that rewrites the architecture for
OSX from arm64 to aarch64. Please don't extend the dict though, as it
will be duplicate information and thus harder to maintain. Something
along the lines:
arch = `uname -m`
# two sentence explanation (an extract from your email would suffice)
if macos and arch == "arm64"
arch = "aarch64"
... keep going with the `arch` variable.
See https://sr.ht/~motiejus/bazel-zig-cc/#questions-amp-contributions
for how to send the patch. Thanks for your report!
Motiejus
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54])
by mail-b.sr.ht (Postfix) with ESMTPS id 9857111EF33
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Mon, 17 Jan 2022 15:11:32 +0000 (UTC)
Received: by mail-lf1-f54.google.com with SMTP id x7so58771527lfu.8
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Mon, 17 Jan 2022 07:11:32 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:subject:message-id:mime-version
:content-disposition;
bh=LwNHKhyXvDWWILJKIlSXcX0ihphVZMlQHLLR1EMYlXU=;
b=qEWnJSQXmLoa7O7rrgOAvcO9WFQ2BvtWmA+ZCjxhXSlZOq66HeIAJPBP43FcfahZHj
pbqsSQjVKTIChLryf2wGpOZWTULsaez6ZMzKsE08t3uLr8g/MkeeiQbPT5Wfged8BBjg
1B/WJHerfObEcrxVft3aNArknPktFeXZiDJeySh3y3v2DJsp7yVJndpVfIq3YN0LLXXr
wzSQMLABLurB4GnuTkk3E0BiInNFMCkAjLvwNfLEBLYBSgXcJ+1dpu9H16OQJGUsTb9G
JJ6qOqclLXbTu7Wi//nFlxJEFXE7ZqI9H98nki+o1RA3nsyZtzwHXoCGXqTalXMHfId6
Kdgg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:subject:message-id
:mime-version:content-disposition;
bh=LwNHKhyXvDWWILJKIlSXcX0ihphVZMlQHLLR1EMYlXU=;
b=2YSu1BSyV/wzreFDcWI0y0RlG627clg0N4Ow0DVUajWxO+8kP2Jgmqnl4R2Bc4n0nS
gMRpQ/9mdpUv07Tea7VjmKvdg9OlflrmCP/W1MLKW/Dw56ynt7GEFR8X8EIwsL/lX/RU
71DyAp3Hbs10zM7Qti4C36uy9czFVC2DFKAtAO62y/UsFvntnRtKXmGq4f66VNTjhsVZ
rAixSKwc3Chp+YM5qIBPtdFry4rYu+/f0JR+mMhmHnrRA2fzPOU3WwLVBGvnCllHW9Xq
yGdH8Ij7MuD26ZpIfypZCd34GHGPW/gzUgITt6Pt2Dxfd6+Dx8TxIPFSNscpKRFgaCZj
0Skw==
X-Gm-Message-State: AOAM5332i04xrhpV3v4y8o7ezH1et4Cse/k14KT/IknPaUoLFoApOX7c
tQwofHgBoNfuU9P0tbNgVSzxvjB4CwM=
X-Google-Smtp-Source: ABdhPJzlsEGEQrpYJ8pZKope/CpBPy7mLUnLz2qSCClcr1R1PxGlIMy/Z9NGRoAtS9/FVRoNJHLa6Q==
X-Received: by 2002:a05:6512:a94:: with SMTP id m20mr14846375lfu.546.1642432291016;
Mon, 17 Jan 2022 07:11:31 -0800 (PST)
Received: from localhost ([88.223.105.24])
by smtp.gmail.com with ESMTPSA id u14sm532440lfc.292.2022.01.17.07.11.30
for <~motiejus/bazel-zig-cc@lists.sr.ht>
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Mon, 17 Jan 2022 07:11:30 -0800 (PST)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Mon, 17 Jan 2022 17:11:29 +0200
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Subject: bazel-zig-cc v0.4.0
Message-ID: <20220117151129.kdvzdw3w2dnuaxrj@mtpad.i.jakstys.lt>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Hi all,
I just released bazel-zig-cc v0.4.0. It is the first release after zig
0.9.0 came out. I didn't cut a release with 0.9.0 due to[1]. Many thanks
Xavier for addressing that one!
This version has no known upstream issues, and, as usual, a few ones[2]
I will be accepting patches to, or will get to myself at some point.
Happy hacking,
Motiejus
[1]: https://github.com/ziglang/zig/issues/10386
[2]: https://git.sr.ht/~motiejus/bazel-zig-cc#known-issues-in-bazel-zig-cc
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177])
by mail-b.sr.ht (Postfix) with ESMTPS id ABA1911EEB5
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Wed, 26 Jan 2022 05:44:02 +0000 (UTC)
Received: by mail-lj1-f177.google.com with SMTP id c15so14139217ljf.11
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Tue, 25 Jan 2022 21:44:02 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:subject:message-id:mime-version
:content-disposition;
bh=ZPIE+T8JZChmC3IzGFrcmvVvO2ND70BBO5FF9GExK5Q=;
b=HTwHTDZX/I7CSkd0ZpQuKHqBc5aAjlYedJVaOjGL6wCgeX4F5Zwsq8HQtStMYNq1mG
OFHCaVkzvGAOyLNfArV0sXlrwHAUT1846q/jGURV1HJA7EGz4iMz0jMu/416FIiD55Td
SWlVLhn2gb2/FRBGE00k2uAYfFSaW2iQ/XkJW7cQ+0oIVvcGfoaxA1Vk45kneGri0Vkg
XZIa9J6D54SMxSIl2wsuWybMnWEgbL2jWUmvcZGpSrP1+kINzaYiPxXD8lyt5Doir4oy
ppc3QF+6AMLOIy4pPRKdsdw7xb8iC6pZBiFyolxV5ebccWcr7Vj5NhtC8853QXF/Q7n7
1FTw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:subject:message-id
:mime-version:content-disposition;
bh=ZPIE+T8JZChmC3IzGFrcmvVvO2ND70BBO5FF9GExK5Q=;
b=ebv8j2lQilm9IeIqajKQamk9SlFu0Erv0015fMchG4uPf+v3FIGDWbWwK52Mbprpjv
6Qcdj9y8uiD4qyG/HkZAjczQV7O+vwn+Q+nQB9jrSd/2D/1b02bOIXhVahFqCvZLYV8o
9PBrFVxpQ/UKjO+Jxmd8rxxpihhOxqdC6f8eT3MdjHRVt16oZUWxosvU/eWXBbDyvnLr
cML31Xm+HK5ZiPAi7raNpKYEpb0t/bAY+wm+R2mipl0CM9sW+I3yzXZGpVMsytqbaLOs
32znAYlz06L9ryeqo3tONEP6dxGoeRtAnADHhr1XK7b9ArsOIRxjTAXLpaPXpnjLt54J
r1bA==
X-Gm-Message-State: AOAM530GrI6qZZJctG4jJt/0OZ7XNlMN4GT4RfjHMZcRSB8ljHV31/Ns
WgSHFIZyjzgIUPwISqIAzBPSzJtpC+w=
X-Google-Smtp-Source: ABdhPJxus+2x3ziq6MGKHqA4hJMsMQAFXfVHMhG8j4pNQ2iT970HgmsFoP+8MjiP6ZeAHPsO0POZyA==
X-Received: by 2002:a2e:6e0e:: with SMTP id j14mr4657369ljc.510.1643175838877;
Tue, 25 Jan 2022 21:43:58 -0800 (PST)
Received: from localhost ([88.223.105.24])
by smtp.gmail.com with ESMTPSA id q12sm1419957ljh.16.2022.01.25.21.43.57
for <~motiejus/bazel-zig-cc@lists.sr.ht>
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Tue, 25 Jan 2022 21:43:58 -0800 (PST)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Wed, 26 Jan 2022 07:43:57 +0200
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Subject: bazel-zig-cc v0.4.1 and envoy PoC
Message-ID: <20220126054357.h5jxh7jtg75k3g57@mtpad.i.jakstys.lt>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Hi all,
I cut bazel-zig-cc v0.4.1, which upgrades zig to
0.10.0-dev.399+366c76744. Notably, it implements the following linker
args:
* --whole-archive, -whole-archive
* --no-whole-archive, -no-whole-archive
* -s, --strip-all
* -S, --strip-debug
... which were surfaced by Envoy trying out bazel-zig-cc[1].
I also renewed my gpg key (just updated the expiry date, keys are
unchanged), which you can find in today [2]. For some inexplicable
reason I keep signing my releases.
Regards,
Motiejus
[1]: https://github.com/envoyproxy/envoy/issues/19535
[2]: https://jakstys.lt/mtpad/gpg.txt
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44])
by mail-b.sr.ht (Postfix) with ESMTPS id 3C7CC11EFBD
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Thu, 27 Jan 2022 09:15:33 +0000 (UTC)
Received: by mail-pj1-f44.google.com with SMTP id b1-20020a17090a990100b001b14bd47532so2351913pjp.0
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Thu, 27 Jan 2022 01:15:33 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:subject:message-id:mime-version
:content-disposition;
bh=l2IL1hDG/wSYO+PblgmPSfkqj7PPv5mJfn293Xgw73s=;
b=GgAXrKlG1tG2EbkFA/s7+RvEyH0tbRU06xQHi4/grJr5t34fiCntHOtuOGEM9/Ry8V
FZio35kw0jk5pr4bujR5di/jGk4UBBg+z/pGti9Pj69dk2Ea24alcNokiuzkbfHJ0PYC
9TYcgC/A08g3CyWJJ0A7HwKagKXKjnC7k7XaWkywSn/FDoCwfhHZzsSnu0B3ZxNFEC+R
hjqnERKrAU/urSTBamqChs9Q4zdn1cWPl7qnHMW/7o6z048YVGJP48azpBwhPFxQqWui
TOri7Fxg3/6BrNsa0MMOr4tcgzlHVPtlbArKBj3f4ftd3tQVN0qga1ZLK+MxQAm3LSrX
76EA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:subject:message-id
:mime-version:content-disposition;
bh=l2IL1hDG/wSYO+PblgmPSfkqj7PPv5mJfn293Xgw73s=;
b=7XviGnEKKaxoby6FvKmwDoejO/LGWTy4Z4FR4GZbuAAXW6tihvwnDbUy2YfYjDgGzE
3WE5kBPnibuTJklRKvnwoEmqHvTfIWb45rmoxK7niJ6+VNbsxwAvai7Y/jyNTq96cKCo
d/Gfc8RQeqG8O/p4jT8pYSnk7UGfRwvBirSfxWkcgGn06hEZGZOrsAk6FY2yRQpRCdav
0lOs91QBS/k2hG5SBt4kERGN5xPhshWbCB8jSPT+xpQxV4yWR3l8Q4IOuGrMZRk5xi68
QAtjXozIKl6SikjDF0V5/QOyqfNhxTAIUbP/TrA7cnZM+n3qGzGWASewO+Pv8kY0sxov
emmQ==
X-Gm-Message-State: AOAM531u9gQGl0U6kPxkXMkmxs6zxWCAblpRS977LnnylyyVQwSByswN
6OncviD3c0m1pTAzONn7y/whSWkygZ8=
X-Google-Smtp-Source: ABdhPJwylL0/y/L7pD9UsX5ejQIsUCE84DECwz3l+joFVSHQGXR3t35Btz/+0h4nVB/tBBoPWDiNqw==
X-Received: by 2002:a17:902:c403:: with SMTP id k3mr1966059plk.117.1643274930940;
Thu, 27 Jan 2022 01:15:30 -0800 (PST)
Received: from localhost (88-119-96-125.static.zebra.lt. [88.119.96.125])
by smtp.gmail.com with ESMTPSA id ip4sm2056750pjb.8.2022.01.27.01.15.29
for <~motiejus/bazel-zig-cc@lists.sr.ht>
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 27 Jan 2022 01:15:30 -0800 (PST)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Thu, 27 Jan 2022 11:15:27 +0200
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Subject: bazel-zig-cc v0.4.2
Message-ID: <20220127091527.oe53s3gm75354rdm@mtpad.i.jakstys.lt>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Hi all,
I cut bazel-zig-cc v0.4.2, which upgrades zig to
0.10.0-dev.430+35423b005. Notable changes:
- fix linux kernel's aarch64 include paths, use stable kernel for
headers[1].
- implement --hash-style linker parameter[2].
I am working on aarch64 at my dayjob, which resulted in (1). The latter
was surfaced in envoy's ongoing investigation into zig-cc and
bazel-zig-cc[3].
Motiejus
[1]: https://github.com/ziglang/zig/pull/10699
[2]: https://github.com/ziglang/zig/commit/40c9ce2caf8f
[3]: https://github.com/envoyproxy/envoy/issues/19535
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41])
by mail-b.sr.ht (Postfix) with ESMTPS id 7F1CF11EEDD
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Wed, 2 Feb 2022 13:32:17 +0000 (UTC)
Received: by mail-lf1-f41.google.com with SMTP id u14so40638261lfo.11
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Wed, 02 Feb 2022 05:32:17 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:subject:message-id:mime-version
:content-disposition;
bh=CaNfsprl7AZ0nZjlw9C6IbI2Leuo8/M+n+R0iuzS+cY=;
b=L+7CoNGpEND6STivveZtxm5V2vE3pCeLaBKHvJvsFUh/x8n3BIVoiA/AG5o27MG0xF
4X1ikzp9eYLAFRK3ISIaZ5aYwbBwhU+noXuWqK/JRPmbLsj1rbPMefVWSfBRKud/aVhW
sKBrU0KwOstAnh9kajQEBR1oUhn9GN7rUok1WEl9zximfVVL+3dMbOP9Ry0oNauYRQQw
wJjL3/zlMlqaRSzhOMDMQNdXK0XXj5BdhIq6LYHG1lqTYc8Sm6ulBVY/Mc91nk2f7VMT
4REW+8p5rXDtATKuezmsM3ooxBxa6PR69aMn635w8M6YQQOyV0f/aNdW5Nc9xExoEOdM
nQNQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:subject:message-id
:mime-version:content-disposition;
bh=CaNfsprl7AZ0nZjlw9C6IbI2Leuo8/M+n+R0iuzS+cY=;
b=c3+2Uvi12fzwT/Rdf21yrUu9zQry0vHZp1+IUOk3uFtE3SrceACYFbKqLuORdpfAno
3Noa/4kRkCLchOI0B8+mzMwzk2uTpxBqT+X2DPcz0c0t34p/yd0EkVjDZUr/iKHeVzh9
UULn/HOYm1dYyJhauFiMBmIuzuVkUx3Wt29XMBufKuoJgKWA0271BbYqC42XCf5yCk5a
OeLvnTPdRh6yGurvPcB30bpmQtUX8PWBDCACiq4qBU7Lf8mbbTbHmONyjRWw2g6+C1Gr
yekWw8zjayekGtAEwyFn1Ve0WN4hQYXkR2yF7+HhcSu2UmTIKbSXhUyKjTuLxbgsdjeG
owUg==
X-Gm-Message-State: AOAM530ewLoLRvtGBos0lqYEAwwXrUfGvqfLBiIlO/6HSSC26FgXyiRn
XeVc1bRmFHku4DlppyKu9rZIQ6i+qFQ=
X-Google-Smtp-Source: ABdhPJwEoIgMEhpBLz+ai9v9eSwdLa6kW5PAcKQK+5jQByExX2Rh1+OBULJPudgaVVKKSEwwEeb7Yg==
X-Received: by 2002:a05:6512:ac6:: with SMTP id n6mr22945258lfu.322.1643808734872;
Wed, 02 Feb 2022 05:32:14 -0800 (PST)
Received: from localhost ([88.223.105.24])
by smtp.gmail.com with ESMTPSA id u12sm3672275lfm.308.2022.02.02.05.32.14
for <~motiejus/bazel-zig-cc@lists.sr.ht>
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Wed, 02 Feb 2022 05:32:14 -0800 (PST)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Wed, 2 Feb 2022 15:32:13 +0200
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Subject: bazel-zig-cc v0.4.3
Message-ID: <20220202133213.g6c66zwont7qyrr4@mtpad.i.jakstys.lt>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Hi all,
I released v0.4.3. It only zig, which fixes[1] `--hash-style` and
`--whole-archive`. The README was also updated following some users'
questions[2]. "The starlark" remains the same.
At some point I will not be releasing new versions of bazel-zig-cc when
*only* zig is updated; at that point, you will need to download zig
provide it to bazel-zig-cc. Something akin to [3].
Motiejus
[1]:
https://github.com/envoyproxy/envoy/issues/19535#issuecomment-1024533163
[2]:
https://github.com/envoyproxy/envoy/issues/19535#issuecomment-1026111822
[3]: https://github.com/grailbio/bazel-toolchain#quickstart
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182])
by mail-b.sr.ht (Postfix) with ESMTPS id 6C8BC11EFDA
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Fri, 4 Feb 2022 11:56:02 +0000 (UTC)
Received: by mail-lj1-f182.google.com with SMTP id c7so8094148ljr.13
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Fri, 04 Feb 2022 03:56:02 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:subject:message-id:mime-version
:content-disposition;
bh=FKPxTpAiSiY0k9tKJOGQ14KTAR6pM4E7CD61F5+ZIZg=;
b=Q71lKWPQHHD7J7ZIiQyw9CPA/wvS6GzZN3HjrOD58SK/g6CFpfHwBFeDGLyI7QlD2x
LaHTPfJ8QGMtubI9dhFzTxBLJGUPqk7JTKDWHWe8Hwu5UY2ngDc6GnoDmf2t+98vhwiT
iZQdCzUYq3k5Od7kSi7J3MEIuuIvUNa2nDvRKCgbeCGZGenFzJ06aH64Ht6GfX2PbAaK
xTPWCY8/G83aRCiCC/diLatM4RCUTDkI254mcJ55/xJJ/DvmM2cmrxvRRBldly/jZmeF
gh2ZVz84Hik8v29pmbHh7fV4XHXLpMyCARe249KGIFmdDb5WFF8rKtubb7X0Jl/Uv5ML
Bnng==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:subject:message-id
:mime-version:content-disposition;
bh=FKPxTpAiSiY0k9tKJOGQ14KTAR6pM4E7CD61F5+ZIZg=;
b=q3seF01i5nl0FcHfaPDeGtBzJUeuUhZdYawh3fvAOimJmUKLkjTZZZmiyHfkn9hbvr
UXcHcXizu0+QLPwb+z2gIOeO5zQdjOSV6+2SnNvrNWwFxpN2t5teCqsUJtTr2G9n5pXl
YdNRtCZUSQjOvOsGhH0Ncv4H8wHBnchGzT8HT+K39tsSrjsPwVVFNmzQdcLYGc9O48ae
3yLJ1FB41qiFX8M/PRc32aeIDxRYhTCoD4i5AoGJ6CkvtZtQtcbg7n+d9SRy9d0FyGXL
f4hdYavfhxiCLljcS0VmJskiJ58aFbPkRvKcJP9N2tafMSaS85x7MbSPVWFjn1N11hW6
elsw==
X-Gm-Message-State: AOAM533rCo1xV4yuik3hvvB17GySt46j8+KS4cEhKTHoJeQ3kgaV7vjH
9FzcGJK4wJetxV5cFR4BPKwpb9Azuzo=
X-Google-Smtp-Source: ABdhPJz+wWN6uIoFx23yDrPATpG+aJ1LdP/b1iN2zD70pcef7VbGScFaG0UPhS8LtIkUtd4JBKfoGw==
X-Received: by 2002:a2e:b8c7:: with SMTP id s7mr1606227ljp.118.1643975759407;
Fri, 04 Feb 2022 03:55:59 -0800 (PST)
Received: from localhost ([88.223.105.24])
by smtp.gmail.com with ESMTPSA id bu32sm280744lfb.287.2022.02.04.03.55.58
for <~motiejus/bazel-zig-cc@lists.sr.ht>
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 04 Feb 2022 03:55:58 -0800 (PST)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Fri, 4 Feb 2022 13:55:57 +0200
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Subject: bazel test under qemu-aarch64: help needed
Message-ID: <20220204115557.dhs7gvnyk3bapyja@mtpad.i.jakstys.lt>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Hi folks,
I spent a good day trying to figure this out, I need help enabling tests
for aarch64.
Goal: run `bazel test //test/...` for 2 architectures: amd64 and arm64.
Arm64 would be executed under qemu-aarch64.
This works on my laptop (amd64/buster):
git clone https://git.sr.ht/~motiejus/bazel-zig-cc -b qemu
cd bazel-zig-cc; direnv allow .
bazel test --run_under=qemu-aarch64 \
--platforms @zig_sdk//:linux_arm64_platform \
--extra_toolchains @zig_sdk//:linux_arm64_musl_toolchain \
//test/go:go_test
Fails[1] on builds.sr.ht, which is also buster/amd64.
2022/02/04 09:21:03 fork/exec /home/<...>/go_test: exec format error
However, when executed directly via qemu-aarch64 on the given CI
machine, it works:
build@build:~/bazel-zig-cc$ qemu-aarch64 /<...>/go_test
PASS
build@build:~/bazel-zig-cc$
strace, investigating the bazel's sandboxing (I suspected this may be
caused by linux-sandbox-pid1.cc) didn't reveal anything. Any pointers?
Thanks,
Motiejus
[1]: https://builds.sr.ht/~motiejus/job/687819
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54])
by mail-b.sr.ht (Postfix) with ESMTPS id DFEC611F2DA
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Sat, 5 Feb 2022 04:55:32 +0000 (UTC)
Received: by mail-lf1-f54.google.com with SMTP id u6so16394869lfm.10
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Fri, 04 Feb 2022 20:55:32 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:subject:message-id:references:mime-version
:content-disposition:content-transfer-encoding:in-reply-to;
bh=XKOR1hOp9WbzmRujEKM5M3zyyBvcZgTOpIPrU4XXc20=;
b=KwIUKAX2O9OUNMyVWbwGDD75T/hCnF8WJgURSnnJ7LcHZiHyPh3LUzdxrovVHj70GS
ZgMP25hwmgDJlexldlQ5goH7XRn/EwV+viynlbq/8W3X4Zi8r2FpH0Waa4ds/g0uLJri
Xhchxy8fX8h6JKX8faOOwrTmsYrQ20oOAqxfrFfa0Fsfdy5f9JRviCmRdqcb4gyvHw5P
3JvIvyaGmL95RlR4mL5iQfKXB5pewagGtOKSf4zuqUgcyyKfP7HIHA7bOPXweyJsFJ6F
KsfSuztCsYO0jA5PAGv5VZqS3L8nZUdDWgNRsyxSA85zaLH98zDrn1w7uveQ9Oycp7/D
QdYQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:subject:message-id
:references:mime-version:content-disposition
:content-transfer-encoding:in-reply-to;
bh=XKOR1hOp9WbzmRujEKM5M3zyyBvcZgTOpIPrU4XXc20=;
b=pDyTgKvM5oVBXYVcmDAHVYBF6u69uAleBhZXMtxTABp6jGMbdX0oFv5SD5Z+AQTyuq
Qoz2/iX0A1erkQ3JTejCG5zjYIOYqbh7MvgOtAM+sgzS9xk3ASfbTCYtf3lemN4ZjBN0
R9nt+huX7vqqIDmFhBVf6UaQ3nFHu7c5HiBSIhEGE7Ck6KTQQYAXCFM2QCo68Ez3AeHF
uFaHgYZBQSvY5Dpr1/8nHd9yzKPVdipni3gErD600QTHwRZ1KTW0evKmhBcmwuPoiOVz
cKUOZzOKZM1fLL2S84Q0kSNyoqRDv9kfAP6Xg8jdkacdnNVzYdi7R/v8nKH8pUjiXX7y
lXnQ==
X-Gm-Message-State: AOAM530784Z7OOYq/FydPztz1MiT4dtQ4Hr+v++1DfRT3rqwoYRlw/3V
RWN1qZX3Aunatwrf1e6RtRU6UnxfiRI=
X-Google-Smtp-Source: ABdhPJxJ0QD5Cq/QWw3sHoVTecWwIu9kamdfu4rahFH5eT2GWNJIdzr+y76ReriZ2P0sWLeLjCDvoQ==
X-Received: by 2002:a05:6512:4014:: with SMTP id br20mr1577156lfb.217.1644036931198;
Fri, 04 Feb 2022 20:55:31 -0800 (PST)
Received: from localhost ([88.223.105.24])
by smtp.gmail.com with ESMTPSA id z27sm577500lfg.31.2022.02.04.20.55.30
for <~motiejus/bazel-zig-cc@lists.sr.ht>
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 04 Feb 2022 20:55:30 -0800 (PST)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Sat, 5 Feb 2022 06:55:29 +0200
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Subject: Re: bazel test under qemu-aarch64: help needed
Message-ID: <20220205045529.c4quz7koyncgfqiz@mtpad.i.jakstys.lt>
References: <20220204115557.dhs7gvnyk3bapyja@mtpad.i.jakstys.lt>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20220204115557.dhs7gvnyk3bapyja@mtpad.i.jakstys.lt>
On Fri, Feb 04, 2022 at 01:55:57PM +0200, Motiejus Jakštys wrote:
> Hi folks,
>
> I spent a good day trying to figure this out, I need help enabling tests
> for aarch64.
Hi all,
Piotr Sikora replied out-of-band[1]. Two things needed to be changed:
1. Install binfmt-support. That registers qemu handlers to binfmt.
2. use qemu-aarch64-static instead of the shared version.
... and now we run all unit tests on both amd64 and arm64, and the test
runner[2] is less ugly.
Motiejus
[1]:
https://github.com/PiotrSikora/bazel-zig-cc/commit/10101bf7f11ff404e66f582bbb64a3a875f8e45f#commitcomment-66048081
[2]: https://git.sr.ht/~motiejus/bazel-zig-cc/tree/main/item/ci/test
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48])
by mail-b.sr.ht (Postfix) with ESMTPS id 4707611F2DA
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Sat, 5 Feb 2022 05:06:31 +0000 (UTC)
Received: by mail-lf1-f48.google.com with SMTP id x23so16612445lfc.0
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Fri, 04 Feb 2022 21:06:31 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:subject:message-id:mime-version
:content-disposition;
bh=YqUW7x3rsx9mzzxrNShByRFQQHaM25RXdnjFURhRiTc=;
b=aUMZbJhDNBCB6wVPI8VBaPiGorrlY2MGcHpyX5chxJEWcdl0gWmAFL5V55Vcor0E4i
VhdChdEOXTHAxFrvDOIABVrpnZp/XrToQa1dqphOLjelmVAbyu6XI0XNgy3uXJ94kHec
APDqE0WpflKzbmggrrU+85yjh/jmEW6XuLJ054dkkf8K6grBNlRi5KBQyfqfwAwuJLT6
FciVpP5r8QQ7hBCtdEUw36s/flZNMRAxvdoBnLUUNjAndU73JZwy5WyCZ6YepAIiFwpl
3m3oYcX1A7AOPI/OntxO9KYqR39DGEkfbURn8nmAYccrvY3Iw1X8yC3aTU1t7F7HP8U8
Hlnw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:subject:message-id
:mime-version:content-disposition;
bh=YqUW7x3rsx9mzzxrNShByRFQQHaM25RXdnjFURhRiTc=;
b=eobDiXZbHrULR7IVzjffjOMSIRbBOjGpoBNcmRjZOxXm1LKQ+75fa/gO3+fKG6WaZs
jIk77c+LTLCETXGTNwQ5mb/9n7dpCOv5M0qydN6cw2yUe49i+ooJ6CHg1ZFVMeHD+QA2
6+TnYvY2N1qsicSfaoPvHW249jbWHjvro5KKuMh+QBgwibXmo0LvICQCjA0U8dJ7adBZ
7QHOJiBPxc2kmN0jk8SUL5oi3+2lawi58Enas2XwGwk+gpwtUUsp6F6BZ/5JuuvuDs3G
YSSyCmt5a3CJmvZ2dCm6e8gAJF0fk1/Us4fZ1GWjp54QhQfi45xXgv+87tuqAK0jFn0X
EGAA==
X-Gm-Message-State: AOAM530HYBE3U1cQ8IVpBmUBM25gs3Cl/xw++l9knhpUQUCYWIUIpy3Z
pUMy1q0uu3uLFLCkwRdyd7Y6BsnaXg8=
X-Google-Smtp-Source: ABdhPJzfulESjC6wntPstFC25e8xaYDPKQen6k5HrvMwq6aQsB65WuJBlVzadqsNnwNGQNv6hu9BvA==
X-Received: by 2002:ac2:43ae:: with SMTP id t14mr1493698lfl.599.1644037590060;
Fri, 04 Feb 2022 21:06:30 -0800 (PST)
Received: from localhost ([88.223.105.24])
by smtp.gmail.com with ESMTPSA id be20sm524965ljb.105.2022.02.04.21.06.29
for <~motiejus/bazel-zig-cc@lists.sr.ht>
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 04 Feb 2022 21:06:29 -0800 (PST)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Sat, 5 Feb 2022 07:06:28 +0200
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Subject: bazel-zig-cc v0.4.4 and upcoming zig 0.9.1
Message-ID: <20220205050628.3m6ewpkxnvqngcqw@mtpad.i.jakstys.lt>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Hi all,
bazel-zig-cc v0.4.4 is out. Major changes:
- register "bazel platforms" @zig_sdk//:<os>_<arch>_platform. Example
`--platform @zig_sdk//:linux_amd64_platform`. Note that this is in the
wrong place[1] and is likely to be changed.
- Tests are now executed[2] with `bazel test //test/...` on amd64
(natively) and arm64 (via qemu-aarch64-static). You are enocouraged to
add your own tests if you would like me to catch issues for you before
bumping zig-cc.
- I did NOT upgrade zig, it's the same as in v0.4.3.
Zig's maintainer Andrew asked me to test the 0.9.x release branch before
he does a zig 0.9.1 release. So if you care for zig not breaking
something before the release, but that doesn't really fit into zig's
test suite, a test in test/ may be a good place.
Motiejus
[1]: https://git.sr.ht/~motiejus/bazel-zig-cc/tree/v0.4.4/item/README.md#toolchain-and-platform-target-locations
[2]: https://git.sr.ht/~motiejus/bazel-zig-cc/tree/v0.4.4/item/ci/test
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=none
Received: from git.sr.ht (unknown [173.195.146.142])
by mail-b.sr.ht (Postfix) with ESMTPSA id 2D5CC11F033;
Thu, 10 Feb 2022 23:32:58 +0000 (UTC)
From: ~kmicklas <kmicklas@git.sr.ht>
Date: Thu, 10 Feb 2022 23:32:57 +0000
Subject: [PATCH bazel-zig-cc 0/3] Support ARM64 Mac
MIME-Version: 1.0
Message-ID: <164453597791.17553.15415322179801626658-0@git.sr.ht>
X-Mailer: git.sr.ht
Reply-to: ~kmicklas <accounts@kmicklas.com>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Cc: kmicklas@uber.com
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
With this I'm able to build a simple `cc_library` target on an M1.
Ken Micklas (3):
Fix darwin arm64 case in .envrc for loading bazel
Interpret arm64 output from uname as aarch64 on mac OS
Fix and adjust darwin libc header paths depending on CPU
.envrc | 2 +-
toolchain/defs.bzl | 21 +++++++++++++--------
2 files changed, 14 insertions(+), 9 deletions(-)
--
2.32.0
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=none
Received: from git.sr.ht (unknown [173.195.146.142])
by mail-b.sr.ht (Postfix) with ESMTPSA id 5AB6311F0C1;
Thu, 10 Feb 2022 23:32:58 +0000 (UTC)
From: ~kmicklas <kmicklas@git.sr.ht>
Date: Thu, 10 Feb 2022 18:20:56 -0500
Subject:
[PATCH bazel-zig-cc 1/3] Fix darwin arm64 case in .envrc for loading bazel
Message-ID: <164453597791.17553.15415322179801626658-1@git.sr.ht>
X-Mailer: git.sr.ht
Reply-to: ~kmicklas <accounts@kmicklas.com>
In-Reply-To: <164453597791.17553.15415322179801626658-0@git.sr.ht>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Cc: kmicklas@uber.com
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
From: Ken Micklas <kmicklas@uber.com>
---
.envrc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.envrc b/.envrc
index 802d197..2b1d835 100644
--- a/.envrc
+++ b/.envrc
@@ -17,7 +17,7 @@ case "$(uname | tr A-Z a-z)-$(uname -m)" in
bzl=3D$(direnv fetchurl "${_u}linux-arm64" sha256-wd5oYN1PjV4uwnAJe9=
RtaiEblxoLizhVl4S9BR6pUKE=3D);;
darwin-x86_64)
bzl=3D$(direnv fetchurl "${_u}darwin-amd64" sha256-5IW7+EUy0CpgsOsjx=
wJhC1QI3zoZkIek8rXgmVu/LVo=3D);;
- darwin-aarch64)
+ darwin-arm64)
bzl=3D$(direnv fetchurl "${_u}darwin-arm64" sha256-wi1IYBRm2dOwQ8zXQ=
FHy9CMPm59FCfCXAXyXMDqojRM=3D);;
*)
>&2 echo "unsupported architecture tuple $(uname | tr A-Z a-z)-$(una=
me -m)"
--=20
2.32.0
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=none
Received: from git.sr.ht (unknown [173.195.146.142])
by mail-b.sr.ht (Postfix) with ESMTPSA id 7571711F0C9;
Thu, 10 Feb 2022 23:32:58 +0000 (UTC)
From: ~kmicklas <kmicklas@git.sr.ht>
Date: Thu, 10 Feb 2022 18:22:37 -0500
Subject: [PATCH bazel-zig-cc 2/3] Interpret arm64 output from uname as aarch64
on mac OS
Message-ID: <164453597791.17553.15415322179801626658-2@git.sr.ht>
X-Mailer: git.sr.ht
Reply-to: ~kmicklas <accounts@kmicklas.com>
In-Reply-To: <164453597791.17553.15415322179801626658-0@git.sr.ht>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Cc: kmicklas@uber.com
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
From: Ken Micklas <kmicklas@uber.com>
---
toolchain/defs.bzl | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/toolchain/defs.bzl b/toolchain/defs.bzl
index 693e2da..2b572d3 100644
--- a/toolchain/defs.bzl
+++ b/toolchain/defs.bzl
@@ -222,12 +222,15 @@ def _zig_repository_impl(repository_ctx):
res =3D repository_ctx.execute(["uname", "-m"])
if res.return_code !=3D 0:
fail("failed to run uname -m")
- uname =3D res.stdout.strip()
+ arch =3D res.stdout.strip()
=20
+ os =3D "linux"
if repository_ctx.os.name.lower().startswith("mac os"):
- host_platform =3D "macos-{}".format(uname)
- else:
- host_platform =3D "linux-{}".format(uname)
+ os =3D "macos"
+ if arch =3D=3D "arm64":
+ # uname -m reports arm64 on an M1 Mac.
+ arch =3D "aarch64"
+ host_platform =3D "{}-{}".format(os, arch)
=20
zig_include_root =3D repository_ctx.attr.host_platform_include_root[host=
_platform]
zig_sha256 =3D repository_ctx.attr.host_platform_sha256[host_platform]
--=20
2.32.0
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=none
Received: from git.sr.ht (unknown [173.195.146.142])
by mail-b.sr.ht (Postfix) with ESMTPSA id 93FE611F189;
Thu, 10 Feb 2022 23:32:58 +0000 (UTC)
From: ~kmicklas <kmicklas@git.sr.ht>
Date: Thu, 10 Feb 2022 18:24:21 -0500
Subject: [PATCH bazel-zig-cc 3/3] Fix and adjust darwin libc header paths
depending on CPU
Message-ID: <164453597791.17553.15415322179801626658-3@git.sr.ht>
X-Mailer: git.sr.ht
Reply-to: ~kmicklas <accounts@kmicklas.com>
In-Reply-To: <164453597791.17553.15415322179801626658-0@git.sr.ht>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Cc: kmicklas@uber.com
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
From: Ken Micklas <kmicklas@uber.com>
---
toolchain/defs.bzl | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/toolchain/defs.bzl b/toolchain/defs.bzl
index 2b572d3..8ed93c7 100644
--- a/toolchain/defs.bzl
+++ b/toolchain/defs.bzl
@@ -54,15 +54,17 @@ _GLIBCS = [
]
def _target_darwin(gocpu, zigcpu):
+ min_os = "10"
+ if zigcpu == "aarch64":
+ min_os = "11"
return struct(
gotarget = "darwin_{}".format(gocpu),
zigtarget = "{}-macos-gnu".format(zigcpu),
includes = [
"libunwind/include",
- # FIXME: add macos.10, macos.11 and macos.12 targets,
- # and adjust the includes
- "libc/include/{}-macos.10-gnu".format(zigcpu),
- "libc/include/{}-macos-any".format(zigcpu),
+ # TODO: Define a toolchain for each minimum OS version
+ "libc/include/{}-macos.{}-gnu".format(zigcpu, min_os),
+ "libc/include/any-macos.{}-any".format(min_os),
"libc/include/any-macos-any",
],
linkopts = [],
--
2.32.0
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
DKIM-Signature: a=rsa-sha256; bh=iFZPni2s8+PUNzy+zRMfM/84OlUZYNc44+op1j+85vU=;
c=simple/simple; d=sr.ht; h=Date:From:In-Reply-To:Subject:To:Cc;
q=dns/txt; s=srht; t=1644536758; v=1;
b=nwchpQbJskdTrW86U+nIYMXtY5qtrAAQ1PmhQMEU2DRVR6LyoUWQ0m/XoKSOakS2QYNAtKFG
eH7jqHuViZjuINpv4NscE+l+u238PRAf5qTMiusugMOetvvlzw6n25oPckO9bs5/2kidDkRiuVF
ZbDyp/L4+98ACknuwLr9+kOd1QZjU34L6S81GkOKE23jKHNnLT+wAmyDq2KS91EQUk4rGPuCTuK
0NnT9gJrEx3ytD5iyb7eyjtcupQBHTqbEDUpPpW7pc0QsvgTOobiv1rK7K6dwcSGBT1Kx6pml3V
eMidvLC1gkLkL0Tx+2371PVoanmuBKJ+Jy/uN43X1NFlA==
Received: from localhost (unknown [173.195.146.249])
by mail-b.sr.ht (Postfix) with UTF8SMTPSA id 6539E11F033;
Thu, 10 Feb 2022 23:45:58 +0000 (UTC)
MIME-Version: 1.0
Date: Thu, 10 Feb 2022 23:45:58 +0000
From: "builds.sr.ht" <builds@sr.ht>
Message-ID: <CHSRML2SAOY5.1NQDDWU9LNOYA@cirno>
In-Reply-To: <164453597791.17553.15415322179801626658-3@git.sr.ht>
Subject: [bazel-zig-cc/patches/.build.yml] build success
To: "~kmicklas" <accounts@kmicklas.com>
Cc: ~motiejus/bazel-zig-cc@lists.sr.ht
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
bazel-zig-cc/patches/.build.yml: SUCCESS in 12m57s
[Support ARM64 Mac][0] from [~kmicklas][1]
[0]: https://lists.sr.ht/~motiejus/bazel-zig-cc/patches/29276
[1]: mailto:accounts@kmicklas.com
=E2=9C=93 #693103 SUCCESS bazel-zig-cc/patches/.build.yml https://builds.sr=
.ht/~motiejus/job/693103
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171])
by mail-b.sr.ht (Postfix) with ESMTPS id 1A0A511F006
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Fri, 11 Feb 2022 04:34:02 +0000 (UTC)
Received: by mail-lj1-f171.google.com with SMTP id z20so10896707ljo.6
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Thu, 10 Feb 2022 20:34:02 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:cc:subject:message-id:references:mime-version
:content-disposition:in-reply-to;
bh=uNKHiAfOE1XXriWNUtxZO2RyASkqd7Sf7RgJXzrnxZw=;
b=bG/yg7+8EDr7XPFG5C4Pi9CaXTtY36Ndidvr6aaLEQxdc9Vk7OXjhkIsS2e3AhkmqO
QMAT8Yluz5r1VpQ+/5UWk0DfRWbEI9Q7KMPS1NkkgFmbzNljLdfs8HuV1JsbjAqbDixn
beA4+J1vxNy5nj0eeP70+TaPC5G+W7Rrzr7dPDa/ZY4ey3Itx3kHDZA7b5BTTVYeSNrB
bNcvS+x5mpTYFaacqYSuS7pZfiF1JhC9LjOeE5mQjpVztRWPAeJJKh0tdx0/2q3zf/Kb
iecc2tcaMmUerc78LmogJ4QPBlUEapaew8FQe1k12N7UNQ0blQP3SLVRf1eelSQUyF/v
jUXg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:cc:subject:message-id
:references:mime-version:content-disposition:in-reply-to;
bh=uNKHiAfOE1XXriWNUtxZO2RyASkqd7Sf7RgJXzrnxZw=;
b=3kpFIibEGFkECokJqdQej4nn8+cg4yeLhxFMgU4/IxcQaxTcpkeBGU7zh3jl6KQJTa
WOn9lYlWNzZXGJtjAajDqELCqMFiTAJLPU16OE43QKNVzhhr5aLpIUoTp6b1AFtRYTTZ
VmXLnMBsP+0AE1GaksMzm6f6wjlsUWz++hY0NcX5qKdPUogbXFQu5KzWUJDejB4sROeo
l7pPb8MvLRg7sTjhRfzMffL96sIqtjXAK6o9wHAyExWH5RjQhOTXnJk8BJ2iOezNVsmw
mnybyeSrIoHnl8PEovLDriZFgWJpgpmqTd0Vj82UH/50LZK+PbKEVjaGBMf7/1B8Lw6Y
w+wA==
X-Gm-Message-State: AOAM533jR9y8KlycSsOOu2CgJ8L5yL5a869ALofm8kSQ6tSwqAa+YvAO
VTpASzqriQCJEvn/7j0F+1I=
X-Google-Smtp-Source: ABdhPJybI1W3A3/4xVRPIq7fWV8haq5HpYKCBiFGcgS9/uhSDBKHjInW6LLK6a75vfURGLbrb1KjUw==
X-Received: by 2002:a2e:b047:: with SMTP id d7mr7118977ljl.359.1644554038457;
Thu, 10 Feb 2022 20:33:58 -0800 (PST)
Received: from localhost ([88.223.105.24])
by smtp.gmail.com with ESMTPSA id l1sm2988565lfh.151.2022.02.10.20.33.57
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 10 Feb 2022 20:33:57 -0800 (PST)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Fri, 11 Feb 2022 06:33:56 +0200
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: ~kmicklas <accounts@kmicklas.com>
Cc: ~motiejus/bazel-zig-cc@lists.sr.ht, kmicklas@uber.com,
joesmoe10@gmail.com
Subject: Re: [PATCH bazel-zig-cc 0/3] Support ARM64 Mac
Message-ID: <20220211043356.xgchjv34q246kxa3@mtpad.i.jakstys.lt>
References: <164453597791.17553.15415322179801626658-0@git.sr.ht>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <164453597791.17553.15415322179801626658-0@git.sr.ht>
On Thu, Feb 10, 2022 at 11:32:57PM +0000, ~kmicklas wrote:
> With this I'm able to build a simple `cc_library` target on an M1.
>
> Ken Micklas (3):
> Fix darwin arm64 case in .envrc for loading bazel
> Interpret arm64 output from uname as aarch64 on mac OS
> Fix and adjust darwin libc header paths depending on CPU
Thank you. Applied all 3 patches and tagged v0.4.5.
cc Joe, who had problems with M1 before. These are now fixed.
Motiejus
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=none
Received: from git.sr.ht (unknown [173.195.146.142])
by mail-b.sr.ht (Postfix) with ESMTPSA id 5024911EF37;
Thu, 17 Mar 2022 20:04:30 +0000 (UTC)
From: ~kmicklas <kmicklas@git.sr.ht>
Date: Thu, 17 Mar 2022 20:04:29 +0000
Subject: [PATCH bazel-zig-cc 0/3] Download improvments
MIME-Version: 1.0
Message-ID: <164754746999.13783.11303815672892555536-0@git.sr.ht>
X-Mailer: git.sr.ht
Reply-to: ~kmicklas <git@kmicklas.com>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Cc: kmicklas@uber.com
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
This adds support for netrc and multiple download mirrors.
Ken Micklas (3):
Pull default SHA256s into constant and don't update
Support multiple URL formats
Support netrc for Zig SDK download
toolchain/defs.bzl | 66 +++++++++++++++++++++++++++++++++++-----------
1 file changed, 50 insertions(+), 16 deletions(-)
--
2.34.1
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=none
Received: from git.sr.ht (unknown [173.195.146.142])
by mail-b.sr.ht (Postfix) with ESMTPSA id 7FAB111EF43;
Thu, 17 Mar 2022 20:04:30 +0000 (UTC)
From: ~kmicklas <kmicklas@git.sr.ht>
Date: Thu, 17 Mar 2022 15:11:17 -0400
Subject:
[PATCH bazel-zig-cc 1/3] Pull default SHA256s into constant and don't update
Message-ID: <164754746999.13783.11303815672892555536-1@git.sr.ht>
X-Mailer: git.sr.ht
Reply-to: ~kmicklas <git@kmicklas.com>
In-Reply-To: <164754746999.13783.11303815672892555536-0@git.sr.ht>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Cc: kmicklas@uber.com
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
From: Ken Micklas <kmicklas@uber.com>
Starlark's default argument semantics are pretty weird and likely not
what you would expect:
https://github.com/bazelbuild/starlark/blob/master/spec.md#functions
Additionally, this is just easier to read.
---
toolchain/defs.bzl | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/toolchain/defs.bzl b/toolchain/defs.bzl
index 8ed93c7..f942c5b 100644
--- a/toolchain/defs.bzl
+++ b/toolchain/defs.bzl
@@ -158,29 +158,28 @@ _URL_FORMAT_JAKSTYS =3D "https://dl.jakstys.lt/zig/zig-=
{host_platform}-{version}.t
=20
_VERSION =3D "0.10.0-dev.513+029844210"
=20
+_HOST_PLATFORM_SHA256 =3D {
+ "linux-aarch64": "fc0b929948d57d1b15aaac33db0cd136a1f79830926c9285fd3f5b=
6445f1ef95",
+ "linux-x86_64": "c6f323b02b0bcf7b18143983bf2525640dd541f39af661e963823c9=
a61a09b28",
+ "macos-aarch64": "0ccd8dad1264474ca824d45c3021b7e549b67792fa1a66cb9d4d70=
40775319bb",
+ "macos-x86_64": "3c939bebe8648c277ee66d1c600e68576e382d0309dc29eb4c32aba=
96b83f6f0",
+}
+
def register_toolchains(
register =3D [],
version =3D _VERSION,
url_format =3D _URL_FORMAT_JAKSTYS,
- host_platform_sha256 =3D {}):
+ host_platform_sha256 =3D _HOST_PLATFORM_SHA256):
"""
Download zig toolchain and register some.
@param register registers the given toolchains to the system using
native.register_toolchains(). See README for possible choices.
"""
- sha256s =3D {
- "linux-aarch64": "fc0b929948d57d1b15aaac33db0cd136a1f79830926c9285fd=
3f5b6445f1ef95",
- "linux-x86_64": "c6f323b02b0bcf7b18143983bf2525640dd541f39af661e9638=
23c9a61a09b28",
- "macos-aarch64": "0ccd8dad1264474ca824d45c3021b7e549b67792fa1a66cb9d=
4d7040775319bb",
- "macos-x86_64": "3c939bebe8648c277ee66d1c600e68576e382d0309dc29eb4c3=
2aba96b83f6f0",
- }
- sha256s.update(host_platform_sha256)
-
zig_repository(
name =3D "zig_sdk",
version =3D version,
url_format =3D url_format,
- host_platform_sha256 =3D sha256s,
+ host_platform_sha256 =3D host_platform_sha256,
host_platform_include_root =3D {
"linux-aarch64": "lib/",
"linux-x86_64": "lib/",
--=20
2.34.1
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=none
Received: from git.sr.ht (unknown [173.195.146.142])
by mail-b.sr.ht (Postfix) with ESMTPSA id AFC4C11EF44;
Thu, 17 Mar 2022 20:04:30 +0000 (UTC)
From: ~kmicklas <kmicklas@git.sr.ht>
Date: Thu, 17 Mar 2022 15:39:41 -0400
Subject: [PATCH bazel-zig-cc 2/3] Support multiple URL formats
Message-ID: <164754746999.13783.11303815672892555536-2@git.sr.ht>
X-Mailer: git.sr.ht
Reply-to: ~kmicklas <git@kmicklas.com>
In-Reply-To: <164754746999.13783.11303815672892555536-0@git.sr.ht>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Cc: kmicklas@uber.com
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
From: Ken Micklas <kmicklas@uber.com>
---
toolchain/defs.bzl | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/toolchain/defs.bzl b/toolchain/defs.bzl
index f942c5b..f883cc2 100644
--- a/toolchain/defs.bzl
+++ b/toolchain/defs.bzl
@@ -168,7 +168,8 @@ _HOST_PLATFORM_SHA256 =3D {
def register_toolchains(
register =3D [],
version =3D _VERSION,
- url_format =3D _URL_FORMAT_JAKSTYS,
+ url_format =3D [_URL_FORMAT_JAKSTYS],
+ url_formats =3D [],
host_platform_sha256 =3D _HOST_PLATFORM_SHA256):
"""
Download zig toolchain and register some.
@@ -178,7 +179,8 @@ def register_toolchains(
zig_repository(
name =3D "zig_sdk",
version =3D version,
- url_format =3D url_format,
+ url_format =3D url_format if type(url_format) =3D=3D type("") else N=
one,
+ url_formats =3D url_format if type(url_format) =3D=3D type([""]) els=
e None,
host_platform_sha256 =3D host_platform_sha256,
host_platform_include_root =3D {
"linux-aarch64": "lib/",
@@ -239,10 +241,17 @@ def _zig_repository_impl(repository_ctx):
"version": repository_ctx.attr.version,
"host_platform": host_platform,
}
- zig_url =3D repository_ctx.attr.url_format.format(**format_vars)
+
+ url_format =3D repository_ctx.attr.url_format
+ url_formats =3D repository_ctx.attr.url_formats
+
+ if len(url_formats) =3D=3D 0:
+ url_formats =3D [url_format]
+ elif url_format !=3D "":
+ fail("Only one of url_format and url_formats should be specified.")
=20
repository_ctx.download_and_extract(
- url =3D zig_url,
+ url =3D [uf.format(**format_vars) for uf in url_formats],
stripPrefix =3D "zig-{host_platform}-{version}/".format(**format_var=
s),
sha256 =3D zig_sha256,
)
@@ -279,7 +288,8 @@ zig_repository =3D repository_rule(
attrs =3D {
"version": attr.string(),
"host_platform_sha256": attr.string_dict(),
- "url_format": attr.string(),
+ "url_format": attr.string(doc =3D "Deprecated in favor of url_format=
s"),
+ "url_formats": attr.string_list(),
"host_platform_include_root": attr.string_dict(),
},
implementation =3D _zig_repository_impl,
--=20
2.34.1
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=none
Received: from git.sr.ht (unknown [173.195.146.142])
by mail-b.sr.ht (Postfix) with ESMTPSA id D52B611EF52;
Thu, 17 Mar 2022 20:04:30 +0000 (UTC)
From: ~kmicklas <kmicklas@git.sr.ht>
Date: Thu, 17 Mar 2022 15:47:45 -0400
Subject: [PATCH bazel-zig-cc 3/3] Support netrc for Zig SDK download
Message-ID: <164754746999.13783.11303815672892555536-3@git.sr.ht>
X-Mailer: git.sr.ht
Reply-to: ~kmicklas <git@kmicklas.com>
In-Reply-To: <164754746999.13783.11303815672892555536-0@git.sr.ht>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Cc: kmicklas@uber.com
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
From: Ken Micklas <kmicklas@uber.com>
---
toolchain/defs.bzl | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/toolchain/defs.bzl b/toolchain/defs.bzl
index f883cc2..0ea7a26 100644
--- a/toolchain/defs.bzl
+++ b/toolchain/defs.bzl
@@ -1,5 +1,5 @@
load("@bazel_skylib//lib:shell.bzl", "shell")
-load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+load("@bazel_tools//tools/build_defs/repo:utils.bzl", "read_netrc", "use_net=
rc")
load(":zig_toolchain.bzl", "zig_cc_toolchain_config")
=20
DEFAULT_TOOL_PATHS =3D {
@@ -250,8 +250,11 @@ def _zig_repository_impl(repository_ctx):
elif url_format !=3D "":
fail("Only one of url_format and url_formats should be specified.")
=20
+ urls =3D [uf.format(**format_vars) for uf in url_formats]
+
repository_ctx.download_and_extract(
- url =3D [uf.format(**format_vars) for uf in url_formats],
+ auth =3D use_netrc(read_user_netrc(repository_ctx), urls, {}),
+ url =3D urls,
stripPrefix =3D "zig-{host_platform}-{version}/".format(**format_var=
s),
sha256 =3D zig_sha256,
)
@@ -407,3 +410,25 @@ def zig_build_macro(absolute_path, zig_include_root):
name =3D "{os}_{gocpu}_platform".format(os =3D os, gocpu=
=3D gocpu),
constraint_values =3D constraint_values,
)
+
+# Copied from https://github.com/bazelbuild/bazel/blob/master/tools/build_de=
fs/repo/utils.bzl
+# TODO: Upgrade to Bazel 5.1 and import this instead.
+def read_user_netrc(ctx):
+ """Read user's default netrc file.
+ Args:
+ ctx: The repository context of the repository rule calling this utilit=
y function.
+ Returns:
+ dict mapping a machine names to a dict with the information provided a=
bout them.
+ """
+ if ctx.os.name.startswith("windows"):
+ home_dir =3D ctx.os.environ.get("USERPROFILE", "")
+ else:
+ home_dir =3D ctx.os.environ.get("HOME", "")
+
+ if not home_dir:
+ return {}
+
+ netrcfile =3D "{}/.netrc".format(home_dir)
+ if not ctx.path(netrcfile).exists:
+ return {}
+ return read_netrc(ctx, netrcfile)
--=20
2.34.1
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
DKIM-Signature: a=rsa-sha256; bh=7E5ugq03gQepqZijHDKqWwmyoSoljjtR17dVHMYjfto=;
c=simple/simple; d=sr.ht; h=Date:In-Reply-To:Subject:To:Cc:From;
q=dns/txt; s=srht; t=1647548274; v=1;
b=aTuLBd3oZ//M2LwIw2Rup9HB16zQiEx5QkEq/L8E/T+y7EX72a7E5EVzqniFdJ+YN0l6Lb+y
3l5fvv4E43+2OwzTCAvnIHZU0FLLjYNzCG8FuyAssCABK3+Tj+jjplVZm/StyQjbIPiEuj6/XFa
jBx2L1zac0NHkjCHyQ6tcGY8pjFksQGdHoZ9DcLuUEVlXsf7xL+DUK31RzMlZFFcLPaR/wyYaf8
GUpjAWdoIp+54H0vUQgt+cjtTxzv7ILPkF1E7xUuvtpdE7pzpOLygodgIKZB2ImLMa3w/CZ11rf
L0mNJgGnomwUBTrALMJZnjlwSlB3v0bYP3n2tNVTOA9hQ==
Received: from localhost (unknown [173.195.146.249])
by mail-b.sr.ht (Postfix) with UTF8SMTPSA id F25FC11EF37;
Thu, 17 Mar 2022 20:17:53 +0000 (UTC)
MIME-Version: 1.0
Date: Thu, 17 Mar 2022 20:17:53 +0000
Message-ID: <CIMF4C956NY6.XAHMHMOADXNQ@cirno>
In-Reply-To: <164754746999.13783.11303815672892555536-3@git.sr.ht>
Subject: [bazel-zig-cc/patches/.build.yml] build success
To: "~kmicklas" <git@kmicklas.com>
Cc: ~motiejus/bazel-zig-cc@lists.sr.ht
From: "builds.sr.ht" <builds@sr.ht>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
bazel-zig-cc/patches/.build.yml: SUCCESS in 13m21s
[Download improvments][0] from [~kmicklas][1]
[0]: https://lists.sr.ht/~motiejus/bazel-zig-cc/patches/30313
[1]: mailto:git@kmicklas.com
=E2=9C=93 #717171 SUCCESS bazel-zig-cc/patches/.build.yml https://builds.sr=
.ht/~motiejus/job/717171
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171])
by mail-b.sr.ht (Postfix) with ESMTPS id 8FFDB11EFC0
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Fri, 18 Mar 2022 05:58:51 +0000 (UTC)
Received: by mail-lj1-f171.google.com with SMTP id 25so10006112ljv.10
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Thu, 17 Mar 2022 22:58:51 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:subject:message-id:mime-version
:content-disposition;
bh=O5wygcx8YHlm9775MqZTv4VJEnvHYlC1UwlOjkrGTrU=;
b=f92Rz2hfsT15yHex1cxQWB0PaPyKA48jRdlarTnZj2BiC/jJ9ZHRBQzbZw9bTgHaU9
X/8+7wTlBzGgsrot4pN+2q1TAxL0lcYR3EpBUihhIPWNRYRx2odjeBm3khgRKs4tGfy5
mZvIuoncaj5su8mw6G9rP4MF0l0BSFoF4YX9zrkMYblOxO8Pst8VpyqN83qv/wTkCYER
EKD/qD3bTuD/V7qyZ37D5NudbabbwggRdazfuXcFMu7UKMY6I+JOWumd7ptA6GXiPPrh
E1Tkk1cQN9CY4UAF+Ie4I3ghZ1qCMq0R6BbsO01g0tKOAOuarPmQSyN7TJAOXq8wDRaE
E6zg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:subject:message-id
:mime-version:content-disposition;
bh=O5wygcx8YHlm9775MqZTv4VJEnvHYlC1UwlOjkrGTrU=;
b=x+4EEFsiiz57BGZprGzyJZLYG5Ci2gvxI1xHGgyfL6PAA3t+1lS1MAK6jLbwgHf6IG
ZLZ9BvaD7zR8QtFWGjoKKlVtSagMvjiGHT9k67hNMDcy3ZEX76UFBxFQTXbv0DkIYrYu
r+YXtKAQhmxgCsX2Jxia0xPLHQtZJR2w6E/devmhpb8v4m1QEcVqjvkzSTbmQEY11S0b
pxJAx9/7ZJPjUd9R7BGr50050Yzmxln8hk3ERFb6dBbvP49lqW2yZxrpioKr6ciGYTP7
0Bd33Y7VEMRgEin0ImL3kGDyD2sTjEFL9lkLcnGXkCxm5VIPpQIvFfHYW0jHDf5Nq5zt
FNmg==
X-Gm-Message-State: AOAM5310aa6U0D3DwRUXBG0km88Duds7a04XE9uMa5/NHpkVlM7i4M7Y
hNtj0uOOIetpr+7wBBHVgOYvEf4a08Kg7A==
X-Google-Smtp-Source: ABdhPJyQwYb1aPDuUAsW4HWDz5avo2+R7rK/HjA9tOlhOyQodRvS76ToI2lMUcBnpSgb1Jy4zkwl/A==
X-Received: by 2002:a05:651c:512:b0:249:71cf:37ee with SMTP id o18-20020a05651c051200b0024971cf37eemr339884ljp.484.1647583128947;
Thu, 17 Mar 2022 22:58:48 -0700 (PDT)
Received: from localhost ([87.54.21.186])
by smtp.gmail.com with ESMTPSA id j14-20020a056512108e00b004481ee0cee1sm690552lfg.67.2022.03.17.22.58.48
for <~motiejus/bazel-zig-cc@lists.sr.ht>
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 17 Mar 2022 22:58:48 -0700 (PDT)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Fri, 18 Mar 2022 06:58:47 +0100
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Subject: bazel-zig-cc v0.5.0
Message-ID: <20220318055847.p3qo75w55piucvix@mtpad.i.jakstys.lt>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Hi all,
thanks to Ken Micklas contributions, bazel-zig-cc can now do the
following:
- support netrc authentication. You can use internal mirrors for zig
bundle now (assuming they support netrc, of course).
- provide multiple download urls for the zig toolchain via
`url_formats`. This option is now documented, among with `version` and
`sha256`.
- while at it, upgraded zig to 0.10.0-dev.1393+291f5055f. I will be
cleaning up pre-0.10.0 from dl.jakstys.lt, consider yourself warned.
Since `sha256`, `urls` and `version` are part of the "official" API, I
will not be upgrading zig in bazel-zig-cc (or, rather, will upgrade much
more rarely); please do so in your application.
Reminder: dl.jakstys.lt is a small machine in my home closet. No UPS, no
monitoring whatsoever. So, if you are depending on this for work, you
may want to use your mirror.
Happy compiling,
Motiejus
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=none
Received: from git.sr.ht (unknown [173.195.146.142])
by mail-b.sr.ht (Postfix) with ESMTPSA id B878611EF57;
Fri, 25 Mar 2022 15:53:45 +0000 (UTC)
From: ~kmicklas <kmicklas@git.sr.ht>
Date: Fri, 25 Mar 2022 15:53:45 +0000
Subject:
[PATCH bazel-zig-cc 0/4] Upgrade to Bazel 5.1.0 and associated cleanups
MIME-Version: 1.0
Message-ID: <164822362548.25319.8453123527885867890-0@git.sr.ht>
X-Mailer: git.sr.ht
Reply-to: ~kmicklas <git@kmicklas.com>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Cc: kmicklas@uber.com
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Also pins the Go SDK version.
Ken Micklas (4):
Upgrade to Bazel 5.1.0
Remove repo fetch-time uname dependency, use new os.arch instead
Use upstream read_user_netrc from Bazel 5.1
Pin Go SDK to 1.18 for reproducibility
.bazelversion | 2 +-
WORKSPACE | 2 +-
toolchain/defs.bzl | 41 ++++++++---------------------------------
3 files changed, 10 insertions(+), 35 deletions(-)
--
2.34.1
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=none
Received: from git.sr.ht (unknown [173.195.146.142])
by mail-b.sr.ht (Postfix) with ESMTPSA id D86DC11F01F;
Fri, 25 Mar 2022 15:53:45 +0000 (UTC)
From: ~kmicklas <kmicklas@git.sr.ht>
Date: Fri, 25 Mar 2022 11:45:39 -0400
Subject: [PATCH bazel-zig-cc 1/4] Upgrade to Bazel 5.1.0
Message-ID: <164822362548.25319.8453123527885867890-1@git.sr.ht>
X-Mailer: git.sr.ht
Reply-to: ~kmicklas <git@kmicklas.com>
In-Reply-To: <164822362548.25319.8453123527885867890-0@git.sr.ht>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Cc: kmicklas@uber.com
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
From: Ken Micklas <kmicklas@uber.com>
---
.bazelversion | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.bazelversion b/.bazelversion
index af8c8ec..831446c 100644
--- a/.bazelversion
+++ b/.bazelversion
@@ -1 +1 @@
-4.2.2
+5.1.0
--
2.34.1
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=none
Received: from git.sr.ht (unknown [173.195.146.142])
by mail-b.sr.ht (Postfix) with ESMTPSA id F2C8E11F0F2;
Fri, 25 Mar 2022 15:53:45 +0000 (UTC)
From: ~kmicklas <kmicklas@git.sr.ht>
Date: Fri, 25 Mar 2022 11:46:11 -0400
Subject: [PATCH bazel-zig-cc 2/4] Remove repo fetch-time uname dependency, use
new os.arch instead
Message-ID: <164822362548.25319.8453123527885867890-2@git.sr.ht>
X-Mailer: git.sr.ht
Reply-to: ~kmicklas <git@kmicklas.com>
In-Reply-To: <164822362548.25319.8453123527885867890-0@git.sr.ht>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Cc: kmicklas@uber.com
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
From: Ken Micklas <kmicklas@uber.com>
---
toolchain/defs.bzl | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/toolchain/defs.bzl b/toolchain/defs.bzl
index 810db50..840976d 100644
--- a/toolchain/defs.bzl
+++ b/toolchain/defs.bzl
@@ -221,17 +221,14 @@ _ZIG_TOOLS =3D [
]
=20
def _zig_repository_impl(repository_ctx):
- res =3D repository_ctx.execute(["uname", "-m"])
- if res.return_code !=3D 0:
- fail("failed to run uname -m")
- arch =3D res.stdout.strip()
+ arch =3D repository_ctx.os.arch
+ if arch =3D=3D "amd64":
+ arch =3D "x86_64"
=20
- os =3D "linux"
- if repository_ctx.os.name.lower().startswith("mac os"):
+ os =3D repository_ctx.os.name.lower()
+ if os.startswith("mac os"):
os =3D "macos"
- if arch =3D=3D "arm64":
- # uname -m reports arm64 on an M1 Mac.
- arch =3D "aarch64"
+
host_platform =3D "{}-{}".format(os, arch)
=20
zig_include_root =3D repository_ctx.attr.host_platform_include_root[host=
_platform]
--=20
2.34.1
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=none
Received: from git.sr.ht (unknown [173.195.146.142])
by mail-b.sr.ht (Postfix) with ESMTPSA id 3AA1D11F178;
Fri, 25 Mar 2022 15:53:46 +0000 (UTC)
From: ~kmicklas <kmicklas@git.sr.ht>
Date: Fri, 25 Mar 2022 11:46:59 -0400
Subject: [PATCH bazel-zig-cc 3/4] Use upstream read_user_netrc from Bazel 5.1
Message-ID: <164822362548.25319.8453123527885867890-3@git.sr.ht>
X-Mailer: git.sr.ht
Reply-to: ~kmicklas <git@kmicklas.com>
In-Reply-To: <164822362548.25319.8453123527885867890-0@git.sr.ht>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Cc: kmicklas@uber.com
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
From: Ken Micklas <kmicklas@uber.com>
---
toolchain/defs.bzl | 26 ++------------------------
1 file changed, 2 insertions(+), 24 deletions(-)
diff --git a/toolchain/defs.bzl b/toolchain/defs.bzl
index 840976d..112a64a 100644
--- a/toolchain/defs.bzl
+++ b/toolchain/defs.bzl
@@ -1,6 +1,6 @@
load("@bazel_skylib//lib:shell.bzl", "shell")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
-load("@bazel_tools//tools/build_defs/repo:utils.bzl", "read_netrc", "use_net=
rc")
+load("@bazel_tools//tools/build_defs/repo:utils.bzl", "read_user_netrc", "us=
e_netrc")
load(":zig_toolchain.bzl", "zig_cc_toolchain_config")
=20
DEFAULT_TOOL_PATHS =3D {
@@ -240,7 +240,7 @@ def _zig_repository_impl(repository_ctx):
=20
urls =3D [uf.format(**format_vars) for uf in repository_ctx.attr.url_for=
mats]
repository_ctx.download_and_extract(
- auth =3D use_netrc(_read_user_netrc(repository_ctx), urls, {}),
+ auth =3D use_netrc(read_user_netrc(repository_ctx), urls, {}),
url =3D urls,
stripPrefix =3D "zig-{host_platform}-{version}/".format(**format_var=
s),
sha256 =3D zig_sha256,
@@ -396,25 +396,3 @@ def zig_build_macro(absolute_path, zig_include_root):
name =3D "{os}_{gocpu}_platform".format(os =3D os, gocpu=
=3D gocpu),
constraint_values =3D constraint_values,
)
-
-# Copied from https://github.com/bazelbuild/bazel/blob/master/tools/build_de=
fs/repo/utils.bzl
-# TODO: Upgrade to Bazel 5.1 and import this instead.
-def _read_user_netrc(ctx):
- """Read user's default netrc file.
- Args:
- ctx: The repository context of the repository rule calling this utilit=
y function.
- Returns:
- dict mapping a machine names to a dict with the information provided a=
bout them.
- """
- if ctx.os.name.startswith("windows"):
- home_dir =3D ctx.os.environ.get("USERPROFILE", "")
- else:
- home_dir =3D ctx.os.environ.get("HOME", "")
-
- if not home_dir:
- return {}
-
- netrcfile =3D "{}/.netrc".format(home_dir)
- if not ctx.path(netrcfile).exists:
- return {}
- return read_netrc(ctx, netrcfile)
--=20
2.34.1
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=none
Received: from git.sr.ht (unknown [173.195.146.142])
by mail-b.sr.ht (Postfix) with ESMTPSA id 5A3F711EF57;
Fri, 25 Mar 2022 15:53:46 +0000 (UTC)
From: ~kmicklas <kmicklas@git.sr.ht>
Date: Fri, 25 Mar 2022 11:47:10 -0400
Subject: [PATCH bazel-zig-cc 4/4] Pin Go SDK to 1.18 for reproducibility
Message-ID: <164822362548.25319.8453123527885867890-4@git.sr.ht>
X-Mailer: git.sr.ht
Reply-to: ~kmicklas <git@kmicklas.com>
In-Reply-To: <164822362548.25319.8453123527885867890-0@git.sr.ht>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Cc: kmicklas@uber.com
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
From: Ken Micklas <kmicklas@uber.com>
---
WORKSPACE | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/WORKSPACE b/WORKSPACE
index eeb098a..0aff5db 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -28,7 +28,7 @@ load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
go_rules_dependencies()
# use latest stable.
-go_download_sdk(name = "go_sdk")
+go_download_sdk(name = "go_sdk", version = "1.18")
go_register_toolchains()
--
2.34.1
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
DKIM-Signature: a=rsa-sha256; bh=vl6q2l7OOKEBhNt4qtJAxHIft46gdMwjqZrsBx08HLM=;
c=simple/simple; d=sr.ht; h=Date:In-Reply-To:Subject:To:Cc:From;
q=dns/txt; s=srht; t=1648224469; v=1;
b=grlGdG4ZDS5JH4IcFhaf7h4A5MUCfTSq78jO+bUR4LXCdjgOxQD4LUiHPJVGHkqAWEItA8rp
kagxXYt7EYuF2U3R2Ub0ygW/2G3JiwFDAlpUdA0E5d0Zm3KCMaiI8OpLwZO0C0TdJ4SdgL28K83
IuxKzxJwp/hl31zQROAhFlPI0Lln10Bo9qC1tcCqDB5qjSwBPeFl3yTD8lvlwScp0VzNvoVVKKt
qFn0sfWwWkE/12x4SzFcm+HzJFvMaVIiPfxJFhvyj1z7ATuNMo18n4jFOCb0LRECw02rPIrbgvs
sxbGBnopieamHloWulztJlETdQrYe/J8vsc+eIYwic5Gg==
Received: from localhost (unknown [173.195.146.244])
by mail-b.sr.ht (Postfix) with UTF8SMTPSA id 89B2D11F01F;
Fri, 25 Mar 2022 16:07:49 +0000 (UTC)
MIME-Version: 1.0
Date: Fri, 25 Mar 2022 16:07:49 +0000
Message-ID: <CIT2T87A4BL6.2OSWJY7N2ORZ8@cirno2>
In-Reply-To: <164822362548.25319.8453123527885867890-4@git.sr.ht>
Subject: [bazel-zig-cc/patches/.build.yml] build failed
To: "~kmicklas" <git@kmicklas.com>
Cc: ~motiejus/bazel-zig-cc@lists.sr.ht
From: "builds.sr.ht" <builds@sr.ht>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
bazel-zig-cc/patches/.build.yml: FAILED in 14m1s
[Upgrade to Bazel 5.1.0 and associated cleanups][0] from [~kmicklas][1]
[0]: https://lists.sr.ht/~motiejus/bazel-zig-cc/patches/30549
[1]: mailto:git@kmicklas.com
=E2=9C=97 #722785 FAILED bazel-zig-cc/patches/.build.yml https://builds.sr.=
ht/~motiejus/job/722785
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42])
by mail-b.sr.ht (Postfix) with ESMTPS id 2AE3F11EEFB
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Sat, 26 Mar 2022 14:06:40 +0000 (UTC)
Received: by mail-lf1-f42.google.com with SMTP id bu29so17829100lfb.0
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Sat, 26 Mar 2022 07:06:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:cc:subject:message-id:references:mime-version
:content-disposition:in-reply-to;
bh=Pjp+gqfwJjtlGbhG+5IobsfAGPuvy8DjKMfMfW3ADko=;
b=RI7sHW8r7FyGW0vbk3qyqAq3MuUjawc9/2p29i3aZxM87nfsYuD62WXN5evfRFez2t
NfhZhLLpXh7WEHvD5DJYsMJQ5/w9q+JPs+M/Px9OJkRzh9LNQWIyKHax8oNw3k+yqOEv
A2KF2vD8d64ryhYW0eyeCKPNCrHNiz+xs3cxGr139Uds3+yVhFohqkuXtzSaciXbyv+d
Iv1qc5/ag2fsCHjUmaPakLmGqrH0qkxo5fCD8YNcV1K0ihH6u37dZL4vxPTgx4IZUnY1
tXHuTXZOmlFafkK7rKSQSubju4TSvh0gIkpL2k07/qEkZs826Ic2LfZ6CQ+Wp1FFPK4D
3wGA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:cc:subject:message-id
:references:mime-version:content-disposition:in-reply-to;
bh=Pjp+gqfwJjtlGbhG+5IobsfAGPuvy8DjKMfMfW3ADko=;
b=C4Yr3Sd0roSvg87qIpO7coq1CuXnajM/v7T1MqnSSjxl2M4lYT2GiSTEXTUreffZ7D
Wrnr9o+wXrwDfm6FIg6DTuOHXJBz47j9aF5kp8DlGxSq692B62mhW4Cfs9sMslk38KxF
xIpThBrG+JoSkdrGw0uds9uutUP+/yJja/JTs9DEY/HfalnTu9IylQxAOTdOa8u8ON6y
VpyIEe1fXB14IsUwpyWfVNm6IzYf/ioDtW/DLs8AiDf/Z8qcyZO+UDaslRXn9Hx/8zHL
u3i/gaqj77fkMfkjuISHsPz/bkjYZNCoaOKY5G3LnO2poyvmSs04hffjtdPEFKQQV4nZ
UA3w==
X-Gm-Message-State: AOAM533hURPTlwQiQpKPHi6X0Pec8XKTXELjIFbPijs7YX/qsA2lhh96
mudeKBHrIAjCtXojtDPGne4=
X-Google-Smtp-Source: ABdhPJz8vo3yFz/ewrYm/4U/ieOtYJRdVogRkE0lVcRSKpjbVUEhyKlhBOQiTFQsXTSs8ANMmkPCxw==
X-Received: by 2002:a05:6512:224e:b0:44a:7bae:527f with SMTP id i14-20020a056512224e00b0044a7bae527fmr3850225lfu.322.1648303597462;
Sat, 26 Mar 2022 07:06:37 -0700 (PDT)
Received: from localhost ([88.223.105.24])
by smtp.gmail.com with ESMTPSA id q17-20020a2e8751000000b00244beaacef1sm1043982ljj.18.2022.03.26.07.06.36
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sat, 26 Mar 2022 07:06:36 -0700 (PDT)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Sat, 26 Mar 2022 16:06:35 +0200
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: ~kmicklas <git@kmicklas.com>
Cc: ~motiejus/bazel-zig-cc@lists.sr.ht, kmicklas@uber.com
Subject: Re: [PATCH bazel-zig-cc 4/4] Pin Go SDK to 1.18 for reproducibility
Message-ID: <20220326140635.yhzoo74n2gudaihk@mtpad.i.jakstys.lt>
References: <164822362548.25319.8453123527885867890-0@git.sr.ht>
<164822362548.25319.8453123527885867890-4@git.sr.ht>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <164822362548.25319.8453123527885867890-4@git.sr.ht>
On Fri, Mar 25, 2022 at 11:47:10AM -0400, ~kmicklas wrote:
> From: Ken Micklas <kmicklas@uber.com>
>
> ---
> WORKSPACE | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/WORKSPACE b/WORKSPACE
> index eeb098a..0aff5db 100644
> --- a/WORKSPACE
> +++ b/WORKSPACE
> @@ -28,7 +28,7 @@ load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
> go_rules_dependencies()
>
> # use latest stable.
> -go_download_sdk(name = "go_sdk")
> +go_download_sdk(name = "go_sdk", version = "1.18")
I was on the edge about this myself, since that would require us to
upgrade it with every go version, even patch ones. But I guess you're
right, leaving it like this for reproducibility.
Motiejus
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174])
by mail-b.sr.ht (Postfix) with ESMTPS id 942C011EEFB
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Sat, 26 Mar 2022 14:07:22 +0000 (UTC)
Received: by mail-lj1-f174.google.com with SMTP id g24so13600550lja.7
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Sat, 26 Mar 2022 07:07:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:cc:subject:message-id:references:mime-version
:content-disposition:in-reply-to;
bh=skzF2rzi5tynBle2oTMXjUWcWv4l0MA2+RTOPpkNpPM=;
b=GZ5rcUtXhyF0l2l1SEFkrIH4P9N+zQTGl+HTbUxhaDXriIWpkKIBg+yyl2L4pHnfe9
tEGxxjFItRJr2362cUOhjeepUZQccgruWISJdojLDpP/MKVnJF9Dbcz37lvgwzlZDhGT
v3H8UVUadD1VcSBm5Wil0svCKqtmgZ49WJ6JAlY07LJqAN5O/JMZKXLG6aBvr4bP0OqI
+lQRPdyCrpFPU8hSAhzVFW3TpSWqv/vpQhUeiIckZaaaig+iONeOHggcWUsouNhVVPlE
eXGXLilT79UYbJUlMjMoppfy8NIHlVfnf4QLP462YF1aEjWp79hKUZhPjOc9zCAXhuPl
2uug==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:cc:subject:message-id
:references:mime-version:content-disposition:in-reply-to;
bh=skzF2rzi5tynBle2oTMXjUWcWv4l0MA2+RTOPpkNpPM=;
b=cQGHnNmkyoRITbX37Kh4Xk+F1Hrwgas32m+irYiGC0GnHc9ETWxeTBIK6I0SctgYYL
CqvJmahfPtgchqLFb2XS+MVK+M5p/55PSL1n7NIyaILIe4yF6Bfc086uGtFvdgy5LeWx
s1zJyJoakElOu+tInarcVCS0tnXa83DKoyqir64TuK1iz0Yp/Hh/f5pB1a85DD31zeS4
MXHOwY8RVNAWcRCNnQpujtC7/VEVh1xy87FSeDeCMs+PJn5KKlOn27bc1iy6/HuwZ7vr
NogutdjHUOx5MoQt4Jtu32/zv1XEOhmcyS0I5CCEM9FhN3sggvj7DNUwFM0kdj6mP1c8
ZOeQ==
X-Gm-Message-State: AOAM530ltYKvJutOC++bK2hnktHvvRWxnaa5Ql87dRHhMFOLflj9+qkz
1aN/+FXRivw/AYqj/BRkEXXjHqv+br0=
X-Google-Smtp-Source: ABdhPJymq04BSTzfJpVHdZ+laiZbzglDSEIbJnE2fdBBOkR9NviuD4mebDzB5lu2c+1zY8w4/rSv9g==
X-Received: by 2002:a2e:a58c:0:b0:249:b1ce:ba97 with SMTP id m12-20020a2ea58c000000b00249b1ceba97mr9423600ljp.78.1648303638993;
Sat, 26 Mar 2022 07:07:18 -0700 (PDT)
Received: from localhost ([88.223.105.24])
by smtp.gmail.com with ESMTPSA id d6-20020a193846000000b0044a589efadbsm1075763lfj.2.2022.03.26.07.07.18
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sat, 26 Mar 2022 07:07:18 -0700 (PDT)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Sat, 26 Mar 2022 16:07:17 +0200
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: ~kmicklas <git@kmicklas.com>
Cc: ~motiejus/bazel-zig-cc@lists.sr.ht, kmicklas@uber.com
Subject: Re: [PATCH bazel-zig-cc 0/4] Upgrade to Bazel 5.1.0 and associated
cleanups
Message-ID: <20220326140717.oep2mxniosjzzetg@mtpad.i.jakstys.lt>
References: <164822362548.25319.8453123527885867890-0@git.sr.ht>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <164822362548.25319.8453123527885867890-0@git.sr.ht>
On Fri, Mar 25, 2022 at 03:53:45PM +0000, ~kmicklas wrote:
> Also pins the Go SDK version.
>
> Ken Micklas (4):
> Upgrade to Bazel 5.1.0
> Remove repo fetch-time uname dependency, use new os.arch instead
> Use upstream read_user_netrc from Bazel 5.1
> Pin Go SDK to 1.18 for reproducibility
Thanks, applied all of them (+buildifier). Do you want me to cut v0.5.1?
Motiejus
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=none
Received: from git.sr.ht (unknown [173.195.146.142])
by mail-b.sr.ht (Postfix) with ESMTPSA id 150F811EF0D
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Thu, 7 Apr 2022 09:37:53 +0000 (UTC)
From: ~laurynasl <laurynasl@git.sr.ht>
Date: Thu, 07 Apr 2022 09:37:52 +0000
Subject: [PATCH bazel-zig-cc 0/4] Move platforms and toolchains
MIME-Version: 1.0
Message-ID: <164932427279.26543.1789507091630612744-0@git.sr.ht>
X-Mailer: git.sr.ht
Reply-to: ~laurynasl <laurynasl@uber.com>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Move platform and toochains definitions into their own "namespaces".
laurynasl (4):
move platforms under @zig_cc//platform:
Move declare_platforms() to platform/
Move toolchainss under @zig_sdk//platform:
Move toolchain definitions to toolchains/
.bazelrc | 8 +-
README.md | 27 +--
ci/test | 4 +-
toolchain/BUILD.sdk.bazel | 5 +-
toolchain/defs.bzl | 244 +++-------------------------
toolchain/platform/BUILD | 3 +
toolchain/platform/defs.bzl | 17 ++
toolchain/private/BUILD | 0
toolchain/private/defs.bzl | 124 ++++++++++++++
toolchain/toolchain/BUILD | 0
toolchain/toolchain/BUILD.sdk.bazel | 10 ++
toolchain/toolchain/defs.bzl | 87 ++++++++++
12 files changed, 277 insertions(+), 252 deletions(-)
create mode 100644 toolchain/platform/BUILD
create mode 100644 toolchain/platform/defs.bzl
create mode 100644 toolchain/private/BUILD
create mode 100644 toolchain/private/defs.bzl
create mode 100644 toolchain/toolchain/BUILD
create mode 100644 toolchain/toolchain/BUILD.sdk.bazel
create mode 100644 toolchain/toolchain/defs.bzl
--
2.34.1
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=none
Received: from git.sr.ht (unknown [173.195.146.142])
by mail-b.sr.ht (Postfix) with ESMTPSA id 30F8411EF31
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Thu, 7 Apr 2022 09:37:53 +0000 (UTC)
From: ~laurynasl <laurynasl@git.sr.ht>
Date: Wed, 06 Apr 2022 19:16:53 +0000
Subject: [PATCH bazel-zig-cc 1/4] move platforms under @zig_cc//platform:
Message-ID: <164932427279.26543.1789507091630612744-1@git.sr.ht>
X-Mailer: git.sr.ht
Reply-to: ~laurynasl <laurynasl@uber.com>
In-Reply-To: <164932427279.26543.1789507091630612744-0@git.sr.ht>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
From: laurynasl <laurynasl@uber.com>
---
README.md | 9 +++------
ci/test | 2 +-
toolchain/defs.bzl | 10 ++++++++--
toolchain/platform/BUILD | 3 +++
4 files changed, 15 insertions(+), 9 deletions(-)
create mode 100644 toolchain/platform/BUILD
diff --git a/README.md b/README.md
index 1c8e011..d855c78 100644
--- a/README.md
+++ b/README.md
@@ -114,9 +114,6 @@ The path to Bazel toolchains is `@zig_sdk//:<toolchain>_t=
oolchain`. It should
be moved to `@zig_sdk//toolchain:<toolchain>` or similar; so the user-facing
targets are in their own namespace.
=20
-Likewise, platforms are `@zig_sdk//:<platform>_platform`, and should be moved
-to `@zig_sdk//:platform:<platform>`.
-
## OSX: sysroot
=20
For non-trivial programs (and for all darwin/arm64 cgo programs) MacOS SDK m=
ay
@@ -164,7 +161,7 @@ may apply to aarch64, but the author didn't find a need t=
o test it (yet).
## build & run linux cgo + glibc
=20
```
-$ bazel build --platforms @zig_sdk//:linux_amd64_platform //test/go:go
+$ bazel build --platforms @zig_sdk//platform:linux_amd64 //test/go:go
$ file bazel-out/k8-opt-ST-d17813c235ce/bin/test/go/go_/go
bazel-out/k8-opt-ST-d17813c235ce/bin/test/go/go_/go: ELF 64-bit LSB executab=
le, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux=
-x86-64.so.2, for GNU/Linux 2.0.0, Go BuildID=3Dredacted, with debug_info, no=
t stripped
$ bazel-out/k8-opt-ST-d17813c235ce/bin/test/go/go_/go
@@ -176,7 +173,7 @@ hello, world
```
$ bazel test \
--config=3Dqemu-aarch64 \
- --platforms @zig_sdk//:linux_arm64_platform \
+ --platforms @zig_sdk//platform:linux_arm64 \
--extra_toolchains @zig_sdk//:linux_arm64_musl_toolchain //test/...
...
INFO: Build completed successfully, 10 total actions
@@ -186,7 +183,7 @@ INFO: Build completed successfully, 10 total actions
## macos cgo
=20
```
-$ bazel build --platforms @zig_sdk//:darwin_amd64_platform //test/go:go
+$ bazel build --platforms @zig_sdk//platform:darwin_amd64 //test/go:go
...
$ file bazel-out/k8-opt-ST-d17813c235ce/bin/test/go/go_/go
bazel-out/k8-opt-ST-d17813c235ce/bin/test/go/go_/go: Mach-O 64-bit x86_64 ex=
ecutable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|PIE|HAS_TLV_DESCRIPTORS>
diff --git a/ci/test b/ci/test
index e9a8e9a..5b9a4d7 100755
--- a/ci/test
+++ b/ci/test
@@ -18,7 +18,7 @@ while read -r action platform toolchain config; do
fi
=20
args+=3D(\
- --platforms "@zig_sdk//:${platform}_platform" \
+ --platforms "@zig_sdk//platform:${platform}" \
--extra_toolchains "@zig_sdk//:${toolchain}_toolchain" \
//test/... \
)
diff --git a/toolchain/defs.bzl b/toolchain/defs.bzl
index 112a64a..eb005fe 100644
--- a/toolchain/defs.bzl
+++ b/toolchain/defs.bzl
@@ -264,6 +264,11 @@ def _zig_repository_impl(repository_ctx):
content =3D _fcntl_h,
)
=20
+ repository_ctx.symlink(
+ Label("//toolchain/platform:BUILD"),
+ "platform/BUILD",
+ )
+
repository_ctx.template(
"BUILD.bazel",
Label("//toolchain:BUILD.sdk.bazel"),
@@ -380,6 +385,7 @@ def zig_build_macro(absolute_path, zig_include_root):
toolchain_type =3D "@bazel_tools//tools/cpp:toolchain_type",
)
=20
+def declare_platforms():
# create @zig_sdk//{os}_{arch}_platform entries with zig and go conventi=
ons
for zigcpu, gocpu in (("x86_64", "amd64"), ("aarch64", "arm64")):
for bzlos, oss in {"linux": ["linux"], "macos": ["macos", "darwin"]}=
.items():
@@ -389,10 +395,10 @@ def zig_build_macro(absolute_path, zig_include_root):
"@platforms//cpu:{}".format(zigcpu),
]
native.platform(
- name =3D "{os}_{zigcpu}_platform".format(os =3D os, zigc=
pu =3D zigcpu),
+ name =3D "{os}_{zigcpu}".format(os =3D os, zigcpu =3D zi=
gcpu),
constraint_values =3D constraint_values,
)
native.platform(
- name =3D "{os}_{gocpu}_platform".format(os =3D os, gocpu=
=3D gocpu),
+ name =3D "{os}_{gocpu}".format(os =3D os, gocpu =3D gocp=
u),
constraint_values =3D constraint_values,
)
diff --git a/toolchain/platform/BUILD b/toolchain/platform/BUILD
new file mode 100644
index 0000000..b02436b
--- /dev/null
+++ b/toolchain/platform/BUILD
@@ -0,0 +1,3 @@
+load("@bazel-zig-cc//toolchain:defs.bzl", "declare_platforms")
+
+declare_platforms()
--=20
2.34.1
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=none
Received: from git.sr.ht (unknown [173.195.146.142])
by mail-b.sr.ht (Postfix) with ESMTPSA id 4D67411EF0D
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Thu, 7 Apr 2022 09:37:53 +0000 (UTC)
From: ~laurynasl <laurynasl@git.sr.ht>
Date: Wed, 06 Apr 2022 19:19:44 +0000
Subject: [PATCH bazel-zig-cc 2/4] Move declare_platforms() to platform/
Message-ID: <164932427279.26543.1789507091630612744-2@git.sr.ht>
X-Mailer: git.sr.ht
Reply-to: ~laurynasl <laurynasl@uber.com>
In-Reply-To: <164932427279.26543.1789507091630612744-0@git.sr.ht>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
From: laurynasl <laurynasl@uber.com>
---
toolchain/defs.bzl | 17 -----------------
toolchain/platform/BUILD | 2 +-
toolchain/platform/defs.bzl | 17 +++++++++++++++++
3 files changed, 18 insertions(+), 18 deletions(-)
create mode 100644 toolchain/platform/defs.bzl
diff --git a/toolchain/defs.bzl b/toolchain/defs.bzl
index eb005fe..3f6b4bd 100644
--- a/toolchain/defs.bzl
+++ b/toolchain/defs.bzl
@@ -385,20 +385,3 @@ def zig_build_macro(absolute_path, zig_include_root):
toolchain_type =3D "@bazel_tools//tools/cpp:toolchain_type",
)
=20
-def declare_platforms():
- # create @zig_sdk//{os}_{arch}_platform entries with zig and go conventi=
ons
- for zigcpu, gocpu in (("x86_64", "amd64"), ("aarch64", "arm64")):
- for bzlos, oss in {"linux": ["linux"], "macos": ["macos", "darwin"]}=
.items():
- for os in oss:
- constraint_values =3D [
- "@platforms//os:{}".format(bzlos),
- "@platforms//cpu:{}".format(zigcpu),
- ]
- native.platform(
- name =3D "{os}_{zigcpu}".format(os =3D os, zigcpu =3D zi=
gcpu),
- constraint_values =3D constraint_values,
- )
- native.platform(
- name =3D "{os}_{gocpu}".format(os =3D os, gocpu =3D gocp=
u),
- constraint_values =3D constraint_values,
- )
diff --git a/toolchain/platform/BUILD b/toolchain/platform/BUILD
index b02436b..ce0ffc7 100644
--- a/toolchain/platform/BUILD
+++ b/toolchain/platform/BUILD
@@ -1,3 +1,3 @@
-load("@bazel-zig-cc//toolchain:defs.bzl", "declare_platforms")
+load("@bazel-zig-cc//toolchain/platform:defs.bzl", "declare_platforms")
=20
declare_platforms()
diff --git a/toolchain/platform/defs.bzl b/toolchain/platform/defs.bzl
new file mode 100644
index 0000000..e094029
--- /dev/null
+++ b/toolchain/platform/defs.bzl
@@ -0,0 +1,17 @@
+def declare_platforms():
+ # create @zig_sdk//{os}_{arch}_platform entries with zig and go conventi=
ons
+ for zigcpu, gocpu in (("x86_64", "amd64"), ("aarch64", "arm64")):
+ for bzlos, oss in {"linux": ["linux"], "macos": ["macos", "darwin"]}=
.items():
+ for os in oss:
+ constraint_values =3D [
+ "@platforms//os:{}".format(bzlos),
+ "@platforms//cpu:{}".format(zigcpu),
+ ]
+ native.platform(
+ name =3D "{os}_{zigcpu}".format(os =3D os, zigcpu =3D zi=
gcpu),
+ constraint_values =3D constraint_values,
+ )
+ native.platform(
+ name =3D "{os}_{gocpu}".format(os =3D os, gocpu =3D gocp=
u),
+ constraint_values =3D constraint_values,
+ )
--=20
2.34.1
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=none
Received: from git.sr.ht (unknown [173.195.146.142])
by mail-b.sr.ht (Postfix) with ESMTPSA id 6C1EB11EF31
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Thu, 7 Apr 2022 09:37:53 +0000 (UTC)
From: ~laurynasl <laurynasl@git.sr.ht>
Date: Wed, 06 Apr 2022 19:46:15 +0000
Subject: [PATCH bazel-zig-cc 3/4] Move toolchainss under @zig_sdk//platform:
Message-ID: <164932427279.26543.1789507091630612744-3@git.sr.ht>
X-Mailer: git.sr.ht
Reply-to: ~laurynasl <laurynasl@uber.com>
In-Reply-To: <164932427279.26543.1789507091630612744-0@git.sr.ht>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
From: laurynasl <laurynasl@uber.com>
---
.bazelrc | 8 ++---
README.md | 18 ++++------
ci/test | 2 +-
toolchain/BUILD.sdk.bazel | 5 ++-
toolchain/defs.bzl | 55 ++++++++++++++++++-----------
toolchain/toolchain/BUILD | 0
toolchain/toolchain/BUILD.sdk.bazel | 10 ++++++
7 files changed, 57 insertions(+), 41 deletions(-)
create mode 100644 toolchain/toolchain/BUILD
create mode 100644 toolchain/toolchain/BUILD.sdk.bazel
diff --git a/.bazelrc b/.bazelrc
index cba4a5e..fed6f0b 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -6,10 +6,10 @@ build --worker_sandboxing
build --compilation_mode=3Dopt
=20
build --incompatible_enable_cc_toolchain_resolution
-build --extra_toolchains @zig_sdk//:linux_amd64_gnu.2.19_toolchain
-build --extra_toolchains @zig_sdk//:linux_arm64_gnu.2.28_toolchain
-build --extra_toolchains @zig_sdk//:darwin_amd64_toolchain
-build --extra_toolchains @zig_sdk//:darwin_arm64_toolchain
+build --extra_toolchains @zig_sdk//toolchain:linux_amd64_gnu.2.19
+build --extra_toolchains @zig_sdk//toolchain:linux_arm64_gnu.2.28
+build --extra_toolchains @zig_sdk//toolchain:darwin_amd64
+build --extra_toolchains @zig_sdk//toolchain:darwin_arm64
=20
test:qemu-aarch64 --test_env=3DQEMU_LD_PREFIX=3D/usr/aarch64-linux-gnu/
test:qemu-aarch64 --run_under=3Dqemu-aarch64-static
diff --git a/README.md b/README.md
index d855c78..1a20d5f 100644
--- a/README.md
+++ b/README.md
@@ -41,10 +41,10 @@ And this to `.bazelrc`:
=20
```
build --incompatible_enable_cc_toolchain_resolution
-build --extra_toolchains @zig_sdk//:linux_amd64_gnu.2.19_toolchain
-build --extra_toolchains @zig_sdk//:linux_arm64_gnu.2.28_toolchain
-build --extra_toolchains @zig_sdk//:darwin_amd64_toolchain
-build --extra_toolchains @zig_sdk//:darwin_arm64_toolchain
+build --extra_toolchains @zig_sdk//toolchain:linux_amd64_gnu.2.19
+build --extra_toolchains @zig_sdk//toolchain:linux_arm64_gnu.2.28
+build --extra_toolchains @zig_sdk//toolchain:darwin_amd64
+build --extra_toolchains @zig_sdk//toolchain:darwin_arm64
```
=20
The snippets above will download the zig toolchain and register it for the
@@ -80,7 +80,7 @@ different one is registered using `--extra_toolchains <tool=
chain>` in
tests) on linux/amd64/musl, you may specify:
=20
```
---extra_toolchains @zig_sdk//:linux_amd64_musl_toolchain
+--extra_toolchains @zig_sdk//toolchain:linux_amd64_musl
```
=20
## UBSAN and "SIGILL: Illegal Instruction"
@@ -108,12 +108,6 @@ how to contribute.
Currently zig cache is in `$HOME`, so `bazel clean --expunge` does not clear
the zig cache. Zig's cache should be stored somewhere in the project's path.
=20
-## Toolchain and platform target locations
-
-The path to Bazel toolchains is `@zig_sdk//:<toolchain>_toolchain`. It should
-be moved to `@zig_sdk//toolchain:<toolchain>` or similar; so the user-facing
-targets are in their own namespace.
-
## OSX: sysroot
=20
For non-trivial programs (and for all darwin/arm64 cgo programs) MacOS SDK m=
ay
@@ -174,7 +168,7 @@ hello, world
$ bazel test \
--config=3Dqemu-aarch64 \
--platforms @zig_sdk//platform:linux_arm64 \
- --extra_toolchains @zig_sdk//:linux_arm64_musl_toolchain //test/...
+ --extra_toolchains @zig_sdk//toolchain:linux_arm64_musl //test/...
...
INFO: Build completed successfully, 10 total actions
//test/go:go_test PAS=
SED in 0.2s
diff --git a/ci/test b/ci/test
index 5b9a4d7..35d0c07 100755
--- a/ci/test
+++ b/ci/test
@@ -19,7 +19,7 @@ while read -r action platform toolchain config; do
=20
args+=3D(\
--platforms "@zig_sdk//platform:${platform}" \
- --extra_toolchains "@zig_sdk//:${toolchain}_toolchain" \
+ --extra_toolchains "@zig_sdk//toolchain:${toolchain}" \
//test/... \
)
=20
diff --git a/toolchain/BUILD.sdk.bazel b/toolchain/BUILD.sdk.bazel
index 8b5db49..cf5dc4a 100644
--- a/toolchain/BUILD.sdk.bazel
+++ b/toolchain/BUILD.sdk.bazel
@@ -1,11 +1,10 @@
-load("@bazel-zig-cc//toolchain:defs.bzl", "zig_build_macro")
+load("@bazel-zig-cc//toolchain:defs.bzl", "declare_files")
=20
package(
default_visibility =3D ["//visibility:public"],
)
=20
-zig_build_macro(
- absolute_path =3D {absolute_path},
+declare_files(
zig_include_root =3D {zig_include_root},
)
=20
diff --git a/toolchain/defs.bzl b/toolchain/defs.bzl
index 3f6b4bd..61e099f 100644
--- a/toolchain/defs.bzl
+++ b/toolchain/defs.bzl
@@ -189,7 +189,7 @@ def register_toolchains(
},
)
=20
- toolchains =3D ["@zig_sdk//:%s_toolchain" % t for t in register]
+ toolchains =3D ["@zig_sdk//:toolchain:%s" % t for t in register]
native.register_toolchains(*toolchains)
=20
ZIG_TOOL_PATH =3D "tools/{zig_tool}"
@@ -268,11 +268,19 @@ def _zig_repository_impl(repository_ctx):
Label("//toolchain/platform:BUILD"),
"platform/BUILD",
)
-
repository_ctx.template(
- "BUILD.bazel",
+ "BUILD",
Label("//toolchain:BUILD.sdk.bazel"),
executable =3D False,
+ substitutions =3D {
+ "{zig_include_root}": shell.quote(zig_include_root),
+ },
+ )
+
+ repository_ctx.template(
+ "toolchain/BUILD",
+ Label("//toolchain/toolchain:BUILD.sdk.bazel"),
+ executable =3D False,
substitutions =3D {
"{absolute_path}": shell.quote(str(repository_ctx.path(""))),
"{zig_include_root}": shell.quote(zig_include_root),
@@ -302,13 +310,21 @@ def filegroup(name, **kwargs):
native.filegroup(name =3D name, **kwargs)
return ":" + name
=20
-def zig_build_macro(absolute_path, zig_include_root):
+def declare_files(zig_include_root):
filegroup(name =3D "empty")
native.exports_files(["zig"], visibility =3D ["//visibility:public"])
filegroup(name =3D "lib/std", srcs =3D native.glob(["lib/std/**"]))
=20
lazy_filegroups =3D {}
=20
+ for target_config in _target_structs():
+ for d in DEFAULT_INCLUDE_DIRECTORIES + target_config.includes:
+ d =3D zig_include_root + d
+ if d not in lazy_filegroups:
+ lazy_filegroups[d] =3D filegroup(name =3D d, srcs =3D native=
.glob([d + "/**"]))
+
+
+def declare_toolchains(absolute_path, zig_include_root):
for target_config in _target_structs():
gotarget =3D target_config.gotarget
zigtarget =3D target_config.zigtarget
@@ -316,8 +332,6 @@ def zig_build_macro(absolute_path, zig_include_root):
cxx_builtin_include_directories =3D []
for d in DEFAULT_INCLUDE_DIRECTORIES + target_config.includes:
d =3D zig_include_root + d
- if d not in lazy_filegroups:
- lazy_filegroups[d] =3D filegroup(name =3D d, srcs =3D native=
.glob([d + "/**"]))
cxx_builtin_include_directories.append(absolute_path + "/" + d)
for d in getattr(target_config, "toplevel_include", []):
cxx_builtin_include_directories.append(absolute_path + "/" + d)
@@ -338,7 +352,7 @@ def zig_build_macro(absolute_path, zig_include_root):
copts =3D copts + ["-include", absolute_path + "/" + incl]
=20
zig_cc_toolchain_config(
- name =3D zigtarget + "_toolchain_cc_config",
+ name =3D zigtarget + "_cc_config",
target =3D zigtarget,
tool_paths =3D absolute_tool_paths,
cxx_builtin_include_directories =3D cxx_builtin_include_director=
ies,
@@ -353,35 +367,34 @@ def zig_build_macro(absolute_path, zig_include_root):
)
=20
native.cc_toolchain(
- name =3D zigtarget + "_toolchain_cc",
+ name =3D zigtarget + "_cc",
toolchain_identifier =3D zigtarget + "-toolchain",
- toolchain_config =3D ":%s_toolchain_cc_config" % zigtarget,
- all_files =3D ":zig",
- ar_files =3D ":zig",
- compiler_files =3D ":zig",
- linker_files =3D ":zig",
- dwp_files =3D ":empty",
- objcopy_files =3D ":empty",
- strip_files =3D ":empty",
+ toolchain_config =3D ":%s_cc_config" % zigtarget,
+ all_files =3D "@zig_sdk//:zig",
+ ar_files =3D "@zig_sdk//:zig",
+ compiler_files =3D "@zig_sdk//:zig",
+ linker_files =3D "@zig_sdk//:zig",
+ dwp_files =3D "@zig_sdk//:empty",
+ objcopy_files =3D "@zig_sdk//:empty",
+ strip_files =3D "@zig_sdk//:empty",
supports_param_files =3D 0,
)
=20
# register two kinds of toolchain targets: Go and Zig conventions.
# Go convention: amd64/arm64, linux/darwin
native.toolchain(
- name =3D gotarget + "_toolchain",
+ name =3D gotarget,
exec_compatible_with =3D None,
target_compatible_with =3D target_config.constraint_values,
- toolchain =3D ":%s_toolchain_cc" % zigtarget,
+ toolchain =3D ":%s_cc" % zigtarget,
toolchain_type =3D "@bazel_tools//tools/cpp:toolchain_type",
)
=20
# Zig convention: x86_64/aarch64, linux/macos
native.toolchain(
- name =3D zigtarget + "_toolchain",
+ name =3D zigtarget,
exec_compatible_with =3D None,
target_compatible_with =3D target_config.constraint_values,
- toolchain =3D ":%s_toolchain_cc" % zigtarget,
+ toolchain =3D ":%s_cc" % zigtarget,
toolchain_type =3D "@bazel_tools//tools/cpp:toolchain_type",
)
-
diff --git a/toolchain/toolchain/BUILD b/toolchain/toolchain/BUILD
new file mode 100644
index 0000000..e69de29
diff --git a/toolchain/toolchain/BUILD.sdk.bazel b/toolchain/toolchain/BUILD.=
sdk.bazel
new file mode 100644
index 0000000..4b505dc
--- /dev/null
+++ b/toolchain/toolchain/BUILD.sdk.bazel
@@ -0,0 +1,10 @@
+load("@bazel-zig-cc//toolchain:defs.bzl", "declare_toolchains")
+
+package(
+ default_visibility =3D ["//visibility:public"],
+)
+
+declare_toolchains(
+ absolute_path =3D {absolute_path},
+ zig_include_root =3D {zig_include_root},
+)
--=20
2.34.1
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=none
Received: from git.sr.ht (unknown [173.195.146.142])
by mail-b.sr.ht (Postfix) with ESMTPSA id A38FF11EF0D
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Thu, 7 Apr 2022 09:37:53 +0000 (UTC)
From: ~laurynasl <laurynasl@git.sr.ht>
Date: Wed, 06 Apr 2022 20:10:45 +0000
Subject: [PATCH bazel-zig-cc 4/4] Move toolchain definitions to toolchains/
Message-ID: <164932427279.26543.1789507091630612744-4@git.sr.ht>
X-Mailer: git.sr.ht
Reply-to: ~laurynasl <laurynasl@uber.com>
In-Reply-To: <164932427279.26543.1789507091630612744-0@git.sr.ht>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
From: laurynasl <laurynasl@uber.com>
---
toolchain/defs.bzl | 214 +---------------------------
toolchain/private/BUILD | 0
toolchain/private/defs.bzl | 124 ++++++++++++++++
toolchain/toolchain/BUILD.sdk.bazel | 2 +-
toolchain/toolchain/defs.bzl | 87 +++++++++++
5 files changed, 215 insertions(+), 212 deletions(-)
create mode 100644 toolchain/private/BUILD
create mode 100644 toolchain/private/defs.bzl
create mode 100644 toolchain/toolchain/defs.bzl
diff --git a/toolchain/defs.bzl b/toolchain/defs.bzl
index 61e099f..084af86 100644
--- a/toolchain/defs.bzl
+++ b/toolchain/defs.bzl
@@ -1,23 +1,7 @@
load("@bazel_skylib//lib:shell.bzl", "shell")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "read_user_netrc", "us=
e_netrc")
-load(":zig_toolchain.bzl", "zig_cc_toolchain_config")
-
-DEFAULT_TOOL_PATHS =3D {
- "ar": "ar",
- "gcc": "c++", # https://github.com/bazelbuild/bazel/issues/4644
- "cpp": "/usr/bin/false",
- "gcov": "/usr/bin/false",
- "nm": "/usr/bin/false",
- "objdump": "/usr/bin/false",
- "strip": "/usr/bin/false",
-}.items()
-
-DEFAULT_INCLUDE_DIRECTORIES =3D [
- "include",
- "libcxx/include",
- "libcxxabi/include",
-]
+load("@bazel-zig-cc//toolchain/private:defs.bzl", "DEFAULT_INCLUDE_DIRECTORI=
ES", "ZIG_TOOL_PATH", "target_structs")
=20
_fcntl_map =3D """
GLIBC_2.2.5 {
@@ -32,114 +16,6 @@ __asm__(".symver fcntl64, fcntl@GLIBC_2.2.5");
#endif
"""
=20
-# Zig supports even older glibcs than defined below, but we have tested only
-# down to 2.17.
-# $ zig targets | jq -r '.glibc[]' | sort -V
-_GLIBCS =3D [
- "2.17",
- "2.18",
- "2.19",
- "2.22",
- "2.23",
- "2.24",
- "2.25",
- "2.26",
- "2.27",
- "2.28",
- "2.29",
- "2.30",
- "2.31",
- "2.32",
- "2.33",
- "2.34",
-]
-
-def _target_darwin(gocpu, zigcpu):
- min_os =3D "10"
- if zigcpu =3D=3D "aarch64":
- min_os =3D "11"
- return struct(
- gotarget =3D "darwin_{}".format(gocpu),
- zigtarget =3D "{}-macos-gnu".format(zigcpu),
- includes =3D [
- "libunwind/include",
- # TODO: Define a toolchain for each minimum OS version
- "libc/include/{}-macos.{}-gnu".format(zigcpu, min_os),
- "libc/include/any-macos.{}-any".format(min_os),
- "libc/include/any-macos-any",
- ],
- linkopts =3D [],
- copts =3D [],
- bazel_target_cpu =3D "darwin",
- constraint_values =3D [
- "@platforms//os:macos",
- "@platforms//cpu:{}".format(zigcpu),
- ],
- tool_paths =3D {"ld": "ld64.lld"},
- )
-
-def _target_linux_gnu(gocpu, zigcpu, glibc_version =3D ""):
- glibc_suffix =3D "gnu"
- if glibc_version !=3D "":
- glibc_suffix =3D "gnu.{}".format(glibc_version)
-
- # https://github.com/ziglang/zig/issues/5882#issuecomment-888250676
- # fcntl_hack is only required for glibc 2.27 or less. We assume that
- # glibc_version =3D=3D "" (autodetect) is running a recent glibc version=
, thus
- # adding this hack only when glibc is explicitly 2.27 or lower.
- fcntl_hack =3D False
- if glibc_version =3D=3D "":
- # zig doesn't reliably detect the glibc version, so
- # often falls back to 2.17; the hack should be included.
- # https://github.com/ziglang/zig/issues/6469
- fcntl_hack =3D True
- else:
- # hack is required for 2.27 or less.
- fcntl_hack =3D glibc_version < "2.28"
-
- return struct(
- gotarget =3D "linux_{}_{}".format(gocpu, glibc_suffix),
- zigtarget =3D "{}-linux-{}".format(zigcpu, glibc_suffix),
- includes =3D [
- "libunwind/include",
- "libc/include/generic-glibc",
- "libc/include/any-linux-any",
- "libc/include/{}-linux-gnu".format(zigcpu),
- "libc/include/{}-linux-any".format(zigcpu),
- ] + (["libc/include/x86-linux-any"] if zigcpu =3D=3D "x86_64" else [=
]),
- toplevel_include =3D ["glibc-hacks"] if fcntl_hack else [],
- compiler_extra_includes =3D ["glibc-hacks/glibchack-fcntl.h"] if fcn=
tl_hack else [],
- linker_version_scripts =3D ["glibc-hacks/fcntl.map"] if fcntl_hack e=
lse [],
- linkopts =3D ["-lc++", "-lc++abi"],
- copts =3D [],
- bazel_target_cpu =3D "k8",
- constraint_values =3D [
- "@platforms//os:linux",
- "@platforms//cpu:{}".format(zigcpu),
- ],
- tool_paths =3D {"ld": "ld.lld"},
- )
-
-def _target_linux_musl(gocpu, zigcpu):
- return struct(
- gotarget =3D "linux_{}_musl".format(gocpu),
- zigtarget =3D "{}-linux-musl".format(zigcpu),
- includes =3D [
- "libc/include/generic-musl",
- "libc/include/any-linux-any",
- "libc/include/{}-linux-musl".format(zigcpu),
- "libc/include/{}-linux-any".format(zigcpu),
- ] + (["libc/include/x86-linux-any"] if zigcpu =3D=3D "x86_64" else [=
]),
- linkopts =3D ["-s", "-w"],
- copts =3D ["-D_LIBCPP_HAS_MUSL_LIBC", "-D_LIBCPP_HAS_THREAD_API_PTHR=
EAD"],
- bazel_target_cpu =3D "k8",
- constraint_values =3D [
- "@platforms//os:linux",
- "@platforms//cpu:{}".format(zigcpu),
- ],
- tool_paths =3D {"ld": "ld.lld"},
- )
-
# Official recommended version. Should use this when we have a usable releas=
e.
URL_FORMAT_RELEASE =3D "https://ziglang.org/download/{version}/zig-{host_pla=
tform}-{version}.tar.xz"
=20
@@ -192,7 +68,6 @@ def register_toolchains(
toolchains =3D ["@zig_sdk//:toolchain:%s" % t for t in register]
native.register_toolchains(*toolchains)
=20
-ZIG_TOOL_PATH =3D "tools/{zig_tool}"
ZIG_TOOL_WRAPPER =3D """#!/bin/bash
set -e
=20
@@ -297,14 +172,7 @@ zig_repository =3D repository_rule(
implementation =3D _zig_repository_impl,
)
=20
-def _target_structs():
- ret =3D []
- for zigcpu, gocpu in (("x86_64", "amd64"), ("aarch64", "arm64")):
- ret.append(_target_darwin(gocpu, zigcpu))
- ret.append(_target_linux_musl(gocpu, zigcpu))
- for glibc in [""] + _GLIBCS:
- ret.append(_target_linux_gnu(gocpu, zigcpu, glibc))
- return ret
+
=20
def filegroup(name, **kwargs):
native.filegroup(name =3D name, **kwargs)
@@ -317,84 +185,8 @@ def declare_files(zig_include_root):
=20
lazy_filegroups =3D {}
=20
- for target_config in _target_structs():
+ for target_config in target_structs():
for d in DEFAULT_INCLUDE_DIRECTORIES + target_config.includes:
d =3D zig_include_root + d
if d not in lazy_filegroups:
lazy_filegroups[d] =3D filegroup(name =3D d, srcs =3D native=
.glob([d + "/**"]))
-
-
-def declare_toolchains(absolute_path, zig_include_root):
- for target_config in _target_structs():
- gotarget =3D target_config.gotarget
- zigtarget =3D target_config.zigtarget
-
- cxx_builtin_include_directories =3D []
- for d in DEFAULT_INCLUDE_DIRECTORIES + target_config.includes:
- d =3D zig_include_root + d
- cxx_builtin_include_directories.append(absolute_path + "/" + d)
- for d in getattr(target_config, "toplevel_include", []):
- cxx_builtin_include_directories.append(absolute_path + "/" + d)
-
- absolute_tool_paths =3D {}
- for name, path in target_config.tool_paths.items() + DEFAULT_TOOL_PA=
THS:
- if path[0] =3D=3D "/":
- absolute_tool_paths[name] =3D path
- continue
- tool_path =3D ZIG_TOOL_PATH.format(zig_tool =3D path)
- absolute_tool_paths[name] =3D "%s/%s" % (absolute_path, tool_pat=
h)
-
- linkopts =3D target_config.linkopts
- copts =3D target_config.copts
- for s in getattr(target_config, "linker_version_scripts", []):
- linkopts =3D linkopts + ["-Wl,--version-script,%s/%s" % (absolut=
e_path, s)]
- for incl in getattr(target_config, "compiler_extra_includes", []):
- copts =3D copts + ["-include", absolute_path + "/" + incl]
-
- zig_cc_toolchain_config(
- name =3D zigtarget + "_cc_config",
- target =3D zigtarget,
- tool_paths =3D absolute_tool_paths,
- cxx_builtin_include_directories =3D cxx_builtin_include_director=
ies,
- copts =3D copts,
- linkopts =3D linkopts,
- target_cpu =3D target_config.bazel_target_cpu,
- target_system_name =3D "unknown",
- target_libc =3D "unknown",
- compiler =3D "clang",
- abi_version =3D "unknown",
- abi_libc_version =3D "unknown",
- )
-
- native.cc_toolchain(
- name =3D zigtarget + "_cc",
- toolchain_identifier =3D zigtarget + "-toolchain",
- toolchain_config =3D ":%s_cc_config" % zigtarget,
- all_files =3D "@zig_sdk//:zig",
- ar_files =3D "@zig_sdk//:zig",
- compiler_files =3D "@zig_sdk//:zig",
- linker_files =3D "@zig_sdk//:zig",
- dwp_files =3D "@zig_sdk//:empty",
- objcopy_files =3D "@zig_sdk//:empty",
- strip_files =3D "@zig_sdk//:empty",
- supports_param_files =3D 0,
- )
-
- # register two kinds of toolchain targets: Go and Zig conventions.
- # Go convention: amd64/arm64, linux/darwin
- native.toolchain(
- name =3D gotarget,
- exec_compatible_with =3D None,
- target_compatible_with =3D target_config.constraint_values,
- toolchain =3D ":%s_cc" % zigtarget,
- toolchain_type =3D "@bazel_tools//tools/cpp:toolchain_type",
- )
-
- # Zig convention: x86_64/aarch64, linux/macos
- native.toolchain(
- name =3D zigtarget,
- exec_compatible_with =3D None,
- target_compatible_with =3D target_config.constraint_values,
- toolchain =3D ":%s_cc" % zigtarget,
- toolchain_type =3D "@bazel_tools//tools/cpp:toolchain_type",
- )
diff --git a/toolchain/private/BUILD b/toolchain/private/BUILD
new file mode 100644
index 0000000..e69de29
diff --git a/toolchain/private/defs.bzl b/toolchain/private/defs.bzl
new file mode 100644
index 0000000..8380071
--- /dev/null
+++ b/toolchain/private/defs.bzl
@@ -0,0 +1,124 @@
+DEFAULT_INCLUDE_DIRECTORIES =3D [
+ "include",
+ "libcxx/include",
+ "libcxxabi/include",
+]
+
+ZIG_TOOL_PATH =3D "tools/{zig_tool}"
+
+# Zig supports even older glibcs than defined below, but we have tested only
+# down to 2.17.
+# $ zig targets | jq -r '.glibc[]' | sort -V
+_GLIBCS =3D [
+ "2.17",
+ "2.18",
+ "2.19",
+ "2.22",
+ "2.23",
+ "2.24",
+ "2.25",
+ "2.26",
+ "2.27",
+ "2.28",
+ "2.29",
+ "2.30",
+ "2.31",
+ "2.32",
+ "2.33",
+ "2.34",
+]
+
+def target_structs():
+ ret =3D []
+ for zigcpu, gocpu in (("x86_64", "amd64"), ("aarch64", "arm64")):
+ ret.append(_target_darwin(gocpu, zigcpu))
+ ret.append(_target_linux_musl(gocpu, zigcpu))
+ for glibc in [""] + _GLIBCS:
+ ret.append(_target_linux_gnu(gocpu, zigcpu, glibc))
+ return ret
+
+def _target_darwin(gocpu, zigcpu):
+ min_os =3D "10"
+ if zigcpu =3D=3D "aarch64":
+ min_os =3D "11"
+ return struct(
+ gotarget =3D "darwin_{}".format(gocpu),
+ zigtarget =3D "{}-macos-gnu".format(zigcpu),
+ includes =3D [
+ "libunwind/include",
+ # TODO: Define a toolchain for each minimum OS version
+ "libc/include/{}-macos.{}-gnu".format(zigcpu, min_os),
+ "libc/include/any-macos.{}-any".format(min_os),
+ "libc/include/any-macos-any",
+ ],
+ linkopts =3D [],
+ copts =3D [],
+ bazel_target_cpu =3D "darwin",
+ constraint_values =3D [
+ "@platforms//os:macos",
+ "@platforms//cpu:{}".format(zigcpu),
+ ],
+ tool_paths =3D {"ld": "ld64.lld"},
+ )
+
+def _target_linux_gnu(gocpu, zigcpu, glibc_version =3D ""):
+ glibc_suffix =3D "gnu"
+ if glibc_version !=3D "":
+ glibc_suffix =3D "gnu.{}".format(glibc_version)
+
+ # https://github.com/ziglang/zig/issues/5882#issuecomment-888250676
+ # fcntl_hack is only required for glibc 2.27 or less. We assume that
+ # glibc_version =3D=3D "" (autodetect) is running a recent glibc version=
, thus
+ # adding this hack only when glibc is explicitly 2.27 or lower.
+ fcntl_hack =3D False
+ if glibc_version =3D=3D "":
+ # zig doesn't reliably detect the glibc version, so
+ # often falls back to 2.17; the hack should be included.
+ # https://github.com/ziglang/zig/issues/6469
+ fcntl_hack =3D True
+ else:
+ # hack is required for 2.27 or less.
+ fcntl_hack =3D glibc_version < "2.28"
+
+ return struct(
+ gotarget =3D "linux_{}_{}".format(gocpu, glibc_suffix),
+ zigtarget =3D "{}-linux-{}".format(zigcpu, glibc_suffix),
+ includes =3D [
+ "libunwind/include",
+ "libc/include/generic-glibc",
+ "libc/include/any-linux-any",
+ "libc/include/{}-linux-gnu".format(zigcpu),
+ "libc/include/{}-linux-any".format(zigcpu),
+ ] + (["libc/include/x86-linux-any"] if zigcpu =3D=3D "x86_64" else [=
]),
+ toplevel_include =3D ["glibc-hacks"] if fcntl_hack else [],
+ compiler_extra_includes =3D ["glibc-hacks/glibchack-fcntl.h"] if fcn=
tl_hack else [],
+ linker_version_scripts =3D ["glibc-hacks/fcntl.map"] if fcntl_hack e=
lse [],
+ linkopts =3D ["-lc++", "-lc++abi"],
+ copts =3D [],
+ bazel_target_cpu =3D "k8",
+ constraint_values =3D [
+ "@platforms//os:linux",
+ "@platforms//cpu:{}".format(zigcpu),
+ ],
+ tool_paths =3D {"ld": "ld.lld"},
+ )
+
+def _target_linux_musl(gocpu, zigcpu):
+ return struct(
+ gotarget =3D "linux_{}_musl".format(gocpu),
+ zigtarget =3D "{}-linux-musl".format(zigcpu),
+ includes =3D [
+ "libc/include/generic-musl",
+ "libc/include/any-linux-any",
+ "libc/include/{}-linux-musl".format(zigcpu),
+ "libc/include/{}-linux-any".format(zigcpu),
+ ] + (["libc/include/x86-linux-any"] if zigcpu =3D=3D "x86_64" else [=
]),
+ linkopts =3D ["-s", "-w"],
+ copts =3D ["-D_LIBCPP_HAS_MUSL_LIBC", "-D_LIBCPP_HAS_THREAD_API_PTHR=
EAD"],
+ bazel_target_cpu =3D "k8",
+ constraint_values =3D [
+ "@platforms//os:linux",
+ "@platforms//cpu:{}".format(zigcpu),
+ ],
+ tool_paths =3D {"ld": "ld.lld"},
+ )
diff --git a/toolchain/toolchain/BUILD.sdk.bazel b/toolchain/toolchain/BUILD.=
sdk.bazel
index 4b505dc..7cbca73 100644
--- a/toolchain/toolchain/BUILD.sdk.bazel
+++ b/toolchain/toolchain/BUILD.sdk.bazel
@@ -1,4 +1,4 @@
-load("@bazel-zig-cc//toolchain:defs.bzl", "declare_toolchains")
+load("@bazel-zig-cc//toolchain/toolchain:defs.bzl", "declare_toolchains")
=20
package(
default_visibility =3D ["//visibility:public"],
diff --git a/toolchain/toolchain/defs.bzl b/toolchain/toolchain/defs.bzl
new file mode 100644
index 0000000..1b0c087
--- /dev/null
+++ b/toolchain/toolchain/defs.bzl
@@ -0,0 +1,87 @@
+load("@bazel-zig-cc//toolchain:zig_toolchain.bzl", "zig_cc_toolchain_config")
+load("@bazel-zig-cc//toolchain/private:defs.bzl", "DEFAULT_INCLUDE_DIRECTORI=
ES", "ZIG_TOOL_PATH", "target_structs")
+
+DEFAULT_TOOL_PATHS =3D {
+ "ar": "ar",
+ "gcc": "c++", # https://github.com/bazelbuild/bazel/issues/4644
+ "cpp": "/usr/bin/false",
+ "gcov": "/usr/bin/false",
+ "nm": "/usr/bin/false",
+ "objdump": "/usr/bin/false",
+ "strip": "/usr/bin/false",
+}.items()
+
+def declare_toolchains(absolute_path, zig_include_root):
+ for target_config in target_structs():
+ gotarget =3D target_config.gotarget
+ zigtarget =3D target_config.zigtarget
+
+ cxx_builtin_include_directories =3D []
+ for d in DEFAULT_INCLUDE_DIRECTORIES + target_config.includes:
+ d =3D zig_include_root + d
+ cxx_builtin_include_directories.append(absolute_path + "/" + d)
+ for d in getattr(target_config, "toplevel_include", []):
+ cxx_builtin_include_directories.append(absolute_path + "/" + d)
+
+ absolute_tool_paths =3D {}
+ for name, path in target_config.tool_paths.items() + DEFAULT_TOOL_PA=
THS:
+ if path[0] =3D=3D "/":
+ absolute_tool_paths[name] =3D path
+ continue
+ tool_path =3D ZIG_TOOL_PATH.format(zig_tool =3D path)
+ absolute_tool_paths[name] =3D "%s/%s" % (absolute_path, tool_pat=
h)
+
+ linkopts =3D target_config.linkopts
+ copts =3D target_config.copts
+ for s in getattr(target_config, "linker_version_scripts", []):
+ linkopts =3D linkopts + ["-Wl,--version-script,%s/%s" % (absolut=
e_path, s)]
+ for incl in getattr(target_config, "compiler_extra_includes", []):
+ copts =3D copts + ["-include", absolute_path + "/" + incl]
+
+ zig_cc_toolchain_config(
+ name =3D zigtarget + "_cc_config",
+ target =3D zigtarget,
+ tool_paths =3D absolute_tool_paths,
+ cxx_builtin_include_directories =3D cxx_builtin_include_director=
ies,
+ copts =3D copts,
+ linkopts =3D linkopts,
+ target_cpu =3D target_config.bazel_target_cpu,
+ target_system_name =3D "unknown",
+ target_libc =3D "unknown",
+ compiler =3D "clang",
+ abi_version =3D "unknown",
+ abi_libc_version =3D "unknown",
+ )
+
+ native.cc_toolchain(
+ name =3D zigtarget + "_cc",
+ toolchain_identifier =3D zigtarget + "-toolchain",
+ toolchain_config =3D ":%s_cc_config" % zigtarget,
+ all_files =3D "@zig_sdk//:zig",
+ ar_files =3D "@zig_sdk//:zig",
+ compiler_files =3D "@zig_sdk//:zig",
+ linker_files =3D "@zig_sdk//:zig",
+ dwp_files =3D "@zig_sdk//:empty",
+ objcopy_files =3D "@zig_sdk//:empty",
+ strip_files =3D "@zig_sdk//:empty",
+ supports_param_files =3D 0,
+ )
+
+ # register two kinds of toolchain targets: Go and Zig conventions.
+ # Go convention: amd64/arm64, linux/darwin
+ native.toolchain(
+ name =3D gotarget,
+ exec_compatible_with =3D None,
+ target_compatible_with =3D target_config.constraint_values,
+ toolchain =3D ":%s_cc" % zigtarget,
+ toolchain_type =3D "@bazel_tools//tools/cpp:toolchain_type",
+ )
+
+ # Zig convention: x86_64/aarch64, linux/macos
+ native.toolchain(
+ name =3D zigtarget,
+ exec_compatible_with =3D None,
+ target_compatible_with =3D target_config.constraint_values,
+ toolchain =3D ":%s_cc" % zigtarget,
+ toolchain_type =3D "@bazel_tools//tools/cpp:toolchain_type",
+ )
--=20
2.34.1
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51])
by mail-b.sr.ht (Postfix) with ESMTPS id D9FEC11EF31
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Thu, 7 Apr 2022 10:16:27 +0000 (UTC)
Received: by mail-lf1-f51.google.com with SMTP id t25so8768526lfg.7
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Thu, 07 Apr 2022 03:16:27 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:subject:message-id:mime-version
:content-disposition;
bh=5CcT+69xbBgEfxFL90+YhwoI1iopbKQyy7Oi4opMTIo=;
b=WNQLVGqkd80D1Sm/Bfg3bmp/ynq5+d2t4yMiCcaS5ijR8tzSBD2ewFCCYO6rmEt3rN
EgssWTJvHJ9cGVMB8k2ckF74+UvQUO4H/VKEqEkLiOy8xMpJAxtSFa21n4PjAOWchxQN
CZ1vVmgVM68w3mKfoz92ah96+cb+ZTr8BDjnEevZphe+JnTnNPBZvHsUBvAIolRv6Dwg
nSMlG6TvQvsWdPug+9oZxRGidUpgazXaDLT3g4LGcEz8AyC1GZJVTQoaZreRziWWeF88
zBQa9ATBItAAtHBA0zWKlO2x4+5qTJk9CmFKWJek018+i4hp2AGKaxY9GUIexq6QpQ5W
obGA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:subject:message-id
:mime-version:content-disposition;
bh=5CcT+69xbBgEfxFL90+YhwoI1iopbKQyy7Oi4opMTIo=;
b=YhFHoqEerjfIciMqFQcFW6XlcmM0SFvzFmVpIfvBBzhM/mGcqD9ABPjOgog1WbLH6x
sp/aMZdeWURMfxcEiGFzqJxxRYTO0QVH4sVFqDz1Yph7p6QRbVZkFnubcqxK8frv/gEw
LW1zj1gg7ELhhMOyZrXuPuzWhGgIIj3tF3PWyF8Q09GX7fUUe0itt/Mc6/Ohh9h/4yLo
54QUc+NEcBdEc3QYsEVGElbEjFubD6nCJHFHI4m9q4T9KuEdEnIEHaYlYW8f7nqz6Tuj
b9Yd9o9xo+tXEGedd7sX7QsTxP4m0mpK7kUHi5B14u9fYe1vSmTi5zEVTl5ihT7ARcKi
dDng==
X-Gm-Message-State: AOAM532qmhQiEFzNxou2eb+eEvZXItLxJZCh4JqPJbRUeVx4UTFd1uHr
0X/kEjn6J/NE0+7UPzoqovuzemPp0rI=
X-Google-Smtp-Source: ABdhPJzBikjzOYpY5FJD64W5d9x0JHb/4ZzQTYtpxW37qmpNx0PuZ7vUcGJcyNZEtHb/l4uDER4dAQ==
X-Received: by 2002:a05:6512:2207:b0:45d:cd01:d3ca with SMTP id h7-20020a056512220700b0045dcd01d3camr9223234lfu.561.1649326586313;
Thu, 07 Apr 2022 03:16:26 -0700 (PDT)
Received: from localhost ([88.223.105.24])
by smtp.gmail.com with ESMTPSA id f15-20020a0565123b0f00b0044a29f8ec94sm2122687lfv.95.2022.04.07.03.16.25
for <~motiejus/bazel-zig-cc@lists.sr.ht>
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 07 Apr 2022 03:16:25 -0700 (PDT)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Thu, 7 Apr 2022 13:16:25 +0300
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Subject: RW access to contributors; talk in zig meetup
Message-ID: <20220407101625.aahrqx4fa4qme56i@mtpad.i.jakstys.lt>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Hi all,
As I've received significant contributions from Ken Micklas and Laurynas
Lubys, I decided to grant them write access to bazel-zig-cc. Here is an
email I've sent them privately with the rules:
- When WIP, feel free to push your code to <your name>/<feature name>
branch. Remove the branch when done.
- When ready for merging, push it to the `next` branch and ping me.
- I will keep merging to `main`, tagging the releases keep emailing the
announcements.
That way, `main` will still have the latest tagged release signed by me.
I will also be talking about bazel-zig-cc in the upcoming Zig meetup
this weekend[1]. I was also listed in Google FOSS peer award and
"earned" $250 for bazel-zig-cc[2]. Thanks Google!
Regards,
Motiejus
[1]: https://twitter.com/croloris/status/1511342711764303890
[2]: https://opensource.googleblog.com/2022/03/Announcing-First-Group-of-Google-Open-Source-Peer-Bonus-Winners-in-2022.html
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174])
by mail-b.sr.ht (Postfix) with ESMTPS id EC4CF11EF0D
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Thu, 7 Apr 2022 11:46:53 +0000 (UTC)
Received: by mail-lj1-f174.google.com with SMTP id m12so7091213ljp.8
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Thu, 07 Apr 2022 04:46:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:subject:message-id:mime-version
:content-disposition;
bh=n3IIP9b/dm6u4Ogk5WbyKAVibt9GhM62nPVV/n4RUwk=;
b=padVY/+QQ/vqOrkAO5EDkuy3Q71mz0nCyzYt7PzYZBn1TakTVltTOOOAt1dWqai4ZW
4UCaCWTTXp1QsTY1Jhy3jk1+VtNmwE5hCnog/oBLKyTZy9VG9oJCufZ98C0NhZH6QYWm
/kV//4KYHgLBYm4xMVXqrQZDWUFqDOSBbobqqvXhDyFYCoJ0I2hE2am34t3t6iRTXnPi
YBk3eHlG1YxdHJVAy9m/tPTdVoG7vJDMqvRWpdTO4bj/2y/mZsv+6EC+F++G4EaFqDU+
lkF0LqOOyXOjhPXH9mTDWDplqUGCOQpohocBkiklULHK9EOI6a2978e/xzVzXHXbrDUA
ISFA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:subject:message-id
:mime-version:content-disposition;
bh=n3IIP9b/dm6u4Ogk5WbyKAVibt9GhM62nPVV/n4RUwk=;
b=r6pUU4alpx0qxQLSeUrJJAZg3pPmByXNg4yS6TUtdO6XiMpFn+l/UbHfRI+j1kOze9
CjQBgMjN7cbD/qCDHmj5DcJ2stVmXB6w7JgplKWJKztHjZz7Xp7/dal13mWBJYY6bA0B
tvk8GqbCWxKg1hjKHBQjVbonY7olfqYmvPLjrltNLWdMdhP0iYZi1Jx0Efbwo0wZYlyG
u0GtCRmZo6mbncqqY0buGAZrbbZDyzmlYvoiiQgzDjVxJ2OArhC7JKzs4Oy4MrCVmcc2
n44RukxntoB1JICgxjTuP1tOVJwtqnWJozy8sMj/gIiAC4sxSUh0WpaGMnDSIMn6fPwk
5kCg==
X-Gm-Message-State: AOAM532EiS0iNVxCL7f5RMo6C8NBMUh6+ZBmA8E2RCXRiKL5Of0tbCRK
Hio5r/zbebNRN9d5Qh9cHVSnLnIFtG0=
X-Google-Smtp-Source: ABdhPJw8kmQ9cjm9v6O7vVVO/LcYYG2JfwlxfdYcNwo3ggshEQ11R2kprT9RNkXkRhfStSdk8IkNFw==
X-Received: by 2002:a2e:b8cb:0:b0:24b:16a3:ed9d with SMTP id s11-20020a2eb8cb000000b0024b16a3ed9dmr8241447ljp.393.1649332012561;
Thu, 07 Apr 2022 04:46:52 -0700 (PDT)
Received: from localhost ([88.223.105.24])
by smtp.gmail.com with ESMTPSA id e23-20020a196917000000b00464f74b2245sm134248lfc.252.2022.04.07.04.46.51
for <~motiejus/bazel-zig-cc@lists.sr.ht>
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 07 Apr 2022 04:46:51 -0700 (PDT)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Thu, 7 Apr 2022 14:46:50 +0300
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Subject: bazel-zig-cc v0.6.0
Message-ID: <20220407114650.uvdymzjjrdpwy6ei@mtpad.i.jakstys.lt>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Hi all,
this change is a breaking change to bazel-zig-cc. Main points (from changelog):
### [laurynasl] Hide toolchain internals
This is a long-standing issue where platforms, toolchains and private stuff was
mixed together. Now platforms and toolchains are defined in their own
namespaces:
$ bazel query @zig_sdk//platform:*
@zig_sdk//platform:BUILD
@zig_sdk//platform:darwin_aarch64
@zig_sdk//platform:darwin_amd64
@zig_sdk//platform:darwin_arm64
@zig_sdk//platform:darwin_x86_64
@zig_sdk//platform:linux_aarch64
@zig_sdk//platform:linux_amd64
@zig_sdk//platform:linux_arm64
@zig_sdk//platform:linux_x86_64
@zig_sdk//platform:macos_aarch64
@zig_sdk//platform:macos_amd64
@zig_sdk//platform:macos_arm64
@zig_sdk//platform:macos_x86_64
$ bazel query @zig_sdk//toolchain:* | head -10
Loading: 0 packages loaded
@zig_sdk//toolchain:BUILD
@zig_sdk//toolchain:aarch64-linux-gnu
@zig_sdk//toolchain:aarch64-linux-gnu.2.17
@zig_sdk//toolchain:aarch64-linux-gnu.2.18
@zig_sdk//toolchain:aarch64-linux-gnu.2.19
@zig_sdk//toolchain:aarch64-linux-gnu.2.22
@zig_sdk//toolchain:aarch64-linux-gnu.2.23
@zig_sdk//toolchain:aarch64-linux-gnu.2.24
@zig_sdk//toolchain:aarch64-linux-gnu.2.25
@zig_sdk//toolchain:aarch64-linux-gnu.2.26
Thanks Laurynas!
### [Ken Micklas] Upgrade to Bazel 5.1.0
... we now require minimal bazel 5.1.0. And there are some other minor
CI improvements, like specifying golang version for reproducibility.
Laurynas is preparing a different way to specify musl and glibc
platforms by selecting the platform, not the toolchain. This should
happen soon. This was desirable from day 0, but I couldn't make it
happen reliably at the time, so resorted to `--extra_toolchains`.
Looking forward to it!
Motiejus
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45])
by mail-b.sr.ht (Postfix) with ESMTPS id 26EB511EF0D
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Thu, 7 Apr 2022 11:59:00 +0000 (UTC)
Received: by mail-lf1-f45.google.com with SMTP id j9so1115535lfe.9
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Thu, 07 Apr 2022 04:59:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:subject:message-id:references:mime-version
:content-disposition:content-transfer-encoding:in-reply-to;
bh=qPvE8Z3jxFbO8/hk/7iLyvO8AvuVK1BVd14aRCHEq9Q=;
b=oHQTT3iCEJtVOWQUpeJMxTuzSU8kBCJr+Rhre09sno6wm9JMS+4XMD5Mk89ZzsblLg
rvecwfi75VwCYUgp/Nj5yRnQI2K8KTeNkRUCB7GTd9oF7NuZsxC8+GxH9TxR8xqvODLw
yk03ZdPwvg/UvkNWgNLBOE2gYcuXN3fagTuWe/FjfEZMmjvt1SthbmZZFJYRjwoS2cIK
9btIhIMkl9TU6CjKwhLSqkO8oK/jfuH0A6bwa98Vq9vaoT9KTXGC+0rzmLVXa0QvpzgM
gSVt3JGjtNpasYkEvykRqNiL9IF+ybEuS3v8ooWJLBS7OvvbXkmlHa6upqlUIBZs0fDY
YI7Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:subject:message-id
:references:mime-version:content-disposition
:content-transfer-encoding:in-reply-to;
bh=qPvE8Z3jxFbO8/hk/7iLyvO8AvuVK1BVd14aRCHEq9Q=;
b=vLTlF5zQFcCkVWc3pTkrSl6laNqNX+7U4OFZjoQF5w+Q3R9baAMbTjeuN91+rgoAlY
I35XRrUryuCQQGPsCWfFmTriUcRraq2lg7wqedf9mCCQrd6DzQsYD9EFeDuftP0nYw4E
/B/eHXdWqFJJZ/LeFg1tsAqPywtvqkog69NFfwjlVCCHoswHLeoNzMmJbeIhvKIzHFZ9
JYhyLXbsYQ5mH8BhIXP3vVX9/dBaTml53KifDPhAK5+a+WBTpDp4FMq5Fo6uHRtCCvph
ftoxdhzDD5cCuI0333ObESfY8C9auh++SpJB8VoKE47mqGqxTTwbG5OAihnSootP455N
FOdg==
X-Gm-Message-State: AOAM530+ADb6PNwhrVoZ2Pvix6HxW85gaJulXtWffYEtq0aRR5C1oF1j
sesRfuRME7Q/fPVchsNpjYzTrfAB10o=
X-Google-Smtp-Source: ABdhPJyoV6RBbcMPkh4E6B56JGD/HqTSZPMCZFPKWkImrBLr2QckR6kmYKhjvASHRiZbtHuDLq17dw==
X-Received: by 2002:a05:6512:2252:b0:44a:3038:cbc with SMTP id i18-20020a056512225200b0044a30380cbcmr9119693lfu.252.1649332738955;
Thu, 07 Apr 2022 04:58:58 -0700 (PDT)
Received: from localhost ([88.223.105.24])
by smtp.gmail.com with ESMTPSA id y5-20020a2e3205000000b0024b045e3b18sm1824027ljy.66.2022.04.07.04.58.58
for <~motiejus/bazel-zig-cc@lists.sr.ht>
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 07 Apr 2022 04:58:58 -0700 (PDT)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Thu, 7 Apr 2022 14:58:57 +0300
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Subject: Re: RW access to contributors; talk in zig meetup
Message-ID: <20220407115857.q2gikkc624j2eyp2@mtpad.i.jakstys.lt>
References: <20220407101625.aahrqx4fa4qme56i@mtpad.i.jakstys.lt>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20220407101625.aahrqx4fa4qme56i@mtpad.i.jakstys.lt>
Hi all,
Slight rule correction:
On Thu, Apr 07, 2022 at 01:16:25PM +0300, Motiejus Jakštys wrote:
> - When ready for merging, push it to the `next` branch and ping me.
Since I allow for force-pushes, we have 3 contributors, `next` doesn't
make sense. So push to "your" branch (<your name>/<feature slug>) and
I'll merge from there.
So we should have only those branches in ~motiejus/bazel-zig-cc:
- `main`: passes CI and is always the latest released tag.
- for our sandbox work: `motiejus/<X>`, `laurynasl/<X>`,
`kmicklas/<X>`. You are the boss there.
There seems to be a problem with sourcehut picking the patches from the
mailing list, which I reported to `#sr.ht:libera.chat`:
UI-generated patchset
(https://lists.sr.ht/~motiejus/bazel-zig-cc/%3C164932427279.26543.1789507091630612744-0%40git.sr.ht%3E)
did not end up in https://lists.sr.ht/~motiejus/bazel-zig-cc/patches
and, consequently, did not trigger a CI run. Is this appropriate
place to report it? Happened ~1 hour ago.
Motiejus
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=none
Received: from git.sr.ht (unknown [173.195.146.142])
by mail-b.sr.ht (Postfix) with ESMTPSA id 82D7C11EF2F
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Fri, 8 Apr 2022 13:03:53 +0000 (UTC)
From: ~laurynasl <laurynasl@git.sr.ht>
Date: Fri, 08 Apr 2022 13:03:53 +0000
Subject:
[PATCH bazel-zig-cc 0/1] Fix the register parameter in register toolchain
MIME-Version: 1.0
Message-ID: <164942303327.26005.14403108374611803240-0@git.sr.ht>
X-Mailer: git.sr.ht
Reply-to: ~laurynasl <laurynasl@uber.com>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Looks like this slipped through the CI. We should think about how to
catch cases like these.
laurynasl (1):
Fix register toolchain
toolchain/defs.bzl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--
2.34.1
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=none
Received: from git.sr.ht (unknown [173.195.146.142])
by mail-b.sr.ht (Postfix) with ESMTPSA id 9D4EB11EF52
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Fri, 8 Apr 2022 13:03:53 +0000 (UTC)
From: ~laurynasl <laurynasl@git.sr.ht>
Date: Fri, 08 Apr 2022 12:55:52 +0000
Subject: [PATCH bazel-zig-cc 1/1] Fix register toolchain
Message-ID: <164942303327.26005.14403108374611803240-1@git.sr.ht>
X-Mailer: git.sr.ht
Reply-to: ~laurynasl <laurynasl@uber.com>
In-Reply-To: <164942303327.26005.14403108374611803240-0@git.sr.ht>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
From: laurynasl <laurynasl@uber.com>
---
toolchain/defs.bzl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/toolchain/defs.bzl b/toolchain/defs.bzl
index ebcb65e..9e34e6b 100644
--- a/toolchain/defs.bzl
+++ b/toolchain/defs.bzl
@@ -65,7 +65,7 @@ def register_toolchains(
},
)
- toolchains = ["@zig_sdk//:toolchain:%s" % t for t in register]
+ toolchains = ["@zig_sdk//toolchain:%s" % t for t in register]
native.register_toolchains(*toolchains)
ZIG_TOOL_WRAPPER = """#!/bin/bash
--
2.34.1
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
DKIM-Signature: a=rsa-sha256; bh=YOJYgIRj5Efp6IEK+Upr03ayDJNyfjbPpxDgRvSeIe4=;
c=simple/simple; d=sr.ht; h=Date:From:In-Reply-To:Subject:To:Cc;
q=dns/txt; s=srht; t=1649423871; v=1;
b=SvfvUpxx4SspZsLgBcrQnFjUzHEuh8tlyXSVomm/BKNwgYNa9xKwsKxFpjdNZo03+CnJ6VN9
f0d61GSdt4hYH8fX3pedL4BU7m4UzzercYw4hNuqXsM4LaNcsr2WspELZf3rFy95EqEKBzgeLk6
c5eEENfDGxnu8MRQ20KsKzRVQpXc9ji6yRsLWnFgsYB0ILzZk3+4wUyQ8CA3VwyrUrWP9BZeT/Z
QLE4h+6VHGbbkH4ALEh2AWG+ziVMDK9/fcbd2lPxOkxJDSRG2NDnj2QNl3aJ6pemxHOsFSwUsnZ
1/6RYkJAPt4IoVFggK7R0Q0NI3rd8kdntqu7kDjtm6MCg==
Received: from localhost (unknown [173.195.146.244])
by mail-b.sr.ht (Postfix) with UTF8SMTPSA id 2D9DE11EF2F;
Fri, 8 Apr 2022 13:17:51 +0000 (UTC)
MIME-Version: 1.0
Date: Fri, 08 Apr 2022 13:17:51 +0000
From: "builds.sr.ht" <builds@sr.ht>
Message-ID: <CJ4VYPONM9FI.3QD09NITLDE94@cirno2>
In-Reply-To: <164942303327.26005.14403108374611803240-1@git.sr.ht>
Subject: [bazel-zig-cc/patches/.build.yml] build success
To: "~laurynasl" <laurynasl@uber.com>
Cc: ~motiejus/bazel-zig-cc@lists.sr.ht
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
bazel-zig-cc/patches/.build.yml: SUCCESS in 13m56s
[Fix the register parameter in register toolchain][0] from [~laurynasl][1]
[0]: https://lists.sr.ht/~motiejus/bazel-zig-cc/patches/30909
[1]: mailto:laurynasl@uber.com
=E2=9C=93 #732421 SUCCESS bazel-zig-cc/patches/.build.yml https://builds.sr=
.ht/~motiejus/job/732421
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51])
by mail-b.sr.ht (Postfix) with ESMTPS id E328611EF8D
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Fri, 8 Apr 2022 21:15:40 +0000 (UTC)
Received: by mail-ed1-f51.google.com with SMTP id g20so11420427edw.6
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Fri, 08 Apr 2022 14:15:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:cc:subject:message-id:references:mime-version
:content-disposition:in-reply-to;
bh=T6ualBv4fzgTEhmeVIagcPsiNBDA5mkwh+NR7uMFVLg=;
b=K8lk9/iOmrZB9FULwWp+0/mcmrFO5pUlzPmV4/RAzC/lAnwVB5ZbK5NDXQLAlG502e
y3uNgEv1bRK227X5QgJKjhocaOgfG7RcP6LdXqSyVE4MKHmWpB3IESPqcPwczK0mvU23
CpMaXT4qXwS2b/sTc+Arg0iOP7URGx0aiRe1VClCce6E09pRJYSfcge5T7GEusuIlhGv
SMwykkPtL7SDqebDyYcnwXFqe/qb7tBNSHEiISLm/d35SXxWfAyvrAE0w+KfglNxjNvP
QlMKoYcmEWhWGdtBlq+xMLTRMfbcPnZBasfPRTHU1VMxROIobLWm5rNk1m1jxewEbMmm
DEKg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:cc:subject:message-id
:references:mime-version:content-disposition:in-reply-to;
bh=T6ualBv4fzgTEhmeVIagcPsiNBDA5mkwh+NR7uMFVLg=;
b=j929qvKAagl082Cw7WtQ1T+S0InaNZ3P2a76t7PwpN/Q2i07TqB3hoHZJVQjQ2TNxc
awN2QfE56oO5xxRxS0oR8qdyvfjxxYmTDjaS4i0VxBiDAy8APtwYKRuqZKAtrYACgOz5
e0TKJk1RZOPYg2ESj3QXDjSbqTjbLtuaxTag2Xs8QFjOo2Z78GP2opCS89mCOZwnyE6W
ubtGzB9IMXQZJsNc75+QXTzomkgArFe3hwlKQ5ojmGuVl0XJRz2QTHwJEsVuOOMtuNi0
SsHITnRl6mV3HIljGRK4qWEh2cQMnQrlMUrVbrGHLGaHN+qgB5riMuPPIGujpmtOwhxL
F0jA==
X-Gm-Message-State: AOAM531QrM8GK3WxRcs9serD9D93li99uhUYDi6Hyo9+zaav/V+WJIeM
QdQogfYv97N/jw9XERh66KQ=
X-Google-Smtp-Source: ABdhPJw8/cG6HXkicieQfvpH6VtMC1UaUMBolJhrc/sba0ZG4pLrnfw3KSAVLEa4wm002/tNL3Klhg==
X-Received: by 2002:a50:c3cf:0:b0:41d:5fc4:7931 with SMTP id i15-20020a50c3cf000000b0041d5fc47931mr2070157edf.244.1649452539767;
Fri, 08 Apr 2022 14:15:39 -0700 (PDT)
Received: from localhost (host-31-196-35-164.business.telecomitalia.it. [31.196.35.164])
by smtp.gmail.com with ESMTPSA id et21-20020a170907295500b006e7f1abe2ccsm5851105ejc.75.2022.04.08.14.15.39
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 08 Apr 2022 14:15:39 -0700 (PDT)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Sat, 9 Apr 2022 00:15:38 +0300
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: ~laurynasl <laurynasl@uber.com>
Cc: ~motiejus/bazel-zig-cc@lists.sr.ht
Subject: Re: [PATCH bazel-zig-cc 0/1] Fix the register parameter in register
toolchain
Message-ID: <20220408211538.srx5swx4reuf4n2x@mtpad.i.jakstys.lt>
References: <164942303327.26005.14403108374611803240-0@git.sr.ht>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
In-Reply-To: <164942303327.26005.14403108374611803240-0@git.sr.ht>
On Fri, Apr 08, 2022 at 01:03:53PM +0000, ~laurynasl wrote:
> Looks like this slipped through the CI. We should think about how to
> catch cases like these.
I think the next step, where you suggested replacing
`--extra_toolchains` with
registering-all-toolchains-and-specifying-the-platforms, would have
helped here?
Once transitioned to platforms, I expect us to stop specifying the
`--extra_toolchains` and only use platform constraints. Then write a
couple of test targets and confirm they are building artifacts for
correct architectures
Transitions can even allow `sh_test` targets, which would run `file` on
the output binary and assert it's architecture. The `ci/test` script
would become even simpler.
> laurynasl (1):
> Fix register toolchain
>
> toolchain/defs.bzl | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied and released v0.6.1. Thank you.
Motiejus
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174])
by mail-b.sr.ht (Postfix) with ESMTPS id D3B0811EF91
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Fri, 15 Apr 2022 14:07:34 +0000 (UTC)
Received: by mail-lj1-f174.google.com with SMTP id o16so9637455ljp.3
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Fri, 15 Apr 2022 07:07:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:subject:message-id:mime-version
:content-disposition;
bh=DYZFEA10ndkjk3Nw/v/IJwhyoiaYK+RyhpqCX8E9dNI=;
b=kz97bojPLS2sAG7la0yMsahi5VXSJkYcstG0UI04sfRhEQj5jeIRzobD01qctJOzrv
Cos5ZTR03J165vE13NM4L8kXu0lO2pwqoPOO4UeZhuQKMIqevuqakIdh47CxpaGU4TEM
83pj+sTmPm4pc5KAJc+86XHUUT8X8/X6nnSNyPLR0SXNyfpZYRFkQdE0UMH6K5ef9uv3
9GPa1s5X5JA5jTxYLvnyc1e5UzT+coNadLBrbZJZXeW83Wm6Q9gcFj59GwE2vBnXBF8p
osDUkSEp1/PuvHe5ywTRsqX7uR28g23kcg2M+Vd5QGrwT8iuE857nS1IGSAmCLv9nuh1
NvcA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:subject:message-id
:mime-version:content-disposition;
bh=DYZFEA10ndkjk3Nw/v/IJwhyoiaYK+RyhpqCX8E9dNI=;
b=6xjSQans+iTR4OYcKHXsnetp3rTPpR21R/3zqmIGZO8WtYwbCKRS9BT5WewQh+zZ/+
WPYmXPY0jvPgDyH6Cx+CbgOWP8RFLZMFgR4F7NazWR3UptDF/o5JR2hRMHdP9xIOD2QY
A+L0A0LEa1ZpTI6YTONrRNCt1d6uWLmm4XyGRQNp2U4gFZ+ObQLLNHhhwjSxrzYhB+Zw
fGaFDdbtH6LMKuuGW59HH38Fh5SXUHL//+VF1xefcJ58Ppl43c4Nnys27W3XHHr+aCK9
TmXANarefB/gWc0wc3vih+AovCMlQ/kStVbfwu1ue1pOLDIKh/C82h2v9PxrpXXPP5nl
EPdw==
X-Gm-Message-State: AOAM532eXbr2h9nepWoQpDHvSDG/w0ZWY/2P5yUQofV9XP8kFrAmyGW4
6PUn6ceAUD4/ei6GK/EPUDfXq8YO14I=
X-Google-Smtp-Source: ABdhPJxY3M4sKfoYu+xn8BNqH5oPR+AUahNkb1tYOVkji8skDNsvMHnycAyZML2oMpWwVYqFSGW9kA==
X-Received: by 2002:a05:651c:154b:b0:24c:7f44:2448 with SMTP id y11-20020a05651c154b00b0024c7f442448mr4446359ljp.129.1650031653191;
Fri, 15 Apr 2022 07:07:33 -0700 (PDT)
Received: from localhost ([88.223.105.24])
by smtp.gmail.com with ESMTPSA id y21-20020a2e7d15000000b0024dab6213cfsm45129ljc.48.2022.04.15.07.07.31
for <~motiejus/bazel-zig-cc@lists.sr.ht>
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 15 Apr 2022 07:07:31 -0700 (PDT)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Fri, 15 Apr 2022 17:07:30 +0300
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Subject: upcoming changes in bazel-zig-cc v0.7
Message-ID: <20220415140730.xpx6sap4yu4bt3ix@mtpad.i.jakstys.lt>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Hi all,
Laurynas rewrote bazel-zig-cc. Now it will support specifying
arch/os/libc via *platforms* alone (provided toolchains are registered).
E.g.
--platforms @zig_sdk//libc_aware/platform:linux_amd64_gnu.2.28
--platforms @zig_sdk//libc_aware/platform:linux_amd64_musl
I intend to merge this on ~Tuesday. There will be (almost) no breaking
changes, but many new ways to use bazel-zig-cc. I am excited about this
release, as now it makes many things "right". Read the README. :)
While updating documentation, I accidentally wrote my mental model on
how `--platforms`, `--toolchains` and constraints interact. If you find
lies there, please let me know, I will un-lie them.
Here are the updated docs; notice they are much longer than the
original:
https://git.sr.ht/~motiejus/bazel-zig-cc/tree/laurynasl_libc/item/README.md?view-rendered
Thanks Laurynai!
Motiejus
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48])
by mail-b.sr.ht (Postfix) with ESMTPS id D2AE611EEFE
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Wed, 20 Apr 2022 09:37:41 +0000 (UTC)
Received: by mail-lf1-f48.google.com with SMTP id w1so1807094lfa.4
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Wed, 20 Apr 2022 02:37:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:subject:message-id:mime-version
:content-disposition;
bh=e/BIiG8y5IC+Nio1ZqSP9xLinXXy6mN1Tuj5Q9vgRJ4=;
b=R6YYS60AyESm13henlgoSEcCgC6fExYNs5liGC6Xai43OaEL+3r2XmZ0jbL4p+fubO
GTYUoqCVI7n4XuB21yCQgHpir1XSC/faRC1bTL6R14HJz7yqhCSNlIxZgaCSJfl4phQO
uyyiyRHMLtExInhl0vIyf+dH5N+tW9apoFR3GAi+LVYeGqDCqDZtT7MOoBJzLGvOXhR2
gjCIsOZvagRo3IxvYv87T/2PwrnHWPsHSnYlHMGVeDl5MnRLmBGAezs3XeI343mPi2hr
20aU1EpDLJ4Z1fZZeJZDXf0D01F9jU4O7IkWILkNEKd/YYNCD9houePRvsyAVIKzS7JE
ydUg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:subject:message-id
:mime-version:content-disposition;
bh=e/BIiG8y5IC+Nio1ZqSP9xLinXXy6mN1Tuj5Q9vgRJ4=;
b=CJaYLURaogIn3HjAmu0vyIlIVRMU53J48fS32VIhvax6GfSyFcg5xrMSgYY06lL5rJ
CRgPC2lPq2DoMDx3li4Kuk9zrMfcHU/ri9xT5nsavxTjt/KwtDVhtbrf56ixqfMNMOGp
prwPYjBPuAyBlIeVUhTQ/HR7lmd6MVK8VUg24ubXmlGFhcOMElJTK4+iVzpqNxTWRKYy
9+cPB91TaGO6fwP+LaqsLa5GS9cUgBGvAgICl4iIKIQ+dOeB1mt41YLyfgHNAaVkwihO
eKXqpSslGlRQQtPgDqerU54PMUfCmTKwCdYM/Q9DMelaUDxbeL7xKAw+4PdkVcs9X/5F
k4cw==
X-Gm-Message-State: AOAM530+qV2Jf95daul3BUlni1Cm8y016QwMs7bQ9jeiHQ4TehGbueMR
MrqtBCzPZfVmyyu3xXYzg1EXyTOhZZg=
X-Google-Smtp-Source: ABdhPJwDJH7o0BLFkci7pYyyQS2lkVpxPUS8QhSaXjtLKDtA2gQGfyj7baifuoui/IZYMESX4qnKfw==
X-Received: by 2002:a05:6512:3d94:b0:471:2436:f8f4 with SMTP id k20-20020a0565123d9400b004712436f8f4mr12131641lfv.441.1650447459162;
Wed, 20 Apr 2022 02:37:39 -0700 (PDT)
Received: from localhost ([88.223.105.24])
by smtp.gmail.com with ESMTPSA id s12-20020ac25fac000000b004435e2e0a08sm1773901lfe.251.2022.04.20.02.37.37
for <~motiejus/bazel-zig-cc@lists.sr.ht>
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Wed, 20 Apr 2022 02:37:38 -0700 (PDT)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Wed, 20 Apr 2022 12:37:36 +0300
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Subject: bazel-zig-cc v0.7.0
Message-ID: <20220420093736.x4hjjpkkkzvjolsa@mtpad.i.jakstys.lt>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Hi all,
I've released bazel-zig-cc v0.7.0. It's a rewrite by laurynasl@ and
major documentation upgrade by myself.
Incompatible changes
--------------------
1. `register_toolchains` renamed to `toolchains`. Before:
load("@bazel-zig-cc//toolchain:defs.bzl", zig_register_toolchains = "register_toolchains")
After:
load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains")
2. `toolchains(register = ...)` was removed. You should be registering
the toolchains directly in the WORKSPACE or via `.bazelrc` (see README).
3. "glibc version autodetection" is removed: the glibc version must now
be always specified.
New Features
------------
1. Now one can specify the libc variant (glibc+version or libc) via
`--platforms` alone. See README.
2. Internal: more examples with multiple architectures, transitions, and
a new "C" test case.
Ecosystem
---------
While testing this internally, we've realized that the new version of
rules_docker[1] is not compatible with the new libc-in-the-platform
feature, since the libc version is *part of the platform now*. Laurynas
will comment in the PR with more details.
Enjoy!
Motiejus
[1]: https://github.com/bazelbuild/rules_docker/pull/1963
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=uber.com header.i=@uber.com
Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173])
by mail-b.sr.ht (Postfix) with ESMTPS id 7F24311EEFE
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Wed, 20 Apr 2022 12:20:37 +0000 (UTC)
Received: by mail-yb1-f173.google.com with SMTP id m132so2520419ybm.4
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Wed, 20 Apr 2022 05:20:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=uber.com; s=google;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to
:cc:content-transfer-encoding;
bh=Si4fflkXFvBbGMHW6tzu8X1ndgXjt2CVYKJ63HXkqsU=;
b=wkLIewIZTdy5Yo2bypHKpzs9BCFUb5hiHPrJzkEX38yMcm6aeQ/uWqtqTFvvLQOrw2
Miirr9R3V7rw73x7zjvtRSP3fh17HtB7rhfTm9yAnnU6/mpnYxlVuPYR7licTwgIoUuA
u2DH3uwNXcNHa7WMa6ZNZ+ENbi/8V2vos5V/Y=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:cc:content-transfer-encoding;
bh=Si4fflkXFvBbGMHW6tzu8X1ndgXjt2CVYKJ63HXkqsU=;
b=OVFWoGoe2wT7Y0FrrnKO8a6RErxwp4AsvBbwuXdqHPIoShi8OnwHfDwo1emuZdrvoT
DAnul7WXATL7b0rBk4Ikdkox+KcZYAob8ND81zOWu1StVevlC9DhIbdAzoZZM5BD0fkO
fOzratZXdyyxzmG/ru1hK/Q2nvYDv3gIsOnvQt6YfXHGN5ezkgSY6+/LWwXD+PL8wJBX
cpjP04Nqd4UZrQxYcdFw0wkmdtmHpr3EyUdeNwtOdjizT+rwRIkzsixsCcjUC/VfVerp
NRaJSvfrOeFG7qZPQ50tHPeFCgitKHkWK2OFPBx7fbvwx4upqugSXEmKpbblp2aJ5ouz
p4qQ==
X-Gm-Message-State: AOAM533kYOYHpPwkBnHl/dTv8qEDuWsJ0AyTeUAFS7AtPzXTG3fRTj46
3wYSTQY19hL8zTy30l1h2TsIt/wBngWYHMwC8Qqd
X-Google-Smtp-Source: ABdhPJxQzRDS8ORw5uj4MePwvOSr0rXhs0nrVKdFp6k3pRFOihTnKNwhaPTLESjIoL1MpCqEhr21SgS/WL31cDfB96w=
X-Received: by 2002:a25:bf86:0:b0:641:4772:923a with SMTP id
l6-20020a25bf86000000b006414772923amr20506048ybk.265.1650457236952; Wed, 20
Apr 2022 05:20:36 -0700 (PDT)
MIME-Version: 1.0
References: <20220420093736.x4hjjpkkkzvjolsa@mtpad.i.jakstys.lt>
In-Reply-To: <20220420093736.x4hjjpkkkzvjolsa@mtpad.i.jakstys.lt>
From: Laurynas Lubys <laurynasl@uber.com>
Date: Wed, 20 Apr 2022 15:20:26 +0300
Message-ID: <CAG09j4-XZtiP-zs6GGW=5uZrN2OZ2DcX+nD58Odpfgbc85JP8w@mail.gmail.com>
Subject: Re: bazel-zig-cc v0.7.0
To: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <motiejus@jakstys.lt>
Cc: ~motiejus/bazel-zig-cc@lists.sr.ht
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Regarding rules_docker:
In 0.23.0, rules_docker added transitions based on the architecture
and operating system specified on the container_image. The platform
transition is "hard-coded" in a sense where it will use a specific
platform that only includes the os and cpu constraints. This means
that it is not possible to provide a platform which includes a libc
version. There seem to still be some discussion on how this should
best be solved in rules_docker.
Cheers,
Laurynas
On Wed, Apr 20, 2022 at 12:37 PM Motiejus Jak=C5=A1tys <motiejus@jakstys.lt=
> wrote:
>
> Hi all,
>
> I've released bazel-zig-cc v0.7.0. It's a rewrite by laurynasl@ and
> major documentation upgrade by myself.
>
> Incompatible changes
> --------------------
>
> 1. `register_toolchains` renamed to `toolchains`. Before:
>
> load("@bazel-zig-cc//toolchain:defs.bzl", zig_register_toolchains=
=3D "register_toolchains")
>
> After:
>
> load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains =3D "too=
lchains")
>
> 2. `toolchains(register =3D ...)` was removed. You should be registering
> the toolchains directly in the WORKSPACE or via `.bazelrc` (see READM=
E).
>
> 3. "glibc version autodetection" is removed: the glibc version must now
> be always specified.
>
> New Features
> ------------
>
> 1. Now one can specify the libc variant (glibc+version or libc) via
> `--platforms` alone. See README.
>
> 2. Internal: more examples with multiple architectures, transitions, and
> a new "C" test case.
>
> Ecosystem
> ---------
>
> While testing this internally, we've realized that the new version of
> rules_docker[1] is not compatible with the new libc-in-the-platform
> feature, since the libc version is *part of the platform now*. Laurynas
> will comment in the PR with more details.
>
> Enjoy!
> Motiejus
>
> [1]: https://github.com/bazelbuild/rules_docker/pull/1963
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173])
by mail-b.sr.ht (Postfix) with ESMTPS id 2FFBD11EFC9
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Thu, 5 May 2022 12:24:31 +0000 (UTC)
Received: by mail-lj1-f173.google.com with SMTP id 4so5354824ljw.11
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Thu, 05 May 2022 05:24:31 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:subject:message-id:mime-version
:content-disposition;
bh=DPz95s72paZNhFzkhCmu5Co2WHEUgIjoRgB9imbXDeo=;
b=d0IqLFnfdu8dngOJZTw07JvW5LT9HrfCoXXQqr0Lb0L1Tc5kzU5QdBLcTo7ogw8/8C
8tsoVV0/FS1pmY6c5LvRPpdNeD/VJ1PxYbjLdw8Ffzb1BKTEHdonfT3+mV+Q233sTE52
QqP7G7kAkYrfRKrqahe7fPmZmx1qxL+VxSKfXqRO4bOIMwIqth41eLqPsexubcM3c3Qg
Hvd4lYHB7RtFnD1eXWNwlQm5Qu04CwlveRYMyYghsBIexA5amoFhozj2Yf6WdpImEjdR
FRullx436PFfMGdDuTNJpGakPgBLiy0ay6FBmQ0LEaPSdRFeS+JNtkTqQ2e0b11gC5fS
lHhA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:subject:message-id
:mime-version:content-disposition;
bh=DPz95s72paZNhFzkhCmu5Co2WHEUgIjoRgB9imbXDeo=;
b=QeqwXbc7RcTsP3r0JpOYZMzFysfTlb0oH40S3h1LQn68iLbTA5qEDg9RKF0zc8zxGv
037aAXtxGL7yCY3yDLJv0Fmtbbfw7CV8A9hG73TayW8POYCYyQbzeAiSHEfSD6HjS2sp
2siat9WQza+oyVpRjF1bc+dr/a+2L97s9JX04Hv3UvcOB0XkUXlCzH2eOeyzFF/6Fp2Q
VOaxUVtR73Wj2e9IEaCxz1Ssg0VVsVsTaRh4Hs5OwqZm3TUTgC3xIz0U2+kcYpoZO8XR
ftTcTOP9c2ZXoTTVF1NFiHqC1ct31iRInlfQVUeZU918UWiAE84LC3q2aF4krgqH+jAV
2fZQ==
X-Gm-Message-State: AOAM532917vUSn7ZJjPjTaQM0kwj5Kkg+mj61IDCIpZNLHKII2ybEjsg
mZQG5kTkYaZHfOb6s4NQ4f4ZelB/NbM=
X-Google-Smtp-Source: ABdhPJxymRE2fMyZuBWxilRsv6/J66rbJWyL0qqetIRfxJvnaTUTn9AwJzs159Bjb6wyYYoG4R++9w==
X-Received: by 2002:a05:651c:399:b0:24f:18d:5bbd with SMTP id e25-20020a05651c039900b0024f018d5bbdmr15972991ljp.481.1651753468442;
Thu, 05 May 2022 05:24:28 -0700 (PDT)
Received: from localhost (h6.n.technopolis.lt. [194.157.155.165])
by smtp.gmail.com with ESMTPSA id k30-20020a0565123d9e00b0047255d2116asm198317lfv.153.2022.05.05.05.24.27
for <~motiejus/bazel-zig-cc@lists.sr.ht>
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 05 May 2022 05:24:27 -0700 (PDT)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Thu, 5 May 2022 15:24:25 +0300
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Subject: bazel-zig-cc v0.7.1
Message-ID: <20220505122425.ipd2p6kykd7iph7b@mtpad.i.jakstys.lt>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Hi everyone,
I just cut bazel-zig-cc v0.7.1, which adds a workaround for the infamous
libc linking problem:
net(.text): relocation target __errno_location not defined
net(.text): relocation target getaddrinfo not defined
<...>
Read about it, as well as related issues, in this github summary[1].
Many thanks to Andrew Kelley and Ken Micklas for working on it!
What is the cause? Because `zig cc` adds `--gc-sections` to the `ld.lld`
flags, which does not play well with cgo. So the workaround adds
`--no-gc-sections` to the linker flags for the time being.
Motiejus
[1]: https://github.com/ziglang/zig/pull/11577
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=gmail.com header.i=@gmail.com
Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180])
by mail-b.sr.ht (Postfix) with ESMTPS id 1CB2111EE04
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Tue, 17 May 2022 12:10:08 +0000 (UTC)
Received: by mail-pg1-f180.google.com with SMTP id s68so231212pgb.13
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Tue, 17 May 2022 05:10:08 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20210112;
h=sender:date:from:to:subject:message-id:mime-version
:content-disposition;
bh=IWaI4txxzUHCf/h00uDh3KfvJXVISgwnHPxQJz2ibfs=;
b=hUk9qnSPHnqyrA649fdnHmNzD1KYWH4fMC5iKz11VtaGHA/RUygB3BJEfHD5Oi//Rk
wxgyuAYJwr/TVaM0h59WgH+D+KdYYfCBJUO6FGzjt+9plpGcx472/jtd2J26zO1cePYI
vUD1YXTPYm8W87Ny+fb+uAggwd9gXZQQHRaPFcn27xeoYnunML+aQm96ZBtlkhscOZpm
H+7nQ/qGzeexY90t/P2tf970Ahpexdd5y2XXZyzeY+MZz4vkevUOwkg+aiO4hgsjISn9
m58jrnEMe6qPsD9q0UcGfMfaeD/Wv1m1C9jtSDrAv0c84dDUJVkUUpsKl0+1J3FBJ2A4
iplg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:sender:date:from:to:subject:message-id
:mime-version:content-disposition;
bh=IWaI4txxzUHCf/h00uDh3KfvJXVISgwnHPxQJz2ibfs=;
b=wIbUgTGC2YcCkUB9qFfBrMHKDlMWTurA6w+Dia70qOaHYuzmyQGWk/69k8WbLZb8N1
SA5y9MAVVzrXEGPSw4n+Lf84Aiccxk1jwVE6vRf4I+e1BD67QfiCwJZKpSVIrEaB5xWK
R5k+vlmCg4ZT03xOhgfDZOXu3FbIFmJUQoBkObOmu20elI+d/iwtZ8/BVBu6itZRX6uC
R681fw7R3XD5Mvn3XRupV+V3jduoknSyGnmkWxfXT5eHU+OxdlqDehtKz3HQF6nD1Xxl
+9CYsIMOmSmPYKZZ46TsgNUZF9E9/zAIcfoHfopsw3dEcce5A/bQMs7xAR2F/U7Ss2S4
fn3A==
X-Gm-Message-State: AOAM532SuC4WNL5JVBOlC/qInJ4lDNki6O/NXhM3P7YLGWSVq12jYxM8
sL7fDNuSPX+WAknFIy36zaXvVmXZ2jU=
X-Google-Smtp-Source: ABdhPJw1d1EB0C+hU/YWdovM+HwBDdL306zXpzTdd+Fv0nkRxrtXhqJPl2JIbmaSeIHlD2iDHVlMVw==
X-Received: by 2002:a63:1b62:0:b0:3f2:5438:e553 with SMTP id b34-20020a631b62000000b003f25438e553mr11729797pgm.4.1652789406870;
Tue, 17 May 2022 05:10:06 -0700 (PDT)
Received: from localhost (88-119-96-125.static.zebra.lt. [88.119.96.125])
by smtp.gmail.com with ESMTPSA id s10-20020a17090ae68a00b001da3920d985sm1502926pjy.12.2022.05.17.05.10.05
for <~motiejus/bazel-zig-cc@lists.sr.ht>
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Tue, 17 May 2022 05:10:06 -0700 (PDT)
Sender: =?UTF-8?Q?Motiejus_Jak=C5=A1tys?= <desired.mta@gmail.com>
Date: Tue, 17 May 2022 15:10:02 +0300
From: Motiejus =?utf-8?Q?Jak=C5=A1tys?= <motiejus@jakstys.lt>
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Subject: bazel-zig-cc v0.7.2
Message-ID: <20220517121002.f4tnfcmgvk4nwbxe@mtpad.i.jakstys.lt>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Hi all,
It was a long time ago since the last Zig SDK update. I just released
v0.7.2, which updates the zig to tonight's build
zig-0.10.0-dev.2252+a4369918b, along with bazel-zig-cc's test
dependencies (rules_go, bazel-gazelle, golang).
Also, I removed many prehistorical zig-sdk versions from the
dl.jakstys.lt mirror and left only the ones referenced by v0.7.1 and
v0.7.2. If your build broke as a result, it's a good time to reconsider
hosting zig sdk yourself.
Regards,
Motiejus
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=hahn.graphics header.i=@hahn.graphics
Received: from mail.hahn.graphics (poliwhirl.hahn.graphics [139.162.183.182])
by mail-b.sr.ht (Postfix) with ESMTPS id 2B1C411EEE1
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Fri, 20 May 2022 15:03:15 +0000 (UTC)
From: Fabian Hahn <fabian@hahn.graphics>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hahn.graphics;
s=mail; t=1653058987;
bh=WuiZ7bx3eBUnfp4Rd/cpDWbrJ2vFH6FtT4n1wRwaYCE=;
h=From:To:Cc:Subject;
b=jZdvefn6XZoUkBiHgUFQFi/ORKH0hSpl6MW78FxvJ5uwpvv5m9icZF3zbWeJvwLUP
Bb2aPWb78td0ycMl+ZCvW3ZdCw08+dMNduegQZnryNBuGyjSvC+DUS7RCNPRYhDu3d
vuMaTddVgNaHTTp6R3FBCAjpiuEqgmi9eedchEgc=
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Cc: Fabian Hahn <fabian@hahn.graphics>
Subject: [PATCH bazel-zig-cc 0/3] Windows support
Date: Fri, 20 May 2022 16:02:29 +0100
Message-Id: <20220520150232.15515-1-fabian@hahn.graphics>
Hello there,
First of all, thank you for this great project! I was always intrigued
by zig's C/C++ compilation abilities but wasn't too keen on adopting it
as a build system. Being able to use zig as a bazel toolchain using this
project is incredible and exactly the way I always wanted to use zig.
My intended use case for bazel-zig-cc was to enable cross compilation
between the two supported platforms Linux and Windows in my project [1].
To this end, I started looking into extending bazel-zig-cc with Windows
support both as a host and target system. The attached three commits in
made this work and successfully allowed me to cross compile all of my
cc_binary targets between Linux and Windows using zig cc. That said,
they do not actually depend on each other and can be used individually.
I hope others might find them useful, too, and would like to ask you to
consider accepting them into the mainline of the project.
Best,
Fabian
[1] https://github.com/FabianHahn/shoveler
Fabian Hahn (3):
added windows host support
added support for Windows targets
added platform constraint setting for selecting if zig cc is used
toolchain/BUILD.sdk.bazel | 1 +
toolchain/defs.bzl | 58 +++++++++++++++++++++++------
toolchain/platform/BUILD | 15 ++++++++
toolchain/platform/defs.bzl | 8 +++-
toolchain/private/BUILD.sdk.bazel | 1 +
toolchain/private/cc_toolchains.bzl | 6 +--
toolchain/private/defs.bzl | 27 +++++++++++++-
7 files changed, 99 insertions(+), 17 deletions(-)
--
2.17.1
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=hahn.graphics header.i=@hahn.graphics
Received: from mail.hahn.graphics (poliwhirl.hahn.graphics [139.162.183.182])
by mail-b.sr.ht (Postfix) with ESMTPS id 6FE2611EEFC
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Fri, 20 May 2022 15:03:15 +0000 (UTC)
From: Fabian Hahn <fabian@hahn.graphics>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hahn.graphics;
s=mail; t=1653058987;
bh=M18VNogtyHCImW8/WKI5DKn27fgQ/L/hFUyDeVCjvPo=;
h=From:To:Cc:Subject:In-Reply-To:References;
b=Z+nrbSoBHrmUF6zWjz0RpE0+aDbrYMRKtNUZMcoEn82Dq775R2ycqRoqGJmo2ly7t
zZ6zK+VTlfGykAd5BffWOtp3ofuWF8ZA3fkQoy9PIYLu/uyN4ZC+WVTSK+UznjkF6L
qmP+nvSyd9Qe9ZttsqkfBoGT7V369XNjEoGClrBs=
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Cc: Fabian Hahn <fabian@hahn.graphics>
Subject: [PATCH bazel-zig-cc 1/3] added windows host support
Date: Fri, 20 May 2022 16:02:30 +0100
Message-Id: <20220520150232.15515-2-fabian@hahn.graphics>
In-Reply-To: <20220520150232.15515-1-fabian@hahn.graphics>
References: <20220520150232.15515-1-fabian@hahn.graphics>
---
This commit adds support for Windows as a host system. For example, given
an existing bazel project on Windows, this commit enables cross
compilation to other supported target platforms of bazel-zig-cc such as
Linux. I've successfully used it to cross compile a Linux cc_binary from a
Windows machine and validated that it works correctly by copying it to a
Linux box and launching it there.
Apart from downloading the correct zig SDK version on Windows, the main
crux here was to actually make all of the zig tools properly executable.
In order for the wrapper script to be executable, it needs to be a batch
script with the proper extension instead of bash. Further, the actual
zig binary itself is called zig.exe instead of just zig on Windows.
toolchain/BUILD.sdk.bazel | 1 +
toolchain/defs.bzl | 58 +++++++++++++++++++++++------
toolchain/private/BUILD.sdk.bazel | 1 +
toolchain/private/cc_toolchains.bzl | 6 +--
toolchain/private/defs.bzl | 8 +++-
5 files changed, 58 insertions(+), 16 deletions(-)
diff --git a/toolchain/BUILD.sdk.bazel b/toolchain/BUILD.sdk.bazel
index ada3e5d..e1505b1 100644
--- a/toolchain/BUILD.sdk.bazel
+++ b/toolchain/BUILD.sdk.bazel
@@ -7,6 +7,7 @@ package(
declare_files(
+ os = {os},
zig_include_root = {zig_include_root},
)
diff --git a/toolchain/defs.bzl b/toolchain/defs.bzl
index 9ab4e88..d334aca 100644
--- a/toolchain/defs.bzl
+++ b/toolchain/defs.bzl
@@ -1,6 +1,6 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "read_user_netrc", "use_netrc")
-load("@bazel-zig-cc//toolchain/private:defs.bzl", "DEFAULT_INCLUDE_DIRECTORIES", "ZIG_TOOL_PATH", "target_structs")
+load("@bazel-zig-cc//toolchain/private:defs.bzl", "DEFAULT_INCLUDE_DIRECTORIES", "zig_tool_path", "target_structs")
_fcntl_map = """
GLIBC_2.2.5 {
@@ -16,21 +16,21 @@ __asm__(".symver fcntl64, fcntl@GLIBC_2.2.5");
"""
# Official recommended version. Should use this when we have a usable release.
-URL_FORMAT_RELEASE = "https://ziglang.org/download/{version}/zig-{host_platform}-{version}.tar.xz"
+URL_FORMAT_RELEASE = "https://ziglang.org/download/{version}/zig-{host_platform}-{version}.{ext}"
# Caution: nightly releases are purged from ziglang.org after ~90 days. A real
# solution would be to allow the downstream project specify their own mirrors.
# This is explained in
# https://sr.ht/~motiejus/bazel-zig-cc/#alternative-download-urls and is
# awaiting my attention or your contribution.
-URL_FORMAT_NIGHTLY = "https://ziglang.org/builds/zig-{host_platform}-{version}.tar.xz"
+URL_FORMAT_NIGHTLY = "https://ziglang.org/builds/zig-{host_platform}-{version}.{ext}"
# Author's mirror that doesn't purge the nightlies so aggressively. I will be
# cleaning those up manually only after the artifacts are not in use for many
# months in bazel-zig-cc. dl.jakstys.lt is a small x86_64 server with an NVMe
# drive sitting in my home closet on a 1GB/s symmetric residential connection,
# which, as of writing, has been quite reliable.
-URL_FORMAT_JAKSTYS = "https://dl.jakstys.lt/zig/zig-{host_platform}-{version}.tar.xz"
+URL_FORMAT_JAKSTYS = "https://dl.jakstys.lt/zig/zig-{host_platform}-{version}.{ext}"
_VERSION = "0.10.0-dev.2252+a4369918b"
@@ -39,12 +39,22 @@ _HOST_PLATFORM_SHA256 = {
"linux-x86_64": "1d3c3769eba85a4334c93a3cfa35ad0ef914dd8cf9fd502802004c6908f5370c",
"macos-aarch64": "ab46e7499e5bd7b6d6ff2ac331e1a4aa875a01b270dc40306bc29dbaf216fccf",
"macos-x86_64": "fb213f996bcab805839e401292c42a92b63cd97deb1631e31bd61f534b7f6b1c",
+ "windows-x86_64": "14e43a64026512161f3d6201d8972a28f0508da2782c16e980f2ffa3bb7e6720",
+}
+
+_HOST_PLATFORM_EXT = {
+ "linux-aarch64": "tar.xz",
+ "linux-x86_64": "tar.xz",
+ "macos-aarch64": "tar.xz",
+ "macos-x86_64": "tar.xz",
+ "windows-x86_64": "zip",
}
def toolchains(
version = _VERSION,
url_formats = [URL_FORMAT_NIGHTLY, URL_FORMAT_JAKSTYS],
- host_platform_sha256 = _HOST_PLATFORM_SHA256):
+ host_platform_sha256 = _HOST_PLATFORM_SHA256,
+ host_platform_ext = _HOST_PLATFORM_EXT):
"""
Download zig toolchain and declare bazel toolchains.
The platforms are not registered automatically, that should be done by
@@ -56,11 +66,13 @@ def toolchains(
version = version,
url_formats = url_formats,
host_platform_sha256 = host_platform_sha256,
+ host_platform_ext = host_platform_ext,
host_platform_include_root = {
"linux-aarch64": "lib/zig/",
"linux-x86_64": "lib/",
"macos-aarch64": "lib/zig/",
"macos-x86_64": "lib/zig/",
+ "windows-x86_64": "lib/",
},
)
@@ -81,6 +93,10 @@ export ZIG_GLOBAL_CACHE_DIR=$ZIG_LOCAL_CACHE_DIR
exec "{zig}" "{zig_tool}" "$@"
"""
+ZIG_TOOL_WRAPPER_WINDOWS = """@echo off
+"{zig}" "{zig_tool}" %*
+"""
+
_ZIG_TOOLS = [
"c++",
"cc",
@@ -103,11 +119,16 @@ def _zig_repository_impl(repository_ctx):
if os.startswith("mac os"):
os = "macos"
+ if os.startswith("windows"):
+ os = "windows"
+
host_platform = "{}-{}".format(os, arch)
zig_include_root = repository_ctx.attr.host_platform_include_root[host_platform]
zig_sha256 = repository_ctx.attr.host_platform_sha256[host_platform]
+ zig_ext = repository_ctx.attr.host_platform_ext[host_platform]
format_vars = {
+ "ext": zig_ext,
"version": repository_ctx.attr.version,
"host_platform": host_platform,
}
@@ -121,12 +142,19 @@ def _zig_repository_impl(repository_ctx):
)
for zig_tool in _ZIG_TOOLS:
- repository_ctx.file(
- ZIG_TOOL_PATH.format(zig_tool = zig_tool),
- ZIG_TOOL_WRAPPER.format(
- zig = str(repository_ctx.path("zig")),
+ zig_tool_wrapper = ZIG_TOOL_WRAPPER.format(
+ zig = str(repository_ctx.path("zig")),
+ zig_tool = zig_tool,
+ )
+ if os == "windows":
+ zig_tool_wrapper = ZIG_TOOL_WRAPPER_WINDOWS.format(
+ zig = str(repository_ctx.path("zig")).replace('/', '\\') + ".exe",
zig_tool = zig_tool,
- ),
+ )
+
+ repository_ctx.file(
+ zig_tool_path(os).format(zig_tool = zig_tool),
+ zig_tool_wrapper,
)
repository_ctx.file(
@@ -157,6 +185,7 @@ def _zig_repository_impl(repository_ctx):
executable = False,
substitutions = {
"{absolute_path}": _quote(str(repository_ctx.path(""))),
+ "{os}": _quote(os),
"{zig_include_root}": _quote(zig_include_root),
},
)
@@ -167,6 +196,7 @@ zig_repository = repository_rule(
"host_platform_sha256": attr.string_dict(),
"url_formats": attr.string_list(allow_empty = False),
"host_platform_include_root": attr.string_dict(),
+ "host_platform_ext": attr.string_dict(),
},
implementation = _zig_repository_impl,
)
@@ -175,9 +205,13 @@ def filegroup(name, **kwargs):
native.filegroup(name = name, **kwargs)
return ":" + name
-def declare_files(zig_include_root):
+def declare_files(os, zig_include_root):
filegroup(name = "empty")
- native.exports_files(["zig"], visibility = ["//visibility:public"])
+ if os == "windows":
+ native.exports_files(["zig.exe"], visibility = ["//visibility:public"])
+ native.alias(name = "zig", actual = ":zig.exe")
+ else:
+ native.exports_files(["zig"], visibility = ["//visibility:public"])
filegroup(name = "lib/std", srcs = native.glob(["lib/std/**"]))
lazy_filegroups = {}
diff --git a/toolchain/private/BUILD.sdk.bazel b/toolchain/private/BUILD.sdk.bazel
index 39a6a93..3e7c23e 100644
--- a/toolchain/private/BUILD.sdk.bazel
+++ b/toolchain/private/BUILD.sdk.bazel
@@ -1,6 +1,7 @@
load("@bazel-zig-cc//toolchain/private:cc_toolchains.bzl", "declare_cc_toolchains")
declare_cc_toolchains(
+ os = {os},
absolute_path = {absolute_path},
zig_include_root = {zig_include_root},
)
diff --git a/toolchain/private/cc_toolchains.bzl b/toolchain/private/cc_toolchains.bzl
index 64e99f1..a0c7da0 100644
--- a/toolchain/private/cc_toolchains.bzl
+++ b/toolchain/private/cc_toolchains.bzl
@@ -1,4 +1,4 @@
-load(":defs.bzl", "DEFAULT_INCLUDE_DIRECTORIES", "ZIG_TOOL_PATH", "target_structs")
+load(":defs.bzl", "DEFAULT_INCLUDE_DIRECTORIES", "zig_tool_path", "target_structs")
load("@bazel-zig-cc//toolchain:zig_toolchain.bzl", "zig_cc_toolchain_config")
DEFAULT_TOOL_PATHS = {
@@ -11,7 +11,7 @@ DEFAULT_TOOL_PATHS = {
"strip": "/usr/bin/false",
}.items()
-def declare_cc_toolchains(absolute_path, zig_include_root):
+def declare_cc_toolchains(os, absolute_path, zig_include_root):
for target_config in target_structs():
gotarget = target_config.gotarget
zigtarget = target_config.zigtarget
@@ -28,7 +28,7 @@ def declare_cc_toolchains(absolute_path, zig_include_root):
if path[0] == "/":
absolute_tool_paths[name] = path
continue
- tool_path = ZIG_TOOL_PATH.format(zig_tool = path)
+ tool_path = zig_tool_path(os).format(zig_tool = path)
absolute_tool_paths[name] = "%s/%s" % (absolute_path, tool_path)
linkopts = target_config.linkopts
diff --git a/toolchain/private/defs.bzl b/toolchain/private/defs.bzl
index 6059065..6804104 100644
--- a/toolchain/private/defs.bzl
+++ b/toolchain/private/defs.bzl
@@ -4,7 +4,7 @@ DEFAULT_INCLUDE_DIRECTORIES = [
"libcxxabi/include",
]
-ZIG_TOOL_PATH = "tools/{zig_tool}"
+_ZIG_TOOL_PATH = "tools/{zig_tool}"
# Zig supports even older glibcs than defined below, but we have tested only
# down to 2.17.
@@ -30,6 +30,12 @@ _GLIBCS = [
LIBCS = ["musl"] + ["gnu.{}".format(glibc) for glibc in _GLIBCS]
+def zig_tool_path(os):
+ if os == "windows":
+ return _ZIG_TOOL_PATH + ".bat"
+ else:
+ return _ZIG_TOOL_PATH
+
def target_structs():
ret = []
for zigcpu, gocpu in (("x86_64", "amd64"), ("aarch64", "arm64")):
--
2.17.1
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=hahn.graphics header.i=@hahn.graphics
Received: from mail.hahn.graphics (poliwhirl.hahn.graphics [139.162.183.182])
by mail-b.sr.ht (Postfix) with ESMTPS id 6BB9911EF8C
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Fri, 20 May 2022 15:03:16 +0000 (UTC)
From: Fabian Hahn <fabian@hahn.graphics>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hahn.graphics;
s=mail; t=1653058987;
bh=WZJtonkY6mfvO0efhXOOXo/ZME5GMA+oRkCH2uKaaQo=;
h=From:To:Cc:Subject:In-Reply-To:References;
b=cuL9Mm4St/jFVu4mhTXv40bFFT5F/3ACSwACloJcCYn22TWGsngPi33HO0w8W54uw
4uqY2jBtwvQsGrBqG8XJ6Me1/9Jc0sBNQm1N++C6jLc2OJPRk7rBqENu3pHTdWg8d8
AtSpdb1Y56XtoICP66NYxbP+DK9G6xa1dFYF5EYU=
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Cc: Fabian Hahn <fabian@hahn.graphics>
Subject: [PATCH bazel-zig-cc 2/3] added support for Windows targets
Date: Fri, 20 May 2022 16:02:31 +0100
Message-Id: <20220520150232.15515-3-fabian@hahn.graphics>
In-Reply-To: <20220520150232.15515-1-fabian@hahn.graphics>
References: <20220520150232.15515-1-fabian@hahn.graphics>
---
This commit adds support for Windows targets to bazel-zig-cc by
registering the appropriate toolchains and platforms for it. I've
validated this by building a cc_binary on Linux targeting
the windows_amd64 platform/toolchain combination, copying the resulting
binary to a Windows box and successfully executing it there. I was also
able to run the resulting binary under wine.
One thing to note is that even though cross compilation builds work
completely fine, the resulting build outputs are named .a for static
libraries (instead of .lib), .so for dynamic libraries (instead of
.dll), and have no extension for executables (instead of .exe). I tried
to find out why this is but unfortunately couldn't figure it out. That
said, the resulting binaries work completely fine.
toolchain/platform/defs.bzl | 7 ++++++-
toolchain/private/defs.bzl | 19 +++++++++++++++++++
2 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/toolchain/platform/defs.bzl b/toolchain/platform/defs.bzl
index cf42191..07e69a6 100644
--- a/toolchain/platform/defs.bzl
+++ b/toolchain/platform/defs.bzl
@@ -1,11 +1,16 @@
load("@bazel-zig-cc//toolchain/private:defs.bzl", "LIBCS")
_CPUS = (("x86_64", "amd64"), ("aarch64", "arm64"))
+_OS = {
+ "linux": ["linux"],
+ "macos": ["macos", "darwin"],
+ "windows": ["windows"],
+}
def declare_platforms():
# create @zig_sdk//{os}_{arch}_platform entries with zig and go conventions
for zigcpu, gocpu in _CPUS:
- for bzlos, oss in {"linux": ["linux"], "macos": ["macos", "darwin"]}.items():
+ for bzlos, oss in _OS.items():
for os in oss:
declare_platform(gocpu, zigcpu, bzlos, os)
diff --git a/toolchain/private/defs.bzl b/toolchain/private/defs.bzl
index 6804104..2ba61f7 100644
--- a/toolchain/private/defs.bzl
+++ b/toolchain/private/defs.bzl
@@ -40,6 +40,7 @@ def target_structs():
ret = []
for zigcpu, gocpu in (("x86_64", "amd64"), ("aarch64", "arm64")):
ret.append(_target_darwin(gocpu, zigcpu))
+ ret.append(_target_windows(gocpu, zigcpu))
ret.append(_target_linux_musl(gocpu, zigcpu))
for glibc in _GLIBCS:
ret.append(_target_linux_gnu(gocpu, zigcpu, glibc))
@@ -69,6 +70,24 @@ def _target_darwin(gocpu, zigcpu):
tool_paths = {"ld": "ld64.lld"},
)
+def _target_windows(gocpu, zigcpu):
+ return struct(
+ gotarget = "windows_{}".format(gocpu),
+ zigtarget = "{}-windows-gnu".format(zigcpu),
+ includes = [
+ "libunwind/include",
+ "libc/include/any-windows-any",
+ ],
+ linkopts = [],
+ copts = [],
+ bazel_target_cpu = "x64_windows",
+ constraint_values = [
+ "@platforms//os:windows",
+ "@platforms//cpu:{}".format(zigcpu),
+ ],
+ tool_paths = {"ld": "ld64.lld"},
+ )
+
def _target_linux_gnu(gocpu, zigcpu, glibc_version):
glibc_suffix = "gnu.{}".format(glibc_version)
--
2.17.1
From MAILER-DAEMON Mon Apr 24 14:05:40 2023
Authentication-Results: mail-b.sr.ht; dkim=pass header.d=hahn.graphics header.i=@hahn.graphics
Received: from mail.hahn.graphics (poliwhirl.hahn.graphics [139.162.183.182])
by mail-b.sr.ht (Postfix) with ESMTPS id 21BA211EEE1
for <~motiejus/bazel-zig-cc@lists.sr.ht>; Fri, 20 May 2022 15:03:21 +0000 (UTC)
From: Fabian Hahn <fabian@hahn.graphics>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=hahn.graphics;
s=mail; t=1653058987;
bh=1hc8pt5ADYckXmmdbUi2ZXn7H2S1yVLYeTI2hZhiaD4=;
h=From:To:Cc:Subject:In-Reply-To:References;
b=bXSn8NEfNw2YQI/C50iXZXvJMPS/lRoFLfT05y3LpzsvyWkYdgJUVuqTGDnL8H1Kq
W0KSLQ2d+VMlbXIhFEhE+SlGiJGQMfHxZDLsWWeMmdm9j+vJtPBUFTzYCD+xHCtpu/
gT4Glnq13cT1HcyWbt7qM2AAxDK7fyxM8JEbsBhI=
To: ~motiejus/bazel-zig-cc@lists.sr.ht
Cc: Fabian Hahn <fabian@hahn.graphics>
Subject: [PATCH bazel-zig-cc 3/3] added platform constraint setting for selecting if zig cc is used
Date: Fri, 20 May 2022 16:02:32 +0100
Message-Id: <20220520150232.15515-4-fabian@hahn.graphics>
In-Reply-To: <20220520150232.15515-1-fabian@hahn.graphics>
References: <20220520150232.15515-1-fabian@hahn.graphics>
---
This commit adds a constraint_setting that can be used to select()
between builds with and without zig cc. The reason I added this is
because I found that selecting on @bazel_tools//platforms:windows is not
enough for Windows builds since that constraint value alone will match
both native builds using the MSVC compiler as well as builds using zig
cc. The problem arises when passing custom compiler on linker flags that
differ in syntax between MSVC and zig's clang format. For example, to
link the gdi32 system library on Windows MSVC expects the argument
"-DEFAULTLIB:gdi32.lib". However, with zig cc this needs to be "-lgdi32"
instead. Having the additional constraint setting for the bazel-zig-cc
platforms allows you to define more specific config settings such as:
config_setting(
name = "windows",
constraint_values = [
"@bazel_tools//platforms:windows",
"@zig_sdk//platform:zig_cc_disabled",
],
)
config_setting(
name = "windows_zig",
constraint_values = [
"@bazel_tools//platforms:windows",
"@zig_sdk//platform:zig_cc_enabled",
],
)
This can then be used to switch between linker options as follows:
cc_binary(
# [...]
linkopts = select({
":windows": ["-DEFAULTLIB:gdi32.lib"],
":windows_zig": ["-lgdi32"],
}),
)
toolchain/platform/BUILD | 15 +++++++++++++++
toolchain/platform/defs.bzl | 1 +
2 files changed, 16 insertions(+)
diff --git a/toolchain/platform/BUILD b/toolchain/platform/BUILD
index f43b852..807ac3c 100644
--- a/toolchain/platform/BUILD
+++ b/toolchain/platform/BUILD
@@ -4,4 +4,19 @@ package(
default_visibility = ["//visibility:public"],
)
+constraint_setting(
+ name = "using_zig_cc",
+ default_constraint_value = "zig_cc_disabled",
+)
+
+constraint_value(
+ name = "zig_cc_disabled",
+ constraint_setting = "using_zig_cc",
+)