Skip to content

curl: 8.5.0 -> 8.6.0, build with libpsl#285295

Merged
mweinelt merged 4 commits intoNixOS:stagingfrom
mweinelt:curl-8.6.0
Feb 3, 2024
Merged

curl: 8.5.0 -> 8.6.0, build with libpsl#285295
mweinelt merged 4 commits intoNixOS:stagingfrom
mweinelt:curl-8.6.0

Conversation

@mweinelt
Copy link
Member

@mweinelt mweinelt commented Jan 31, 2024

Description of changes

Updates curl to 8.6.0

Enables libpsl on curl.

Disables testing libpsl with valgrind, easiest way to resolve cyclic dependencies.

Status: Running build tests

Things done

  • Built on platform(s)
    • x86_64-linux up to curlFull and curl.tests
    • aarch64-linux up to curlFull and curl.tests
    • x86_64-darwin up to curl
    • aarch64-darwin up to curlFull and curl.tests w/o fetchpatch, which does not eval
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

We plan to enable libpsl support on curl, but including valgrind here
causes a cyclic dependency on curl.

As the tests have been disabled on various platforms already, this is
probably the cheapest place to resolve the dependency chain.
@mweinelt mweinelt added the 1.severity: security Issues which raise a security issue, or PRs that fix one label Jan 31, 2024
@ofborg ofborg bot added 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. labels Jan 31, 2024
@Izorkin
Copy link
Contributor

Izorkin commented Jan 31, 2024

What platform? My darwin builds are all still running (since 4h30m) and no errors.

Fixed, I forgot to add the postPatch block :)

`tests` seem to be something else on darwin, leading to an eval failure
on the instantiation of this test.

```
 … while evaluating the attribute 'tests.fetchpatch'

   at ./pkgs/tools/networking/curl/default.nix:182:7:

    181|       withCheck = finalAttrs.finalPackage.overrideAttrs (_: { doCheck = true; });
    182|       fetchpatch = tests.fetchpatch.simple.override { fetchpatch = (fetchpatch.override { fetchurl = useThisCurl fetchurl; }) // { version = 1; }; };
       |       ^
    183|       curlpp = useThisCurl curlpp;

 … while calling a functor (an attribute set with a '__functor' attribute)

   at ./pkgs/tools/networking/curl/default.nix:182:20:

    181|       withCheck = finalAttrs.finalPackage.overrideAttrs (_: { doCheck = true; });
    182|       fetchpatch = tests.fetchpatch.simple.override { fetchpatch = (fetchpatch.override { fetchurl = useThisCurl fetchurl; }) // { version = 1; }; };
       |                    ^
    183|       curlpp = useThisCurl curlpp;

 (stack trace truncated; use '--show-trace' to show the full trace)

 error: value is a function while a set was expected
```
@mweinelt
Copy link
Member Author

mweinelt commented Feb 1, 2024

@ofborg eval

@adamcstephens
Copy link
Contributor

This built successfully for me on x86_64-linux and aarch64-darwin. If you have specific packages you'd like me to test let me know, but I wasn't planning on rebuilding everything to run a review on this.

@mweinelt
Copy link
Member Author

mweinelt commented Feb 1, 2024

Check the top post, I built it on all relevant platforms already.

@delroth delroth added the 12.approvals: 1 This PR was reviewed and approved by one person. label Feb 1, 2024
@mweinelt mweinelt merged commit c6d7811 into NixOS:staging Feb 3, 2024
@mweinelt mweinelt deleted the curl-8.6.0 branch February 3, 2024 01:10
@risicle
Copy link
Contributor

risicle commented Feb 3, 2024

Built curl.tests (apart from haskell test, too big) and curlFull.tests.withCheck on macos 12 x86_64.

@vcunat
Copy link
Member

vcunat commented Feb 9, 2024

Some edge-case doesn't work, apparently and nixStatic gets blocked by that:
https://hydra.nixos.org/build/248713644/nixlog/8/tail

@mweinelt
Copy link
Member Author

mweinelt commented Feb 9, 2024

Not entirely sure where this goes wrong.

checking for library containing psl_builtin... no

pkgsStatic.libpsl in lib/libpsl.a does have 0000000000000f90 T psl_builtin.

@alyssais
Copy link
Member

alyssais commented Feb 9, 2024

libpsl depends on libunistring and libidn2. Static libraries don't embed dependency information, so you have to use some out-of-band mechanism to find their dependencies; usually libtool or pkg-config. curl is not using pkg-config to find libpsl, so it doesn't pick up the dependencies.

@alyssais
Copy link
Member

alyssais commented Feb 9, 2024

curl does use pkg-config for a bunch of other libraries, so I think it's a case of getting it to do that for libpsl as well.

@mweinelt
Copy link
Member Author

mweinelt commented Feb 9, 2024

