Bug#1070857: nix: FTBFS: /usr/bin/ld: cannot find src/libutil/tests/libnixutil-tests.a: No such file or directory

2024-05-10 Thread Santiago Vila

As promised, here is the patch.

Note: I have actually tested it, and it fixed the build failure for me.
(Thanks to Sergei Trofimovich who helped me to find the fix in the git repo)

Thanks.commit e1cc73faee68409dfdac07a39dca517813a40e2c
Author: Santiago Vila 
Date:   Fri May 10 14:45:00 2024 +0200

Cherry-pick two upstream patches to fix makefile bug. Closes: #1070857.

diff --git a/debian/patches/0013-fix-makefile-bug.patch 
b/debian/patches/0013-fix-makefile-bug.patch
new file mode 100644
index 0..3765db1ec
--- /dev/null
+++ b/debian/patches/0013-fix-makefile-bug.patch
@@ -0,0 +1,22 @@
+From: John Ericson 
+Date: Tue Nov 14 11:42:25 2023 -0500
+Subject: Fix makefile bug confusing `libnixutil-test` exe vs lib
+Bug-Debian: https://bugs.debian.org/1070857
+Origin: upstream, 
https://github.com/NixOS/nix/commit/9c7749e13508996eb9df83b1692664cc8cdbf952
+Forwarded: not-needed
+Last-Update: 2024-05-10
+
+The `-exe` variant is the program, the unsuffixed variant is the library.
+
+The corrected usage matches `libnixstore-test`.
+
+--- a/src/libutil/tests/local.mk
 b/src/libutil/tests/local.mk
+@@ -1,6 +1,6 @@
+ check: libutil-tests_RUN
+ 
+-programs += libutil-tests
++programs += libutil-tests-exe
+ 
+ libutil-tests-exe_NAME = libnixutil-tests
+ 
diff --git a/debian/patches/0014-fix-make-check.patch 
b/debian/patches/0014-fix-make-check.patch
new file mode 100644
index 0..f96519e34
--- /dev/null
+++ b/debian/patches/0014-fix-make-check.patch
@@ -0,0 +1,19 @@
+From: John Ericson 
+Date: Fri Nov 17 11:26:45 2023 -0500
+Subject: Fix `make check`
+Bug-Debian: https://bugs.debian.org/1070857
+Origin: upstream, 
https://github.com/NixOS/nix/commit/293ae592576bb9c48975466613fcba6a30d06f5e
+Forwarded: not-needed
+Last-Update: 2024-05-10
+
+After 9c7749e13508996eb9df83b1692664cc8cdbf952, `libutil-tests_RUN`
+doesn't exist. It needs to become `libutil-tests-exe_RUN`.
+
+--- a/src/libutil/tests/local.mk
 b/src/libutil/tests/local.mk
+@@ -1,4 +1,4 @@
+-check: libutil-tests_RUN
++check: libutil-tests-exe_RUN
+ 
+ programs += libutil-tests-exe
+ 
diff --git a/debian/patches/series b/debian/patches/series
index ef37b55cc..cd4bc73d9 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -10,3 +10,5 @@
 0010-libexpr-Add-various-files-to-clean-files.patch
 0011-manual-Add-various-files-to-clean-files.patch
 0012-nix-Add-various-files-to-clean-files.patch
+0013-fix-makefile-bug.patch
+0014-fix-make-check.patch


Bug#1070857: nix: FTBFS: /usr/bin/ld: cannot find src/libutil/tests/libnixutil-tests.a: No such file or directory

2024-05-10 Thread Santiago Vila

Package: src:nix
Version: 2.18.1+dfsg-1
Severity: serious
Tags: ftbfs fixed-upstream patch

Dear maintainer:

During a rebuild of all packages in unstable, your package failed to build:


