sage: fix segfaults and test timeout on darwin#545925
Conversation
After NixOS#541155 disabled `ntl` threading on Darwin to bypass a compilation failure, the sage tests started failing with segfaults caused by with-threading and without-threading `ntl` assumptions present in the graph of libraries installed by the build. This change ensures that all dependencies that link against `ntl` use the same copy, that is, the no-threading copy on Darwin. With these change the tests now pass.
|
@t0yv0 I'm not opposed to merging this to get Sage tests working ASAP, but, to be clear, I think this is going in the wrong direction, in the sense that ideally we'd find out why enabling threads is a problem (brew ships a working Sage with NTL threads enabled, for example). Can you remind me what went wrong with the aarch64-darwin Sage build with NTL threads enabled? |
|
Huh, apparently Homebrew merely installs the Sage dmg from the 3-manifolds project. Very weird. |
|
@t0yv0 Can you check if this PR also works if you replace Reason: The TLS hack was introduced in NTL 9.8.0 (see the release notes) due to a lack of proper |
|
Setting |
|
I've done some digging on my end and not having thread-local support seems to resonate quite a bit with what I am seeing. If I use regular ntl I get a failure of this kind: This is about https://github.com/libntl/ntl/blob/v11.6.0/include/NTL/RR.h#L44-L50 |
|
Interesting data point before I try But perhaps it can be made more precise into a patch of the upstream sources so that meson and ninja build propagates ntl dependency to the darwin linker. |
|
|
Just to check, this is on top of the present PR, right? That is, making all dependencies use a NTL built with NTL_TLS_HACK=off (but with threads) as well. |
|
Indeed. That is what I tested. All dependencies using ntl with threads and NTL_TLS_HACK=off still fails to link on darwin. I am now isolating a minimal patch to sage that makes ntl passed explicitly to the linker, this seems the most promising avenue. I'll report if I can pass tests and use sage this way, and post a PR if so. |
|
I think I prefer this PR to tweaking linker options at Sage build time. Feels a bit funny to build eclib (say) with one version of NTL and then link it with another. |
|
Unless you're passing the threaded version of NTL (same used to build other dependencies) directly to the linker at Sage build time, of course. |
|
Let's have a look at both directly to see which one we prefer. Here's the other change: #546056 I verified it gives me a working The appeal of #546056 is that we get to use stock |
After #541155 disabled
ntlthreading on Darwin to bypass a compilation failure, the sage tests started failing with segfaults caused by with-threading and without-threadingntlassumptions present in the graph of libraries installed by the build. This change ensures that all dependencies that link againstntluse the same copy, that is, the no-threading copy on Darwin.With these change the tests now pass.
Fixes #545650
Besides fixing tests this likely resolves end-user segfaults in the sage build.
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.