# Error when creating crunched binary for netstat



## Sam9978 (Mar 30, 2020)

I get the error "/usr/src/usr.bin/netstat/inet.c:86:10: fatal error: 'nl_defs.h' file not found" when trying to create a crunched binary of netstat (I'm actually adding lots of other programs but they are not causing problems only netstat so just keeping it simple for the sake of this post/question).

The error is on a brand new and fully updated FreeBSD 12.1 system however it works perfectly fine on a11.3 system. Any idea what the problem might be? Here's the details:



> test:/tmp/test # uname -a
> FreeBSD test.example.com 12.1-RELEASE-p3 FreeBSD 12.1-RELEASE-p3 TEST  amd64





> test:/tmp/test # cat test.conf
> srcdirs /usr/src/bin /usr/src/sbin /usr/src/usr.bin /usr/src/usr.sbin
> progs netstat
> libs -lkvm -lmemstat -lxo -lutil -lnetgraph -lelf
> ...


----------



## Phishfry (Mar 30, 2020)

> An example of an improper usage and why this matters is in usr.bin/netstat.
> nl_defs.h was only in DPSRCS and so was not generated during 'make all',
> but only during 'make depend'.  The files including it lacked proper
> depenencies on it, which forced running 'make depend' to workaround that
> ...







__





						FreeBSD_HEAD - Build #3565 - Still Failing
					





					lists.freebsd.org
				







__





						svn commit: r291330 - in head: gnu/lib/libreadline/readline lib/libc/tests/rpc usr.bin/kdump usr.bin/netstat usr.bin/svn/svn
					





					lists.freebsd.org


----------



## Sam9978 (Mar 31, 2020)

Thank you for the info. I'm not sure what this means for me though or how to work around it. Would it be possible to elaborate? Thank you!


----------



## Sam9978 (Mar 31, 2020)

When I run make in "/usr/src/usr.bin/netstat" it puts everything into "/usr/obj/usr/src/amd64.amd64/usr.bin/netstat" whereas FreeBSD 11.3 kept it all in "/usr/src/usr.bin/netstat" and it seems _crunchgen _doesn't know to look there and assumes the objdir is simply /usr/obj prefixed to the srcdir. That seems to work for the other programs I was "crunching" but not netstat. Adding "special netstat objdir /usr/obj/usr/src/amd64.amd64/usr.bin/netstat" to the config file makes it work. Is that the correct fix?


----------

