I sometimes get the following error when I build GhostPDL (complete build log: http://pkg.triaxx.org/pub/pkgsrc/reports/NetBSD/amd64/9.2/20211230.2208/ghostscript-agpl-9.55.0nb1/build.log): gmake[2]: Leaving directory '/tmp/work/ghostscript-9.55.0' /usr/pkg/bin/gmake -f Makefile DISPLAY_DEV=./soobj/display.dev BUILDDIRPREFIX=so GENOPT='' LDFLAGS='-L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib '\ CFLAGS='-O2 -DNDEBUG -I/usr/pkg/include -I/usr/include/krb5 -I/usr/include -I/usr/pkg/include/freetype2 -Wall -Wstrict-prototypes -Wundef -Wmissing-declarations -Wmissing-prototypes -Wwrite-strings -fno-strict-aliasing -Werror=declaration-after-statement -fno-builtin -fno-common -Werror=return-type -DHAVE_STDINT_H=1 -DHAVE_DIRENT_H=1 -DHAVE_SYS_DIR_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_TIMES_H=1 -DHAVE_INTTYPES_H=1 -DGX_COLOR_INDEX_TYPE="unsigned long long" -D__USE_UNIX98=1 -DBUILD_PDF=1 -I./pdf -O2 -fPIC -D_FORTIFY_SOURCE=2 -DA4 -fPIC -I/usr/pkg/include -I/usr/include/krb5 -I/usr/include -I/usr/pkg/include/freetype2 -DHAVE_RESTRICT=1 -I/usr/pkg/include -DUSE_LIBPAPER -I/usr/pkg/include -fno-strict-aliasing -DHAVE_POPEN_PROTO=1 ' prefix=/usr/pkg\ ./sobin/gsc ./sobin/gsx -so-loader -so-loader -so-loader -so-loader gmake[2]: Entering directory '/tmp/work/ghostscript-9.55.0' gcc: error: ./soobj/dxmainc.o: No such file or directory gmake[2]: *** [base/unix-dll.mak:198: sobin/gsc] Error 1 I sometimes also get the following error: ld: ./soobj/dxmainc.o: file not recognized: file truncated The incriminated target is in base/unix-dll.mak: $(GSSOC_XE): gs-so-links-subtarget $(PSSRC)dxmainc.c $(UNIX_DLL_MAK) $(MAKEDIRS) $(GLCC) $(GLO_)dxmainc.$(OBJ) $(C_) $(PSSRC)dxmainc.c $(GLCC) -L$(BINDIR) -L$(PREFIX)/lib -Wl,-R$(PREFIX)/lib $(LDFLAGS) $(O_) $(GSSOC_XE) $(GLOBJ)dxmainc.$(OBJ) -l$(GS_SO_BASE) This error does not occur each time. But it is really annoying when it occurs during the building of a large set of packages since it is a dependency for a lot of packages.
I had a script build repeatedly and it ran to ~160 times, and it never failed, so I have no real clue about why you see this problem. I did commit a small change which, I think, makes the rules a little neater, maybe they will help.... https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=9aae213ff3ae If you keep seeing the problem with the above commit, please reopen this report.
I discussed with people who have never been able to reproduce this bug. I reproduced several times and I know I am not alone. In any case, I commit your patch in the pkgsrc's tree and I hope it will fix. Thank you a lot for the time you spent looking at this issue!