Comment 3 for bug 1971901

Revision history for this message
In , Mikpelinux (mikpelinux) wrote :

With binutils-2.38 in a cross to x86_64-w64-mingw32 I persistently see random breakage in dlltool during the build of mingw-w64's "crt".

Example 1:
...
x86_64-w64-mingw32-dlltool --as-flags=--64 -m i386:x86-64 -k --as=x86_64-w64-mingw32-as --output-lib lib64/libd3dcompiler_33.a --input-def /tmp/mingw-w64-v9.0.0/mingw-w64-crt/lib64/d3dcompiler_33.def
x86_64-w64-mingw32-dlltool --as-flags=--64 -m i386:x86-64 -k --as=x86_64-w64-mingw32-as --output-lib lib64/libd3dcompiler_34.a --input-def /tmp/mingw-w64-v9.0.0/mingw-w64-crt/lib64/d3dcompiler_34.def
x86_64-w64-mingw32-dlltool --as-flags=--64 -m i386:x86-64 -k --as=x86_64-w64-mingw32-as --output-lib lib64/libd3dcompiler_35.a --input-def /tmp/mingw-w64-v9.0.0/mingw-w64-crt/lib64/d3dcompiler_35.def
x86_64-w64-mingw32-dlltool --as-flags=--64 -m i386:x86-64 -k --as=x86_64-w64-mingw32-as --output-lib lib64/libd3dcompiler_36.a --input-def /tmp/mingw-w64-v9.0.0/mingw-w64-crt/lib64/d3dcompiler_36.def
Assembler messages:
Error: can't open D3DCompiler_dll_t.s for reading: No such file or directory
x86_64-w64-mingw32-dlltool --as-flags=--64 -m i386:x86-64 -k --as=x86_64-w64-mingw32-as --output-lib lib64/libd3dcompiler_37.a --input-def /tmp/mingw-w64-v9.0.0/mingw-w64-crt/lib64/d3dcompiler_37.def
x86_64-w64-mingw32-dlltool: x86_64-w64-mingw32-as exited with status 1
x86_64-w64-mingw32-dlltool: failed to open temporary tail file: D3DCompiler_dll_t.o: No such file or directory
x86_64-w64-mingw32-dlltool: cannot delete D3DCompiler_dll_s00000.o: No such file or directory
x86_64-w64-mingw32-dlltool: cannot delete D3DCompiler_dll_s00001.o: No such file or directory
x86_64-w64-mingw32-dlltool: cannot delete D3DCompiler_dll_s00002.o: No such file or directory
x86_64-w64-mingw32-dlltool: cannot delete D3DCompiler_dll_s00003.o: No such file or directory
x86_64-w64-mingw32-dlltool: cannot delete D3DCompiler_dll_s00004.o: No such file or directory
x86_64-w64-mingw32-dlltool: cannot delete D3DCompiler_dll_s00005.o: No such file or directory
x86_64-w64-mingw32-dlltool: cannot delete D3DCompiler_dll_s00006.o: No such file or directory
x86_64-w64-mingw32-dlltool: cannot delete D3DCompiler_dll_s00007.o: No such file or directory
x86_64-w64-mingw32-dlltool: cannot delete D3DCompiler_dll_s00008.o: No such file or directory
x86_64-w64-mingw32-dlltool: cannot delete D3DCompiler_dll_s00009.o: No such file or directory
make[1]: *** [Makefile:83854: lib64/libd3dcompiler_36.a] Error 1
make[1]: *** Waiting for unfinished jobs....
x86_64-w64-mingw32-dlltool: cannot delete D3DCompiler_dll_s00000.o: No such file or directory
x86_64-w64-mingw32-dlltool: cannot delete D3DCompiler_dll_s00001.o: No such file or directory
x86_64-w64-mingw32-dlltool: cannot delete D3DCompiler_dll_s00002.o: No such file or directory
x86_64-w64-mingw32-dlltool: cannot delete D3DCompiler_dll_s00003.o: No such file or directory
x86_64-w64-mingw32-dlltool: cannot delete D3DCompiler_dll_s00004.o: No such file or directory
x86_64-w64-mingw32-dlltool: cannot delete D3DCompiler_dll_s00005.o: No such file or directory
x86_64-w64-mingw32-dlltool: cannot delete D3DCompiler_dll_s00006.o: No such file or directory
x86_64-w64-mingw32-dlltool: cannot delete D3DCompiler_dll_s00007.o: No such file or directory
x86_64-w64-mingw32-dlltool: cannot delete D3DCompiler_dll_s00008.o: No such file or directory
x86_64-w64-mingw32-dlltool: cannot delete D3DCompiler_dll_s00009.o: No such file or directory

