• Re: Architecture variants for Debian / Ubuntu (3/5)

    From Michael Hudson-Doyle@1:229/2 to Guillem Jover on Thu Nov 2 16:50:01 2023
    [continued from previous message]

    to src:dpkg to support variant ISAs as a thing:

    * add get_host_arch_isa() to Dpkg::Arch
    * dpkg-gencontrol records DEB_HOST_ARCH_ISA into DEBIAN/control as ArchitectureIsa
    * dpkg-architecture emits DEB_HOST_ARCH_ISA and grows --host-arch-isa flag
    * dpkg-buildpackage passes --host-arch-isa to dpkg-architecture
    * dpkg-genchanges should record the ISA in the changes file somehow I
    guess?
    * dpkg-deb records the ISA in the file name

    Have I missed anything? (Hmm does anything need to reject unknown values
    found in DEB_HOST_ARCH_ISA / --host-arch-isa? Probably...)

    Conceptually slightly separately, it might make sense to add a build
    "feature" to Dpkg::Vendor::Debian to allow setting -march (and -mtune?)

    Then when we want to add support to an ISA, we add a little thing to set_build_features (in either Vendor::Debian or Vendor::Ubuntu or wherever) that maps get_host_arch_isa() to values for the march-influencing feature.

    Cheers,
    mwh

    <div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, 31 Oct 2023 at 09:21, Guillem Jover &lt;<a href="mailto:guillem@debian.org" target="_blank">guillem@debian.org</a>&gt; wrote:<br></div><
    blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi!<br>

    On Thu, 2023-09-21 at 14:43:42 +1200, Michael Hudson-Doyle wrote:<br>
    &gt; Thanks for the considered response. And sorry for the very slow reply.<br>

    Idem! :)<br>

    &gt; On Wed, 6 Sept 2023 at 21:27, Guillem Jover wrote:<br>
    &gt; &gt; I&#39;m not sure I entirely agree with the requirements you set forth<br>
    &gt; &gt; though:<br>
    &gt; &gt;<br>
    &gt; &gt;  - I think such optimized builds might need to be done with &quot;special<br>
    &gt; &gt;    toolchains&quot; (these could simply be wrappers over the host compiler<br>
    &gt; &gt;    passing the appropriate flags via command-line or via specs or<br>
    &gt; &gt;    similar, not necessarily full blown toolchains), passing these via<br>
    &gt; &gt;    something like dpkg-buildflags seems currently unreliable, as I don&#39;t<br>
    &gt; &gt;    think we have full coverage in packages (neither for all compilers<br>
    &gt; &gt;    available)? Although it would be better as it would centralize the<br>
    &gt; &gt;    management. (For reference this is in part how rpm handles this:<br>
    &gt; &gt;     <a href="https://github.com/rpm-software-management/rpm/blob/master/rpmrc.in" rel="noreferrer" target="_blank">https://github.com/rpm-software-management/rpm/blob/master/rpmrc.in</a>)<br>
    &gt; &gt;<br>
    &gt; <br>
    &gt; I agree that is not completely clear what the best approach here is, do we<br>
    &gt; change the defaults of gcc or influence things via default buildflags.<br> &gt; <br>
    &gt; I&#39;m sure there are packages that do not respect dpkg-buildflags during<br>
    &gt; build but the consequences of this do not seem all that great -- such<br> &gt; packages would not be optimized for the variant / ISA but if someone<br> &gt; manages to notice this, they can fix the bug.<br>
    &gt; <br>
    &gt; OTOH, having the compiler default change may be a bit of a surprise for<br>
    &gt; people who build binaries for deployment not via Debian packages. (Do our<br>
    &gt; compilers in general target the same baseline as Debian does for a given<br>
    &gt; architecture?).<br>

    Right, given that the failure mode would be just &quot;no-optimized-builds&quot;,<br>
    and should not end up with those packages being broken, at most just<br> redundant with the baseline ones, then I guess controlling it either<br>
    way would seem fine, yes.<br></blockquote><div><br></div><div>Ack.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
    (Also if the packages are reproducible, and end up being not optimized<br>
    this might be detectable as producing identical artifacts as on the<br> baseline.)<br></blockquote><div><br></div><div>This is an interesting idea -- although of course some care would be required to avoid false positives from things that do not use the C/C++ toolchain at all. Anyway... </div><div> </div><blockquote class="
    gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
    &gt; &gt;  - Perhaps that&#39;s a limitation from the archive software side, but<br>
    &gt; &gt;    requiring to place the binary packages in the same pool seems<br>
    &gt; &gt;    rather restrictive (it forces different filenames for example).<br>

    &gt; We are considering supporting multiple variant/ISAs in the primary Ubuntu<br>
    &gt; archive, so if we get that far then yes, we want to have all the binary<br>
    &gt; packages in the same pool. The first steps don&#39;t have to support this I<br>
    &gt; guess.<br>

    Ok. Just a note that even if served from the primary archive, there<br>
    could be multiple pools (like the multi-pool setup on debian-ports),<br>
    as the entry point are the (In)Release files.</blockquote><div><br></div><div>Oh OK. I don&#39;t think Launchpad supports that (but an not sure).</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(
    204,204,204);padding-left:1ex"> But, yes, the other<br>
    option would be to use the variant/ISA name as a &quot;fake arch&quot; just in<br>
    the binary package name.<br></blockquote><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
    &gt; &gt;  - I guess it might be nice for the ISA to be passed down to the<br> &gt; &gt;    dpkg tools, but I don&#39;t think this is strictly necessary? A<br>
    &gt; &gt;    frontend like apt could also decide based on metadata in say the<br>
    &gt; &gt;    Release file, although not having the actual installed package<br>
    &gt; &gt;    metadata on whether it was a different ISA build or not would make<br>
    &gt; &gt;    its job more inconvenient. In any case I don&#39;t have a big issue<br>
    &gt; &gt;    with recording this via dpkg-gencontrol or similar if necessary.<br>

    &gt; I agree, I don&#39;t think it&#39;s /strictly/ required that the target ISA is<br>
    &gt; recorded in the deb. But I think adding a field for it reduces scope for<br>
    &gt; confusion later.<br>

    Yes, agreed.<br>

    &gt; &gt; On the specific implementation details:<br>
    &gt; &gt;<br>
    &gt; &gt;  - As covered in previous discussions, dpkg could (but I don&#39;t think<br>
    &gt; &gt;    it&#39;s necessary) check whether the .deb is runnable on the current<br>
    &gt; &gt;    hw, but that&#39;s tricky as chrootless installs need to be taken<br>
    &gt; &gt;    into account, etc. It should certainly not be part of dependency<br>
    &gt; &gt;    resolution.<br>

    &gt; I&#39;m sorry, what is a chrootless install? But I think I agree here too:<br>
    &gt; tricky and just not really worth it.<br>

    <a href="https://wiki.debian.org/Teams/Dpkg/Spec/InstallBootstrap" rel="noreferrer" target="_blank">https://wiki.debian.org/Teams/Dpkg/Spec/InstallBootstrap</a></blockquote><div><br></div><div>Ah right.</div><div><br></div><blockquote class="gmail_quote"
    style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

    [continued in next message]

    --- SoupGate-Win32 v1.05
    * Origin: you cannot sedate... all the things you hate (1:229/2)