• [gentoo-dev] [RFC] Dealing with default upstream Rust flags (?)

    From =?UTF-8?Q?Micha=C5=82_G=C3=B3rny?=@21:1/5 to All on Sat Nov 9 17:50:01 2024
    Hi,

    Long story short, a lot of Rust upstreams are ricing in their
    Cargo.toml: enabling LTO, adjusting LTO jobs to exactly 1, and even
    weirder stuff. With C, we generally have clear policies to override
    this and respect user flags. With Rust, things aren't that clear.

    Say, let's look at fractal:

    [profile.release]
    debug = true
    lto = "thin"
    codegen-units = 1

    Upstream is enabling LTO with 1 job (i.e. single threaded) to squeeze
    as much as they can from it. Also, they are enabling debug symbols for
    some reason. As a result, the build takes 45 minutes, if it doesn't OOM
    first.

    How much of that stuff should we respect? Or should we perhaps override
    it all? Should we do some special magic via eclass, or perhaps expect
    users to set specific RUSTFLAGS for that? Perhaps set default RUSTFLAGS
    in the profiles?

    --
    Best regards,
    Michał Górny


    -----BEGIN PGP SIGNATURE-----

    iQFGBAABCgAwFiEEx2qEUJQJjSjMiybFY5ra4jKeJA4FAmcvkcISHG1nb3JueUBn ZW50b28ub3JnAAoJEGOa2uIyniQO2mQIALn7umbJLpRL1oGZZb5egQxY+RGylruW xkWSYv+DlVcbZYfMYGogOIG/ojA9o4MaRURkaglXLvD+d1J4mH334hFJpNEHxYlk qCUP4/0kaGDMMM8tKqdp5CfjKRqeODaGssyUMj+0Nh+H+j164/D6lrrCrAARei89 Pswv42ZvVjimNBI54puuWlkSjMxCosCpSkCngxpYd+MsOKILXd95n4wj6ib1Pqb8 8xsI/0N8Q7b+u5p4PocQ5PgmUaP2X9fX+xoL9F1ZkygezW2223vBKWLr3l26DXLE kDPeoOmw+NZTdEFECX+hfbtoh8pn3mkF97jYV+Biy+szuzUNJ7v2qjI=
    =LZ1G
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From James Le Cuirot@21:1/5 to All on Sun Nov 10 00:30:02 2024
    On Sat, 2024-11-09 at 17:45 +0100, Michał Górny wrote:
    Hi,

    Long story short, a lot of Rust upstreams are ricing in their
    Cargo.toml: enabling LTO, adjusting LTO jobs to exactly 1, and even
    weirder stuff. With C, we generally have clear policies to override
    this and respect user flags. With Rust, things aren't that clear.

    Say, let's look at fractal:

    [profile.release]
    debug = true
    lto = "thin"
    codegen-units = 1

    Upstream is enabling LTO with 1 job (i.e. single threaded) to squeeze
    as much as they can from it. Also, they are enabling debug symbols for
    some reason. As a result, the build takes 45 minutes, if it doesn't OOM first.

    How much of that stuff should we respect? Or should we perhaps override
    it all? Should we do some special magic via eclass, or perhaps expect
    users to set specific RUSTFLAGS for that? Perhaps set default RUSTFLAGS
    in the profiles?

    This stuff is unbelievably messy. Read the comments in cargo.eclass regarding RUSTFLAGS. As things stand, user RUSTFLAGS are respected, as are some project-specific flags but not all.

    When I worked on this, I didn't look into these profile-related settings. Do these actually have anything to do with RUSTFLAGS? I'm not sure. gyakovlev experimented with a "gentoo" (as opposed to "release") profile a while back, but that effort stalled.

    -----BEGIN PGP SIGNATURE-----

    iQJFBAABCAAvFiEEPxcZ3tkwcedKm2a8EiZBXQDdMTcFAmcv8AoRHGNoZXdpQGdl bnRvby5vcmcACgkQEiZBXQDdMTctvhAAj3u5DbD+4BZNsFP/oCCXkoHCzVTHyzAP S8xgesY1MmsDgHsHa/5xKOAaQ78sRINQwPUCOAAaZsyAGRMG0JrKq8odOQ7V3O7W GjZxEsmQ5bECVhxeQyXZRrgVJb2kv8tlvW5MZEQUrojyP/HJ929FKhsOEeCVet4G b8cUUO+Hd0yVrR9rhor9KM26iVh3X6ZwZYuQpOXHJ/M77jfmrxokNSfiHJTl7U1b xYhGkocJRV2s4RKxRgUpS6Oc7EuBRdQZHyvpWWKR5nTJVe63Nnnl54hrq6AqSzNI IbDeXhAZPoT4Nls5MGlv34Z/6emGWcWVMg6qGRMMQw9skBMspZd/HP7uj84cVPvV EvaJfaDeW80igAOjuUsNZAmQsHMijvMFft8AqvOP7Tgu1Utr7zqPfMQNpIsIwyaT esOASIf6kW3Vqbt7g5f0JGqT8+VMNWHtOW0TxemdQm8Lv6o42g6ZTpU6HdV7f+Cf Tzt2NgwzfGJzHuWgSu2gaVOntxRYyBPCjZPafvaBheArufJRnVyOqpwVr3NWGr8G +pSiu9UPow55Fev1jPaGR23Tdf7W5Syu7/lVqJzVXZlxZ1Hzg2LDkKG9AXSC5YNe E2laGR5/VKv5O3qVjB44dbB8fcJAPVxCdn1JM5PP+gdMZQhQtH2Yd85kJFIOV6YG
    VUPF0jcwGBY=
    =aKvj
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)