Example 2:
...
x86_64-w64-mingw32-dlltool --as-flags=--64 -m i386:x86-64 -k --as=x86_64-w64-mingw32-as --output-lib lib64/libd3dx9.a --input-def /tmp/mingw-w64-v9.0.0/mingw-w64-crt/lib64/d3dx9_43.def
x86_64-w64-mingw32-dlltool --as-flags=--64 -m i386:x86-64 -k --as=x86_64-w64-mingw32-as --output-lib lib64/libd3dx10.a --input-def /tmp/mingw-w64-v9.0.0/mingw-w64-crt/lib64/d3dx10_43.def
x86_64-w64-mingw32-dlltool: lib32/libd3dx9.a: error reading d3dx9_43_dll_h.o: file truncated
make[1]: *** [Makefile:83819: lib32/libd3dx9.a] Error 1
make[1]: *** Waiting for unfinished jobs....
x86_64-w64-mingw32-dlltool: lib64/libd3dx9.a: error reading d3dx9_43_dll_t.o: No such file or directory

I've also seen it produce .a files that ar complained about containing invalid or truncated files.

These random failures occur persistently when using binutils-2.38 and parallel make (make -jN) for mingw-w64's crt. The failures disappear if I use non-parallel make, or revert to binutils-2.37.

A git bisect identified this late change in 2.38 development as the cause:

# first bad commit: [fdeee5d59dca41e3c70c399a939105e39a4b4282] Allow inferring tmp_prefix from the dll name from a def file

which makes sense since it touches dlltool.c.

Host: x86_64-pc-linux-gnu (Fedora 34)

Steps for building cross to mingw-w64 (each in a separate build dir):

/tmp/binutils-2.38/configure --target=x86_64-w64-mingw32 --enable-targets=x86_64-w64-mingw32,i686-w64-mingw32 --prefix=/tmp/cross-mingw64 --with-sysroot=/tmp/cross-mingw64 --disable-gdb --disable-gold --disable-nls --disable-plugins --disable-readline --disable-sim; make -j; make install
/tmp/mingw-w64-v9.0.0/mingw-w64-headers/configure --prefix=/tmp/cross-mingw64/x86_64-w64-mingw32 --host=x86_64-w64-mingw32; make install; ln -sf x86_64-w64-mingw32 /tmp/cross-mingw64/mingw
/tmp/gcc-11.2.0/configure --target=x86_64-w64-mingw32 --prefix=/tmp/cross-mingw64 --with-sysroot=/tmp/cross-mingw64 --disable-libatomic --disable-libgomp --disable-libitm --disable-libmpx --disable-libquadmath --disable-libsanitizer --disable-lto --disable-nls --disable-plugin --disable-shared --enable-checking=release --enable-multilib --enable-64bit --with-dwarf --enable-threads=win32 --enable-languages=c; make -j all-gcc; make install-gcc
/tmp/mingw-w64-v9.0.0/mingw-w64-crt/configure --prefix=/tmp/cross-mingw64/x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --enable-lib32 --enable-lib64; make -j
(it's the last step above that fails in dlltool)
(to be followed by install of crt and rebuild of full gcc)