Skip to content

libr3: migrate to pcre2 and modernize - #526145

Closed
ethancedwards8 wants to merge 1 commit into
NixOS:masterfrom
ethancedwards8:libr3
Closed

ethancedwards8 wants to merge 1 commit into
NixOS:masterfrom
ethancedwards8:libr3

Conversation

@ethancedwards8

Copy link
Copy Markdown
Member

Link: #356387

Things done

@ethancedwards8

Copy link
Copy Markdown
Member Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 526145
Commit: 8789de91111dd0d2d02ad457d96ef90ad0edb406


x86_64-linux

✅ 1 package built:
  • libr3

@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 9.needs: reviewer This PR currently has no reviewers requested and needs attention. labels May 30, 2026
Comment thread pkgs/by-name/li/libr3/package.nix Resolved
Link: NixOS#356387

Signed-off-by: Ethan Carter Edwards <[email protected]>
@mweinelt

Copy link
Copy Markdown
Member

@nixpkgs-ci nixpkgs-ci Bot added 12.approvals: 1 This PR was reviewed and approved by one person. and removed 9.needs: reviewer This PR currently has no reviewers requested and needs attention. labels May 30, 2026
@ethancedwards8

Copy link
Copy Markdown
Member Author

@mweinelt I couldn't quite get this example to work but:

passthru.tests.consumer =
  let
    pname = "libr3-test";
    inherit (finalAttrs) version;
    src = ./test.c;
  in
    stdenv.mkDerivation {
      inherit pname version src;

      dontUnpack = true;

      buildInputs = [ finalAttrs.finalPackage ];

      nativeBuildInputs = [ pkg-config ];

      buildPhase = "cc $src -o test";
      installPhase = "mkdir -p $out/bin; mv test $out/bin/";
      checkPhase = "$out/bin/test";
    };

with the src as https://github.com/c9s/r3/blob/2.0/examples/simple.c

It wouldn't compile unless I added pcre2 to the buildInputs, so I though propagated was correct here...

But when I compile I get these linking errors:

Running phase: buildPhase
/nix/store/s2946bl9ciwzhafd66jhansrmxq9xhqm-binutils-2.46/bin/ld.bfd: /build/ccWykxsx.o: in function `main':
33gx9q8v6xsa2ysf9rq6gkqv5wlvq07x-test.c:(.text.startup+0x20): undefined reference to `r3_tree_create'
/nix/store/s2946bl9ciwzhafd66jhansrmxq9xhqm-binutils-2.46/bin/ld.bfd: 33gx9q8v6xsa2ysf9rq6gkqv5wlvq07x-test.c:(.text.startup+0x45): undefined reference to `r3_tree_insert_pathl_ex'
/nix/store/s2946bl9ciwzhafd66jhansrmxq9xhqm-binutils-2.46/bin/ld.bfd: 33gx9q8v6xsa2ysf9rq6gkqv5wlvq07x-test.c:(.text.startup+0x69): undefined reference to `r3_tree_insert_pathl_ex'
/nix/store/s2946bl9ciwzhafd66jhansrmxq9xhqm-binutils-2.46/bin/ld.bfd: 33gx9q8v6xsa2ysf9rq6gkqv5wlvq07x-test.c:(.text.startup+0x8d): undefined reference to `r3_tree_insert_pathl_ex'
/nix/store/s2946bl9ciwzhafd66jhansrmxq9xhqm-binutils-2.46/bin/ld.bfd: 33gx9q8v6xsa2ysf9rq6gkqv5wlvq07x-test.c:(.text.startup+0xb1): undefined reference to `r3_tree_insert_pathl_ex'
/nix/store/s2946bl9ciwzhafd66jhansrmxq9xhqm-binutils-2.46/bin/ld.bfd: 33gx9q8v6xsa2ysf9rq6gkqv5wlvq07x-test.c:(.text.startup+0xd5): undefined reference to `r3_tree_insert_pathl_ex'
/nix/store/s2946bl9ciwzhafd66jhansrmxq9xhqm-binutils-2.46/bin/ld.bfd: /build/ccWykxsx.o:33gx9q8v6xsa2ysf9rq6gkqv5wlvq07x-test.c:(.text.startup+0xf9): more undefined references to `r3_tree_insert_pathl_ex' follow
/nix/store/s2946bl9ciwzhafd66jhansrmxq9xhqm-binutils-2.46/bin/ld.bfd: /build/ccWykxsx.o: in function `main':
33gx9q8v6xsa2ysf9rq6gkqv5wlvq07x-test.c:(.text.startup+0x371): undefined reference to `r3_tree_compile'
/nix/store/s2946bl9ciwzhafd66jhansrmxq9xhqm-binutils-2.46/bin/ld.bfd: 33gx9q8v6xsa2ysf9rq6gkqv5wlvq07x-test.c:(.text.startup+0x394): undefined reference to `r3_tree_matchl'
/nix/store/s2946bl9ciwzhafd66jhansrmxq9xhqm-binutils-2.46/bin/ld.bfd: 33gx9q8v6xsa2ysf9rq6gkqv5wlvq07x-test.c:(.text.startup+0x3a5): undefined reference to `match_entry_createl'
/nix/store/s2946bl9ciwzhafd66jhansrmxq9xhqm-binutils-2.46/bin/ld.bfd: 33gx9q8v6xsa2ysf9rq6gkqv5wlvq07x-test.c:(.text.startup+0x3ba): undefined reference to `r3_tree_matchl'
/nix/store/s2946bl9ciwzhafd66jhansrmxq9xhqm-binutils-2.46/bin/ld.bfd: 33gx9q8v6xsa2ysf9rq6gkqv5wlvq07x-test.c:(.text.startup+0x3de): undefined reference to `match_entry_free'
/nix/store/s2946bl9ciwzhafd66jhansrmxq9xhqm-binutils-2.46/bin/ld.bfd: 33gx9q8v6xsa2ysf9rq6gkqv5wlvq07x-test.c:(.text.startup+0x3e6): undefined reference to `r3_tree_free'

so I'm not confident that this package is actually being compiled correctly. You may have more insight into what's going on here

@mweinelt

Copy link
Copy Markdown
Member

I do not, sorry.

@GrimmTheShrimp

This comment was marked as low quality.

@nixpkgs-ci nixpkgs-ci Bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jul 20, 2026
propagatedBuildInputs = [ pcre ];
buildInputs = [
check
pcre2

@GrimmTheShrimp GrimmTheShrimp Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually needs to be propagated. Reason being their header:

cat ${libr3}/include/r3/r3.h

/*
 * r3.h
 * Copyright (C) 2014 c9s <[email protected]>
 *
 * Distributed under terms of the MIT license.
 */
#ifndef R3_NODE_H
#define R3_NODE_H

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define PCRE2_CODE_UNIT_WIDTH 8
#include <pcre2.h>

...

No downstream package can use that header without also having pcre2 available. This is what propagatedBuildInputs is for.

Suggested change
pcre2
];
propagatedBuildInputs = [
pcre2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(probably should get a comment explaining why)

@GrimmTheShrimp

Copy link
Copy Markdown
Contributor

Also needs a rebase after #535754

@ethancedwards8

Copy link
Copy Markdown
Member Author

i will not have time to work on this...

@GrimmTheShrimp

Copy link
Copy Markdown
Contributor

Continued in #563264, because i want to get rid of pcre here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge conflict This PR has merge conflicts with the target branch 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 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.

3 participants