Makefile: build libgit-rs and libgit-sys serially
PATCH 1/1 Makefile: build libgit-rs and libgit-sys serially
The "cargo build" invocations in contrib/ cannot be run in parallel.
"make -JN" with INCLUDE_LIBGIT_RS enabled causes cargo lock warnings and can trigger ld errors during the build.
The build errors are caused by two inner "make" invocations getting triggered concurrently: once inside of libgit-sys and another inside of libgit-rs.
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -3989,7 +3989,7 @@ libgit-sys libgit-rs: cargo build \ ) ifdef INCLUDE_LIBGIT_RS -all:: libgit-sys libgit-rs +all:: libgit-sys .WAIT libgit-rs endif LIBGIT_PUB_OBJS += contrib/libgit-sys/public_symbol_export.o
Signature · 1 line
2.50.0.7.gec2f25360c
Quoted 5 lines · David Aguilar
The "cargo build" invocations in contrib/ cannot be run in parallel.
"make -JN" with
INCLUDE_LIBGIT_RSenabled causes cargo lock warnings and can trigger ld errors during the build.
Quoted 8 lines
The build errors are caused by two inner "make" invocations getting triggered concurrently: once inside of libgit-sys and another inside of libgit-rs.
Signed-off-by David Aguilar <[email protected]>--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Don't we need a similar change to t/Makefile, or "cargo test" does fine while "cargo build" cannot be run in parallel?
Quoted 14 lines
Makefile +1
-1@@ -3989,7 +3989,7 @@ libgit-sys libgit-rs: cargo build \ ) ifdef INCLUDE_LIBGIT_RS -all:: libgit-sys libgit-rs +all:: libgit-sys .WAIT libgit-rs endif LIBGIT_PUB_OBJS += contrib/libgit-sys/public_symbol_export.o
PATCH v2 1/1 Makefile: build libgit-rs and libgit-sys serially
"make -JN" with INCLUDE_LIBGIT_RS enabled causes cargo lock warnings and can trigger ld errors during the build.
The build errors are caused by two inner "make" invocations getting triggered concurrently: once inside of libgit-sys and another inside of libgit-rs.
Make libgit-rs depend on libgit-sys so that "make" prevents them from running concurrently. Apply the same logic to the test invocations. Use cargo's "--manifest-path" option instead of "cd" in the recipes.
---
Differences since v0:
* The targets have been split apart into
separate targets so that the libgit-rs targets can be made to depend on the libgit-sys targets.
* cargo build/test --manifest-path is being used to simplify the build recipe by eliminating the "cd" step, which would have been duplicated in the split-out target.
* t/Makefile has been updated to apply the same logic.
Makefile | 11 +++++------ t/Makefile | 14 ++++---------- 2 files changed, 9 insertions(+), 16 deletions(-)
Makefile +5 -6
@@ -3983,13 +3983,12 @@ unit-tests: $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG) t/helper/test-tool$X $(MAKE) -C t/ unit-tests .PHONY: libgit-sys libgit-rs -libgit-sys libgit-rs: - $(QUIET)(\ - cd contrib/$@ && \ - cargo build \ - ) +libgit-sys: + $(QUIET)cargo build --manifest-path contrib/libgit-sys/Cargo.toml +libgit-rs: libgit-sys + $(QUIET)cargo build --manifest-path contrib/libgit-rs/Cargo.toml ifdef INCLUDE_LIBGIT_RS -all:: libgit-sys libgit-rs +all:: libgit-rs endif LIBGIT_PUB_OBJS += contrib/libgit-sys/public_symbol_export.o
t/Makefile +4 -10
@@ -190,15 +190,9 @@ perf: .PHONY: libgit-sys-test libgit-rs-test libgit-sys-test: - $(QUIET)(\ - cd ../contrib/libgit-sys && \ - cargo test \ - ) -libgit-rs-test: - $(QUIET)(\ - cd ../contrib/libgit-rs && \ - cargo test \ - ) + $(QUIET)cargo test --manifest-path ../contrib/libgit-sys/Cargo.toml +libgit-rs-test: libgit-sys-test + $(QUIET)cargo test --manifest-path ../contrib/libgit-rs/Cargo.toml ifdef INCLUDE_LIBGIT_RS -all:: libgit-sys-test libgit-rs-test +all:: libgit-rs-test endif
Signature · 1 line
2.50.0.7.ge90cf88798
Quoted 79 lines · David Aguilar
"make -JN" with
INCLUDE_LIBGIT_RSenabled causes cargo lock warnings and can trigger ld errors during the build.The build errors are caused by two inner "make" invocations getting triggered concurrently: once inside of libgit-sys and another inside of libgit-rs.
Make libgit-rs depend on libgit-sys so that "make" prevents them from running concurrently. Apply the same logic to the test invocations. Use cargo's "--manifest-path" option instead of "cd" in the recipes.
Signed-off-by David Aguilar <[email protected]>---
Differences since v0:
* The targets have been split apart into
separate targets so that the libgit-rs targets can be made to depend on the libgit-sys targets.* cargo build/test --manifest-path is being used to simplify the build recipe by eliminating the "cd" step, which would have been duplicated in the split-out target.
* t/Makefile has been updated to apply the same logic.
Makefile | 11 +++++------ t/Makefile | 14 ++++---------- 2 files changed, 9 insertions(+), 16 deletions(-)Makefile +5
-6@@ -3983,13 +3983,12 @@ unit-tests: $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG) t/helper/test-tool$X $(MAKE) -C t/ unit-tests .PHONY: libgit-sys libgit-rs -libgit-sys libgit-rs: - $(QUIET)(\ - cd contrib/$@ && \ - cargo build \ - ) +libgit-sys: + $(QUIET)cargo build --manifest-path contrib/libgit-sys/Cargo.toml +libgit-rs: libgit-sys + $(QUIET)cargo build --manifest-path contrib/libgit-rs/Cargo.toml ifdef INCLUDE_LIBGIT_RS -all:: libgit-sys libgit-rs +all:: libgit-rs endif LIBGIT_PUB_OBJS += contrib/libgit-sys/public_symbol_export.ot/Makefile +4
-11@@ -190,15 +190,9 @@ perf: .PHONY: libgit-sys-test libgit-rs-test libgit-sys-test: - $(QUIET)(\ - cd ../contrib/libgit-sys && \ - cargo test \ - ) -libgit-rs-test: - $(QUIET)(\ - cd ../contrib/libgit-rs && \ - cargo test \ - ) + $(QUIET)cargo test --manifest-path ../contrib/libgit-sys/Cargo.toml +libgit-rs-test: libgit-sys-test + $(QUIET)cargo test --manifest-path ../contrib/libgit-rs/Cargo.toml ifdef INCLUDE_LIBGIT_RS -all:: libgit-sys-test libgit-rs-test +all:: libgit-rs-test endif --
Quoted 1 line
2.50.0.7.ge90cf88798
This version looks good to me, thanks!
Quoted 9 lines · Kyle Lippincott
Quoted 8 lines · David Aguilar
"make -JN" with
INCLUDE_LIBGIT_RSenabled causes cargo lock warnings and can trigger ld errors during the build.The build errors are caused by two inner "make" invocations getting triggered concurrently: once inside of libgit-sys and another inside of libgit-rs.
Quoted 15 lines
Quoted 12 lines
Make libgit-rs depend on libgit-sys so that "make" prevents them from running concurrently. Apply the same logic to the test invocations. Use cargo's "--manifest-path" option instead of "cd" in the recipes.
....t/Makefile +4
-2+ $(QUIET)cargo test --manifest-path ../contrib/libgit-sys/Cargo.toml +libgit-rs-test: libgit-sys-test + $(QUIET)cargo test --manifest-path ../contrib/libgit-rs/Cargo.toml ifdef INCLUDE_LIBGIT_RS -all:: libgit-sys-test libgit-rs-test +all:: libgit-rs-test endif --Quoted 1 line
2.50.0.7.ge90cf88798
This version looks good to me, thanks!
Thanks, both. Will apply.
Quoted 20 lines · David Aguilar
The "cargo build" invocations in contrib/ cannot be run in parallel.
"make -JN" with
INCLUDE_LIBGIT_RSenabled causes cargo lock warnings and can trigger ld errors during the build.The build errors are caused by two inner "make" invocations getting triggered concurrently: once inside of libgit-sys and another inside of libgit-rs.
Signed-off-by David Aguilar <[email protected]>--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Makefile +0
-0
Makefile libgit-sys libgit-rs: · line 3992
Quoted 5 lines
Makefile +1
-1@@ -3989,7 +3989,7 @@ libgit-sys libgit-rs: cargo build \ ) ifdef INCLUDE_LIBGIT_RS -all:: libgit-sys libgit-rs +all:: libgit-sys .WAIT libgit-rs
I'm not familiar enough with make or with rust, but do we need to depend on both of these here? Wouldn't it be sufficient to say libgit-rs depends on libgit-sys, and only explicitly depend on libgit-rs in all::?
Quoted 6 lines
Makefile +0
-1endif LIBGIT_PUB_OBJS += contrib/libgit-sys/public_symbol_export.o --2.50.0.7.gec2f25360c
Quoted 16 lines · Kyle Lippincott
Quoted 15 lines · David Aguilar
The "cargo build" invocations in contrib/ cannot be run in parallel.
"make -JN" with
INCLUDE_LIBGIT_RSenabled causes cargo lock warnings and can trigger ld errors during the build.The build errors are caused by two inner "make" invocations getting triggered concurrently: once inside of libgit-sys and another inside of libgit-rs.
Signed-off-by David Aguilar <[email protected]>--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines
Makefile libgit-sys libgit-rs: · line 3992
Quoted 10 lines
Makefile +1
-1@@ -3989,7 +3989,7 @@ libgit-sys libgit-rs: cargo build \ ) ifdef INCLUDE_LIBGIT_RS -all:: libgit-sys libgit-rs +all:: libgit-sys .WAIT libgit-rsI'm not familiar enough with make or with rust, but do we need to depend on both of these here? Wouldn't it be sufficient to say libgit-rs depends on libgit-sys, and only explicitly depend on libgit-rs in
all::?
Not all platforms can build libgit-rs, so inserting it into as a required component is not a particularly friendly idea.
Quoted 33 lines · On Tue, Aug 26, 2025 at 10:53 AM <[email protected]> wrote:
Quoted 16 lines · Kyle Lippincott
Quoted 15 lines · David Aguilar
The "cargo build" invocations in contrib/ cannot be run in parallel.
"make -JN" with
INCLUDE_LIBGIT_RSenabled causes cargo lock warnings and can trigger ld errors during the build.The build errors are caused by two inner "make" invocations getting triggered concurrently: once inside of libgit-sys and another inside of libgit-rs.
Signed-off-by David Aguilar <[email protected]>--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 14 lines
Makefile libgit-sys libgit-rs: · line 3992
Quoted 10 lines
Makefile +1
-1@@ -3989,7 +3989,7 @@ libgit-sys libgit-rs: cargo build \ ) ifdef INCLUDE_LIBGIT_RS -all:: libgit-sys libgit-rs +all:: libgit-sys .WAIT libgit-rsI'm not familiar enough with make or with rust, but do we need to depend on both of these here? Wouldn't it be sufficient to say libgit-rs depends on libgit-sys, and only explicitly depend on libgit-rs in
all::?
Quoted 3 lines
Not all platforms can build libgit-rs, so inserting it into as a required component is not a particularly friendly idea.
That's not what I was suggesting. This is already in an ifdef, and the line I was quoting was changing all:: libgit-sys libgit-rs to all:: libgit-sys .WAIT libgit-rs. I'm wondering if we can instead split the libgit-sys libgit-rs: from a few lines earlier into libgit-sys: and libgit-rs: libgit-sys and then change this all line to all:: libgit-rs (still behind ifdef INCLUDE_LIBGIT_RS).
Quoted 38 lines · Kyle Lippincott
Quoted 33 lines · On Tue, Aug 26, 2025 at 10:53 AM <[email protected]> wrote:
Quoted 16 lines · Kyle Lippincott
Quoted 15 lines · David Aguilar
The "cargo build" invocations in contrib/ cannot be run in parallel.
"make -JN" with
INCLUDE_LIBGIT_RSenabled causes cargo lock warnings and can trigger ld errors during the build.The build errors are caused by two inner "make" invocations getting triggered concurrently: once inside of libgit-sys and another inside of libgit-rs.
Signed-off-by David Aguilar <[email protected]>--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 14 lines
Makefile libgit-sys libgit-rs: · line 3992
Quoted 10 lines
Makefile +1
-1@@ -3989,7 +3989,7 @@ libgit-sys libgit-rs: cargo build \ ) ifdef INCLUDE_LIBGIT_RS -all:: libgit-sys libgit-rs +all:: libgit-sys .WAIT libgit-rsI'm not familiar enough with make or with rust, but do we need to depend on both of these here? Wouldn't it be sufficient to say libgit-rs depends on libgit-sys, and only explicitly depend on libgit-rs in
all::?Quoted 3 lines
Not all platforms can build libgit-rs, so inserting it into as a required component is not a particularly friendly idea.
Quoted 5 lines
That's not what I was suggesting. This is already in an
ifdef, and the line I was quoting was changingall:: libgit-sys libgit-rstoall:: libgit-sys .WAIT libgit-rs. I'm wondering if we can instead split thelibgit-sys libgit-rs:from a few lines earlier intolibgit-sys:andlibgit-rs: libgit-sysand then change this all line toall:: libgit-rs(still behindifdef INCLUDE_LIBGIT_RS).
Thank you. I appreciate this and the clarity it provides.
Randall