Skip to content

Response files needed sometimes even on non-windows systems #7212

@dankegel

Description

@dankegel

A user porting www.flintlib.org to meson ran into a commandline length limit
when it tried to link > 3300 files into a single library, with error

ninja: fatal: posix_spawn: Argument list too long

https://www.in-ulm.de/~mascheck/various/argmax/ 
says cygwin has the tightest limit on commandline length, but FreeBSD also has a smallish limit.
I was able to reproduce the error on FreeBSD with the following script:

#!/bin/sh
set -ex
n=1
echo "project('toolong', 'c')" > meson.build
echo "srcs = [" >> meson.build
while test $n -lt 12000
do
    echo "int f$n(int x) { return x + $n; }" > foo$n.c
    echo " 'foo$n.c'," >> meson.build
    n=$(expr $n + 1)
done
echo "]" >> meson.build
echo "library('toolong', srcs)" >> meson.build
meson . btmp
cd btmp
ninja -v

CMake successfully avoids the problem by using a response file, and meson should, too.
(Though ideally it should avoid them when not needed, as they do make debugging a little harder.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions