#1107164 /usr/bin/x86_64-linux-gnux32-ld.bfd: /bin/ld: cryptic "error: could not close arguments file" when /tmp ENOSPC

Package:
binutils-x86-64-linux-gnux32
Source:
binutils-x86-64-linux-gnux32
Description:
GNU binary utilities, for x86-64-linux-gnux32 target
Submitter:
наб
Date:
2025-06-02 15:13:02 UTC
Severity:
normal
#1107164#5
Date:
2025-06-02 15:11:02 UTC
From:
To:
Dear Maintainer,

I'd recently been hit with the following error
  $ make
  ...
  /bin/ld: error: could not close arguments file
  collect2: error: ld returned 1 exit status

This told me approximately exactly nothing.

Running under strace got me
  [pid 24432] execve("/bin/ld", ["/bin/ld", "-plugin", "/usr/libexec/gcc/x86_64-linux-gn"..., "-plugin-opt=/usr/libexec/gcc/x86"..., "-plugin-opt=-fresolution=/tmp/cc"..., "-plugin-opt=-pass-through=-lgcc_"..., "-plugin-opt=-pass-through=-lgcc",
  "-plugin-opt=-pass-through=-lc", "-plugin-opt=-pass-through=-lgcc_"..., "-plugin-opt=-pass-through=-lgcc", "--build-id", "--eh-frame-hdr", "-m", "elf32_x86_64", "--hash-style=gnu", "--as-needed", "-dynamic-linker", "/libx32/ld-linux-x32.so.2",
  "-o", "out/cmd/sha1sum", "/usr/lib/gcc/x86_64-linux-gnux32"..., "/usr/lib/gcc/x86_64-linux-gnux32"..., "/usr/lib/gcc/x86_64-linux-gnux32"..., "-L.", "-L/usr/lib/gcc/x86_64-linux-gnux"..., "-L/usr/lib/gcc/x86_64-linux-gnux"..., "-L/usr/lib/gcc/x86_64-linux-gnux"..., "-L/lib/x86_64-linux-gnux32", "-L/lib/../lib", "-L/usr/lib/x86_64-linux-gnux32", "-L/usr/lib/../lib", "-L/usr/lib/gcc/x86_64-linux-gnux"..., ...], 0xffead340 /* 30 vars */) = 0
  ...
  [pid 24432] close(24</usr/lib/x86_64-linux-gnux32/crtn.o>) = 0
  [pid 24432] openat(AT_FDCWD, "/tmp/cctPrR3D.res", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 24</tmp/cctPrR3D.res>
  [pid 24432] fstat(24</tmp/cctPrR3D.res>, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
  [pid 24432] write(24</tmp/cctPrR3D.res>, "1\nout/obj/cmd/sha1sum.o 49\n1403 "..., 2983) = -1 ENOSPC (No space left on device)
  [pid 24432] close(24</tmp/cctPrR3D.res>) = 0
  [pid 24432] access("/tmp", R_OK|W_OK|X_OK) = 0
  [pid 24432] newfstatat(AT_FDCWD, "/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=120, ...}, 0) = 0
  [pid 24432] getrandom("\xb8\xaf\xb3\x9d\x12\x06\x4c\x72", 8, GRND_NONBLOCK) = 8
  [pid 24432] openat(AT_FDCWD, "/tmp/ccKgS4FG.lto_wrapper_args", O_RDWR|O_CREAT|O_EXCL, 0600) = 24</tmp/ccKgS4FG.lto_wrapper_args>
  [pid 24432] close(24</tmp/ccKgS4FG.lto_wrapper_args>) = 0
  [pid 24432] openat(AT_FDCWD, "/tmp/ccKgS4FG.lto_wrapper_args", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 24</tmp/ccKgS4FG.lto_wrapper_args>
  [pid 24432] fstat(24</tmp/ccKgS4FG.lto_wrapper_args>, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
  [pid 24432] write(24</tmp/ccKgS4FG.lto_wrapper_args>, "-fresolution=/tmp/cctPrR3D.res\n-"..., 74) = -1 ENOSPC (No space left on device)
  [pid 24432] close(24</tmp/ccKgS4FG.lto_wrapper_args>) = 0
  [pid 24432] write(2</dev/pts/0>, "/bin/ld", 7/bin/ld) = 7
  [pid 24432] write(2</dev/pts/0>, ": error: could not close argumen"..., 40: error: could not close arguments file
  ) = 40
  [pid 24432] close(3</home/nabijaczleweli/code/voreutils/out/cmd/sha1sum>) = 0
  ...
  [pid 24432] exit_group(1)               = ?
  [pid 24432] +++ exited with 1 +++
  [pid 24431] <... wait4 resumed>[{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0, NULL) = 24432
  [pid 24431] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=24432, si_uid=0, si_status=1, si_utime=5, si_stime=5} ---
  [pid 24431] write(2</dev/pts/0>, "collect2: error: ld returned 1 e"..., 43collect2: error: ld returned 1 exit status
  ) = 43
  [pid 24431] newfstatat(AT_FDCWD, "/tmp/cc6XoSso.cdtor.c", {st_mode=S_IFREG|0600, st_size=0, ...}, AT_SYMLINK_NOFOLLOW) = 0
  [pid 24431] unlink("/tmp/cc6XoSso.cdtor.c") = 0
  [pid 24431] newfstatat(AT_FDCWD, "/tmp/ccUczhfu.cdtor.o", {st_mode=S_IFREG|0600, st_size=0, ...}, AT_SYMLINK_NOFOLLOW) = 0
  [pid 24431] unlink("/tmp/ccUczhfu.cdtor.o") = 0
  [pid 24431] exit_group(1)               = ?
  [pid 24431] +++ exited with 1 +++

And indeed
  $ unshare -rm
  # mount -t tmpfs -o size=100k tmpfs /tmp
  # seq inf > /tmp/fill
  seq: write error: No space left on device
  # g++ -g -O3 -pipe -Wall -Wextra -fPIC -fno-math-errno -fno-threadsafe-statics -fvisibility=hidden -MD -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 -flto -Wno-missing-field-initializers     -DVOREUTILS_LIBGMP   -fno-exceptions -fno-rtti -o out/cmd/sha1sum out/obj/cmd/sha1sum.o -Wl,--as-needed   -L.  -lgmpxx -lgmp  -lcrypto
  /bin/ld: error: could not close arguments file
  collect2: error: ld returned 1 exit status
repros this.

Would be nice if the error showed the error instead of obfuscating it
for no apparent reason. Had I not known how to pick this out
out of strace I would've been SOL.

Best,