Numpy 2’s cross compilation is broken. In order to fix it I have to set in a configuration file the longdouble IEEE format, so it won’t try to compile a program and run it. Here’s an example from Numpy’s cross compilation instructions:
[properties]
longdouble_format = 'IEEE_DOUBLE_LE'
Is there an attribute in stdenv.hostPlatform that holds this information? Does anyone know on what this depends? Perhaps it is constant in Nixpkgs in general? Help from compiler knights would be blessed .
Nixpkgs issue is this. And this is the code upstream tries to run natively to determine the longdouble format:
The most practical solution would be to just hard code the value for a few known platforms that we actually care about.
The proper solution would probably involve extending our platform definition with the CPU’s longdouble format attribute, just like we have have it for byte order or bitness.
I don’t know how to touch these files appropriately or what consequences changing them has but there is lib/systems/parse.nix. The purpose of its functions is to construct a system attribute set that captures a system’s properties. You can try it out yourself using e.g. lib.systems.parse.mkSystemFromString "x86_64-linux". This is the same as stdenv.hostPlatform.parsed if that’s your host platform.
I’d expect you to be able to shove an additional attr into this system attrset; e.g. cpu.longdouble. You’d assign it to all CPU types as appropriate.
You could then add a matching expression in lib/systems/inspect.nix for your new attr to get e.g. stdenv.hostPlatform.isIEEEDouble.
Perhaps this isn’t really a good candidate for a boolean flag though and you should just use the raw value itself. Depends on how many longdouble formats there are.