Clean out /usr/obj directory before compiling base system of OpenBSD

I tried to build base system of OpenBSD:

# cd /usr/src 
# make obj && make build

After a while, the following weird error was reported:

cc -O2 -pipe -g -Wimplicit -I/usr/src/lib/libc/include -I/usr/src/lib/libc/hidden -D__LIBC__  -Werror-implicit-function-declaration -include namespace.h -Werror=deprecated-declarations -DAPIWARN -DYP -I/usr/src/lib/libc/yp -I/usr/src/lib/libc -I/usr/src/lib/libc/gdtoa -I/usr/src/lib/libc/arch/amd64/gdtoa -DINFNAN_CHECK -DMULTIPLE_THREADS -DNO_FENV_H -DUSE_LOCALE -I/usr/src/lib/libc -I/usr/src/lib/libc/citrus -DRESOLVSORT -DFLOATING_POINT -DPRINTF_WIDE_CHAR -DSCANF_WIDE_CHAR -DFUTEX  -MD -MP  -c -fno-pie /usr/src/lib/libc/gmon/mcount.c -o mcount.po
error: error opening 'mcount.po.d': Permission denied
1 error generated.
*** Error 1 in lib/libc (gmon/Makefile.inc:12 'mcount.po': @cc -O2 -pipe -g -Wimplicit -I/usr/src/lib/libc/include -I/usr/src/lib/libc/hidde...)
*** Error 1 in lib (<bsd.subdir.mk>:48 'all')
*** Error 1 in . (Makefile:90 'do-build')
*** Error 1 in /usr/src (Makefile:74 'build')

I worked as a root, why don’t I have permission?

After checking manual again:

The build process will place the object files in a tree under /usr/obj. This directory must be owned by build:wobj with mode 770.

The first time, the /usr/obj directory must be cleaned out completely before proceeding to avoid permission issues. After a successful release build, this is no longer needed.

I checked my /usr/obj immediately:

# ls -alt
......
drwxrwx---  15 build  wobj    512 Sep  6 09:44 obj
......

The group and mode is correct, wait, today is October, 14th, but the date of directory is September, 6th. That’s should be the issue.

After cleaning out the /usr/obj and reissuing “make obj && make build“, the above error disappeared.

3 thoughts on “Clean out /usr/obj directory before compiling base system of OpenBSD”

  1. I am fairly new to OpenBSD and looking forward to compile the the -current for the first time. And also, love your blog, please do keep write 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.