[...]
g++ -o src/libstore/tests/nar-info-disk-cache.o -c src/libstore/tests/nar-info-disk-cache.cc 
-Wdate-time -D_FORTIFY_SOURCE=2  -fstack-protector-strong -Wformat -Werror=format-security 
-ffile-prefix-map=/<>=. -O3  -Wdate-time -D_FORTIFY_SOURCE=2 -g 
-Wno-deprecated-declarations -Werror=switch -g -Wall -include config.h -std=c++2a -I src 
-I/usr/include/x86_64-linux-gnu -I/usr/include/libcpuid -DREADLINE -I/usr/include/x86_64-linux-gnu 
-DLIBARCHIVE_STATIC -I/usr/include -g -O2 -ffile-prefix-map=/<>=. 
-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -I 
src/libstore -I src/libutil -Werror=switch-enum -MMD -MF src/libstore/tests/.nar-info-disk-cache.o.dep 
-MP
g++ -o src/libstore/tests/outputs-spec.o -c src/libstore/tests/outputs-spec.cc -Wdate-time 
-D_FORTIFY_SOURCE=2  -fstack-protector-strong -Wformat -Werror=format-security 
-ffile-prefix-map=/<>=. -O3  -Wdate-time -D_FORTIFY_SOURCE=2 -g 
-Wno-deprecated-declarations -Werror=switch -g -Wall -include config.h -std=c++2a -I src 
-I/usr/include/x86_64-linux-gnu -I/usr/include/libcpuid -DREADLINE -I/usr/include/x86_64-linux-gnu 
-DLIBARCHIVE_STATIC -I/usr/include -g -O2 -ffile-prefix-map=/<>=. 
-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -I 
src/libstore -I src/libutil -Werror=switch-enum -MMD -MF src/libstore/tests/.outputs-spec.o.dep -MP
g++ -o src/libstore/tests/path.o -c src/libstore/tests/path.cc -Wdate-time -D_FORTIFY_SOURCE=2  
-fstack-protector-strong -Wformat -Werror=format-security 
-ffile-prefix-map=/<>=. -O3  -Wdate-time -D_FORTIFY_SOURCE=2 -g 
-Wno-deprecated-declarations -Werror=switch -g -Wall -include config.h -std=c++2a -I src 
-I/usr/include/x86_64-linux-gnu -I/usr/include/libcpuid -DREADLINE -I/usr/include/x86_64-linux-gnu 
-DLIBARCHIVE_STATIC -I/usr/include -g -O2 -ffile-prefix-map=/<>=. 
-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -I 
src/libstore -I src/libutil -Werror=switch-enum -MMD -MF src/libstore/tests/.path.o.dep -MP
g++ -o src/libstore/tests/references.o -c src/libstore/tests/references.cc -Wdate-time 
-D_FORTIFY_SOURCE=2  -fstack-protector-strong -Wformat -Werror=format-security 
-ffile-prefix-map=/<>=. -O3  -Wdate-time -D_FORTIFY_SOURCE=2 -g 
-Wno-deprecated-declarations -Werror=switch -g -Wall -include config.h -std=c++2a -I src 
-I/usr/include/x86_64-linux-gnu -I/usr/include/libcpuid -DREADLINE -I/usr/include/x86_64-linux-gnu 
-DLIBARCHIVE_STATIC -I/usr/include -g -O2 -ffile-prefix-map=/<>=. 
-fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -fcf-protection -I 
src/libstore -I src/libutil -Werror=switch-enum -MMD -MF src/libstore/tests/.references.o.dep -MP
ld  -r -o tests/test-libstoreconsumer/libnixstore-tests.o 
src/libstore/tests/derivation.o src/libstore/tests/derived-path.o 
src/libstore/tests/downstream-placeholder.o src/libstore/tests/machines.o 
src/libstore/tests/nar-info-disk-cache.o src/libstore/tests/outputs-spec.o 
src/libstore/tests/path.o src/libstore/tests/references.o
ar crs src/libstore/tests/libnixstore-tests.a 
tests/test-libstoreconsumer/libnixstore-tests.o
g++ -o src/libstore/tests/libnixstore-tests -L/usr/lib/x86_64-linux-gnu 
-Wl,-z,relro -Wl,-z,now  -L/usr/lib/x86_64-linux-gnu -Wl,-z,relro -Wl,-z,now  
-lgtest_main -lgtest  src/libstore/tests/libnixstore-tests.a -lrapidcheck 
-lgtest_main -lgtest  src/libutil/tests/libnixutil-tests.a -lrapidcheck 
-lgtest_main -lgtest  src/libutil/libnixutil.a -pthread -lcrypto -ldl -pthread 
-lbrotlienc -lbrotlicommon -lbrotlidec -lbrotlicommon -larchive -lnettle -lacl 
-llzma -lzstd -llz4 -lbz2 -lz -lxml2 -lz -L/usr/lib/x86_64-linux-gnu 
-lboost_context -lcpuid   src/libstore/libnixstore.a -lsqlite3 -lm -lz -lcurl 
-lnghttp2 -lidn2 -lrtmp -lssh2 -lssh2 -lpsl -lnettle -lgnutls -lgssapi_krb5 
-llber -lldap -llber -lzstd -lbrotlidec -lz -lsodium -pthread -pthread -ldl 
-lseccomp  src/libutil/libnixutil.a -pthread -lcrypto -ldl -pthread -lbrotlienc 
-lbrotlicommon -lbrotlidec -lbrotlicommon -larchive -lnettle -lacl -llzma 
-lzstd -llz4 -lbz2 -lz -lxml2 -lz -L/usr/lib/x86_64-linux-gnu -lboost_context 
-lcpuid   src/libutil/libnixutil.a -pthread -lcrypto -ldl -pthread -lbrotlienc 
-lbrotlicommon -lbrotlidec -lbrotlicommon -larchive -lnettle -lacl -llzma 
-lzstd -llz4 -lbz2 -lz -lxml2 -lz -L/usr/lib/x86_64-linux-gnu -lboost_context 
-lcpuid
/usr/bin/ld: cannot find src/libutil/tests/libnixutil-tests.a: No such file or 
directory
collect2: error: ld returned 1 exit status
make[1]: *** [mk/lib.mk:120: src/libstore/tests/libnixstore-tests] Error 1
rm src/nix/doc/files/profiles.md
make[1]: Leaving directory '/<>'