!OqhvaDMJdKYUicLDiE:nixos.org

Nixpkgs Stdenv

111 Members
42 Servers

Load older messages


SenderMessageTime
22 Jun 2024
@p14:matrix.orgp14

Crazy idea: what if the stdenv had a checkPhase step which, if there is a c compiler, checks that it can successfully build int main() and using printf/std::cout?

The benefit would be that a broken compiler would show up as failing to build an obvious test program rather than failing in random bits of configure script for other stuff you try to use downstream of constructing the stdenv.

11:20:38
@vcunat:matrix.orgvcunat Nit: checkPhase is too late. Looong after configurePhase. 11:42:01
@vcunat:matrix.orgvcunatSounds OK to me. Can't see why not, by default.11:48:06
@vcunat:matrix.orgvcunatThough note that you basically always have a C compiler, as it's included in the standard stdenv. So maybe there would be some edge cases where it isn't a good idea to do such a test.11:49:48
@aloisw:kde.orgaloisw I think their idea was that the stdenv package itself gains a checkPhase which verifies that its C compiler works. 12:19:46
@artturin:matrix.orgArtturin
In reply to @p14:matrix.org

Crazy idea: what if the stdenv had a checkPhase step which, if there is a c compiler, checks that it can successfully build int main() and using printf/std::cout?

The benefit would be that a broken compiler would show up as failing to build an obvious test program rather than failing in random bits of configure script for other stuff you try to use downstream of constructing the stdenv.

Well there is tests.stdenv and tests.cc-wrapper
12:57:38
@p14:matrix.orgp14
In reply to @artturin:matrix.org
Well there is tests.stdenv and tests.cc-wrapper
Yeah, aware of this, but the concept is to stop a build during development if the basic/essential compiler config is borked. The would mostly benefit exotic environments, people messing with compilers and standard libraries and those developing them.
13:11:49
@p14:matrix.orgp14But could save a fair amount of pain there.13:12:02
@w4tsn:darmstadt.socialw4tsn
In reply to @w4tsn:darmstadt.social

In Section "XSI Shell and Utilities Conformance" in Chapter 2. Conformance it reads

The following requirements apply to the shell and utilities when the XSI option is supported:
[...]

  • The C-language Development utility c99 shall be supported.
An alternative to add the scripts to the gcc package could be to modify buildFHSUserEnv to provide these scripts if gcc is part of the env. If buildFHSUserEnv is designed to provide a POSIX compliant shell that is
13:15:45
@p14:matrix.orgp14I just went through a round of 'configure phase fails with message buried in config.log', 'try to determine if compiler works', 'it seems to work', 'but actually doesn't work correctly in the stdenv', where if the stdenv had just refused to build with a clear message showing it can't build hello world main.c it would have saved a bunch of time.13:16:03
@p14:matrix.orgp14I guess from the implementation of the stdenv's builder this might not be trivial to achieve: https://github.com/NixOS/nixpkgs/blob/1eae5f88019f10beb0da370cc7d1726471ed11da/pkgs/stdenv/generic/builder.sh#L23-L24 Is it straight forward to 'drop into the stdenv we just built' at the end of that script and attempt to run the compiler?13:22:00
@artturin:matrix.orgArtturin
In reply to @p14:matrix.org

I guess from the implementation of the stdenv's builder this might not be trivial to achieve:
https://github.com/NixOS/nixpkgs/blob/1eae5f88019f10beb0da370cc7d1726471ed11da/pkgs/stdenv/generic/builder.sh#L23-L24

Is it straight forward to 'drop into the stdenv we just built' at the end of that script and attempt to run the compiler?

No, cc is added after the builder is built
13:22:46
@artturin:matrix.orgArtturinI think so do check13:23:30
@vcunat:matrix.orgvcunat

the idea was that the stdenv package itself gains a checkPhase

Oh, OK. Though an issue is that you can often break it by per-package stuff, e.g. NIX_CFLAGS_COMPILE.

14:12:36
@p14:matrix.orgp14
In reply to @vcunat:matrix.org

the idea was that the stdenv package itself gains a checkPhase

Oh, OK. Though an issue is that you can often break it by per-package stuff, e.g. NIX_CFLAGS_COMPILE.

Yeah; I realise that is also an issue. I am first considering just broken stdenv though. At least with a stdenv check you only pay for a trivial compile once for the stdenv and not for every package, which seems more bearable. A per package check might also be nice but obviously comes at a greater compute cost.
14:41:40
@p14:matrix.orgp14
In reply to @artturin:matrix.org
I think so do check
Not quite able to follow what you mean there by “after the builder”, what I see is that stdenv has a fairly trivial shell script which builds the stdenv and it has the cc passed into it. Unless I misunderstand…
14:43:17
29 Jun 2024
@mib:kanp.aimib 🥐 joined the room.22:25:02
4 Jul 2024
@philiptaron:matrix.orgPhilip Taron (UTC-8) left the room.15:46:23
@philiptaron:matrix.orgPhilip Taron (UTC-8) joined the room.15:54:09
@soispha:vhack.euBenedikt changed their display name from Soispha to Benedikt.19:10:28
7 Jul 2024
@dminca:matrix.orgdminca joined the room.09:39:05
9 Jul 2024
@paparodeo:matrix.orgreno joined the room.20:30:35
10 Jul 2024
@rvdp:infosec.exchangeRamses 🇵🇸 Could I get a review and potential merge on this PR? At least one person ran into trouble because of the issue it's fixing (compiler flags being repeated hundreds of times)
https://github.com/NixOS/nixpkgs/pull/301634
18:25:47
@rick:matrix.ciphernetics.nlMindaviI still kinda wish it wouldn't all be bash, it's not easy on the eyes at all20:19:52
@rvdp:infosec.exchangeRamses 🇵🇸Totally agree, it wasn't fun at all to write this function, but it seems that we're stuck with bash for the foreseeable future23:04:58
11 Jul 2024
@rick:matrix.ciphernetics.nlMindaviThank you for doing that07:39:25
@rick:matrix.ciphernetics.nlMindaviI've one question and then I'd say it's good to go, but my bash isn't that great07:39:58
15 Jul 2024
@sielicki:matrix.org@sielicki:matrix.org left the room.00:28:04
@dminca:matrix.orgdminca changed their display name from dminca to nixpkgs.17:28:44
@dminca:matrix.orgdminca changed their display name from nixpkgs to dminca.17:42:24

There are no newer messages yet.


Back to Room ListRoom Version: 9