textproc/groff fails to build with libc++ 10.0. groff blocks over a thousand package paths, so this needs to be fixed before we can switch to the newer libc++.
Analysis: groff includes a copy of gnulib. gnulib provides *.h wrappers for some standard header files. Those wrappers are not standalone. They are intended to be included in a source file after "config.h" has been included. In particular, gnulib has a wrapper for math.h, but not for stdlib.h. In libc++ 10, <stdlib.h> includes <math.h>. When building groff, this include directive picks up the gnulib math.h wrapper. Since <stdlib.h> is included from some source files that do not include the local config.h, the math.h wrapper will then error out: error: "Please include config.h first." Possible solutions: Cherrypick the libc++ upstream patch that untangles the interactions between the two header files and stops stdlib.h from including math.h. https://github.com/llvm/llvm-project/commit/c490c5e81ac90cbf079c7cee18cd56171f1e27af That patch looks very sensible, but as the commit history shows there were problems related to "local submodule visibility" and I don't know what that is and how it affects us. In the groff port, we could add #include "config.h" to all files that don't do so already and include <stdlib.h>. This is relatively clean, but will touch a number of files. In the groff port, we could alternatively copy FreeBSD's pragmatic solution and simply add #include "config.h" to the math.h wrapper. That's not correct in some larger gnulib sense, but should suffice for the purposes of the port. Since the problem originates with gnulib, it could affect ports other than groff, too. However, a cursory search of the FreeBSD ports tree shows only one other port with a gnulib math.in.h patch, and that one is unrelated. Suggestions? -- Christian "naddy" Weisgerber [email protected]
