Commit b79eb43
committed
fix(build): link through a response file on every platform, not just Windows
Discovered by running the real mcpp-index workspace against the #344 branch:
`opencv-module`, `opencv-module-dnn` and `opencv-module-unifont` all died with
ninja: fatal: posix_spawn: Argument list too long
naming no edge, no file and no cause. #344 lengthened dependency object paths
(they now carry a per-package directory) and that was enough to cross a ceiling
nothing was watching.
The rule emitter said rsp was needed only where commands spawn through
CreateProcess, and that "POSIX driver-style keeps the inline form: ARG_MAX is
ample". Both halves are wrong. ninja runs `sh -c "<whole command>"` on POSIX, so
the command is a SINGLE argv entry and the limit is MAX_ARG_STRLEN — 32 pages,
128 KiB — not the 2 MiB ARG_MAX anyone would think to check. And it was never
ample: measured on opencv-module, the inline link line was already 56 840 bytes
before this branch, 43% of the ceiling. With #344's paths it reached 161 687.
So: rsp always, every platform, every dialect. clang/gcc drivers, link.exe, GNU
ar and llvm-ar all accept @rspfile, so this is one rule shape instead of two,
and the response file next to the output reads better than a 160 KB command line
anyway. A build system may not have a maximum project size that it discovers by
crashing, and "how long is this command" must not be something anyone carries in
their head when choosing an object path.
The unit test asserted the falsified premise for POSIX ("must NOT use rspfile");
it now asserts the invariant on every platform, plus that `$in` appears exactly
once per rule — as rspfile_content, never inlined into the command.
Note this was invisible to all 18 CI jobs: none of them builds an
opencv-class package. CI has no large-link coverage at all.1 parent d1d02cb commit b79eb43
3 files changed
Lines changed: 53 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
749 | 749 | | |
750 | 750 | | |
751 | 751 | | |
752 | | - | |
753 | | - | |
754 | | - | |
755 | | - | |
756 | | - | |
757 | | - | |
758 | | - | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
759 | 777 | | |
760 | | - | |
| 778 | + | |
761 | 779 | | |
762 | 780 | | |
763 | 781 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
570 | 570 | | |
571 | 571 | | |
572 | 572 | | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
579 | 590 | | |
580 | 591 | | |
581 | 592 | | |
| |||
587 | 598 | | |
588 | 599 | | |
589 | 600 | | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | | - | |
596 | | - | |
597 | | - | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
598 | 607 | | |
599 | 608 | | |
600 | 609 | | |
| |||
0 commit comments