I'm talking to upstream, to get the ball rolling on pkg-config support. In the meantime I tried the following, but it fails the same. Not really my area of expertise I must admit.

diff --git a/pkgs/tools/networking/curl/default.nix b/pkgs/tools/networking/curl/default.nix
index 9cbf6dc1b0fb..71af49be852a 100644
--- a/pkgs/tools/networking/curl/default.nix
+++ b/pkgs/tools/networking/curl/default.nix
@@ -19,7 +19,7 @@
 , idnSupport ? false, libidn2
 , ldapSupport ? false, openldap
 , opensslSupport ? zlibSupport, openssl
-, pslSupport ? false, libpsl
+, pslSupport ? false, libpsl, libunistring
 , rtmpSupport ? false, rtmpdump
 , scpSupport ? zlibSupport && !stdenv.isSunOS && !stdenv.isCygwin, libssh2
 , wolfsslSupport ? false, wolfssl
@@ -145,6 +145,11 @@ stdenv.mkDerivation (finalAttrs: {
   CXX = "${stdenv.cc.targetPrefix}c++";
   CXXCPP = "${stdenv.cc.targetPrefix}c++ -E";
 
+  NIX_CFLAGS_COMPILE = lib.optionalString (pslSupport && stdenv.hostPlatform.isStatic)
+    "-I${lib.getDev libunistring}/include -I${lib.getDev libidn2}/include";
+  NIX_CFLAGS_LINK = lib.optionalString (pslSupport && stdenv.hostPlatform.isStatic)
+    "-L${lib.getLib libunistring}/lib -L${lib.getLib libidn2}/lib";
+
   # takes 14 minutes on a 24 core and because many other packages depend on curl
   # they cannot be run concurrently and are a bottleneck
   # tests are available in passthru.tests.withCheck

I also tried adding libpsl itself to cflags, no dice.

@alyssais
Copy link
Member

alyssais commented Feb 9, 2024

The search paths (-I, -L) should be fine unless the headers are under a subdirectory or something. What you need to do is force the libraries to be linked: -lunistring -lidn2.

Can you link to discussion with upstream?

@mweinelt
Copy link
Member Author

mweinelt commented Feb 9, 2024

The discussion happened on IRC. They are adding pkg-config support to their todo in curl/curl#12919.

@alyssais
Copy link
Member

alyssais commented Feb 9, 2024

Do you have any insight into how likely things from the curl TODO are to end up being done? Having a NIX_LDFLAGS hack around is not great for maintainability, because dependencies of libraries can change. I guess for curl we'd probably at least notice via nixStatic though…

@mweinelt
Copy link
Member Author

mweinelt commented Feb 9, 2024

Same error with:

NIX_CFLAGS_COMPILE = lib.optionalString (pslSupport && stdenv.hostPlatform.isStatic)
  "-I${lib.getDev libpsl}/include -I${lib.getDev libunistring}/include -I${lib.getDev libidn2}/include";
NIX_LDFLAGS = lib.optionalString (pslSupport && stdenv.hostPlatform.isStatic)
  "-L${lib.getLib libpsl}/lib -L${lib.getLib libunistring}/lib -L${lib.getLib libidn2}/lib -lunistring -lidn2";

Do you have any insight into how likely things from the curl TODO are to end up being done?

It looks like things are regularly removed from the TODO, because they've gotten implemented. I do not have a timeline or an idea how long this could take. I agree that this situation is less than ideal.

The alternative would be to skip libpsl on static builds for now.

alyssais added a commit to alyssais/nixpkgs that referenced this pull request Feb 9, 2024
Link: NixOS#285295 (comment)
Fixes: 996b4eb ("curl: build with public suffix list support")
@alyssais alyssais mentioned this pull request Feb 9, 2024
13 tasks
@alyssais
Copy link
Member

alyssais commented Feb 9, 2024

#287515

@domenkozar
Copy link
Member

This also brings Python into the curl closure:

❯ grep -R sxr2igfkwhxbagri49b8krmcqz168sim-python3-3.11.8 /nix/store/nwfsn1in46wmgn6ssm2j8famwis5yisz-libpsl-0.21.5
/nix/store/nwfsn1in46wmgn6ssm2j8famwis5yisz-libpsl-0.21.5/bin/psl-make-dafsa:#!/nix/store/sxr2igfkwhxbagri49b8krmcqz168sim-python3-3.11.8/bin/python

@vcunat vcunat mentioned this pull request Feb 29, 2024
13 tasks
@vcunat
Copy link
Member

vcunat commented Feb 29, 2024

Like this? #292260

domenkozar pushed a commit to cachix/nixpkgs that referenced this pull request Mar 12, 2024
vcunat added a commit that referenced this pull request Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.severity: security Issues which raise a security issue, or PRs that fix one 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants