Jörg's NetBSD blog

Mysterious build failures

The bulk builds are a great way to find build issues. Sometimes they are pretty puzzling though, because they show issues that don't appear otherwise.

I recently added the full DESTDIR support for emulators/handy_sdl, after making sure that the do-install rules are fine. The package compiled fine during my tests, but failed in the next run of pbulk with a dependency error from gmake. This was very puzzling as it was still working when starting the build manually.

The first idea was to look for the same problem that broke some Emacs packages. The Emacs packages had been failing in the bulk build for the obvious reason with a rather impossible error message (-batch missing when it was clearly specified). After some digging it turned out that the Makefile used the variable BATCH, which is already set in bulk builds to prevent interactions e.g. when patches don't apply. Turned out to be a dead end.

After some scratching the head I tried to fully replicate the build and started it as unprivileged user. As pkgsrc allows building packages with PKG_DESTDIR_SUPPORT=user-destdir without privileges, pbulk naturally uses that too. That was an instant hit -- the build fails if done unprivileged. Looking at the tarball of the work area from the bulk build, it became obvious why. The src directory is not executable and therefore gmake couldn't scan it. Turns out, a single chmod -R a+x fixes the problem.