Skip to content

Commit e40108a

Browse files
committed
Fix postgresql-musl dev↔lib reference cycle
The postgresql multi-output build for musl cross-compilation fails with: error: cycle detected in build of '...-postgresql-aarch64-unknown-linux-musl-17.7.drv' in the references of output 'dev' from output 'lib' The lib output picks up references to dev through .la files (libtool archives with baked-in -I/-L paths) and possibly .pc files. Since dev already references lib (for -L flags in pkgconfig), this creates a cycle. Fix by adding postFixup that: 1. Deletes .la files from lib (unnecessary for runtime, embed dev paths) 2. Strips remaining dev references from lib via remove-references-to
1 parent b39884c commit e40108a

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

flake.nix

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,16 @@
171171
outputChecks = {};
172172
separateDebugInfo = false;
173173
disallowedReferences = [];
174-
# Bump cache breaker v3: pre-built GCC on hydra with sandbox
175-
# /usr/include, cleared all FailedPaths. Orphaned paths cleaned
176-
# on all builders 2026-02-19.
177-
preBuild = (old.preBuild or "") + ''
178-
# cache breaker v3: 2026-02-19 all orphaned paths cleaned
179-
true
174+
# Break the dev↔lib reference cycle: dev naturally references
175+
# lib (via .pc -L flags), but lib also picks up dev references
176+
# through .la files and baked-in paths. Strip dev refs from lib
177+
# since lib is a runtime output that doesn't need dev at runtime.
178+
postFixup = (old.postFixup or "") + ''
179+
# Delete .la files from lib — libtool archives embed absolute
180+
# paths to dev headers/libs and are unnecessary for runtime.
181+
find "$lib" -name '*.la' -delete
182+
# Strip any remaining references to $dev from the lib output.
183+
find "$lib" -type f -exec remove-references-to -t "$dev" {} +
180184
'';
181185
});
182186
});

0 commit comments

Comments
 (0)