I tried to build LLVM from ports with COMPILER_RT and without libunwind from ports, since libunwind is not available on some architectures. The problem is that unwind.h is not found. It is found after copying unwind* headers to /usr/include, or after adding -I /usr/include/c++/v1, but since this is a system header, it should be possible to find it by default, so I guess moving / copying / symlinking it would be preferable.
Yeah we have to do something about this, it's an annoyance and also compares badly to Linux. On my test systems for llvm I always put symlinks: lrwxr-xr-x 1 root wheel 19 2020-11-27 21:37:38 /usr/include/unwind-arm.h@ -> c++/v1/unwind-arm.h lrwxr-xr-x 1 root wheel 23 2020-11-27 21:37:38 /usr/include/unwind-itanium.h@ -> c++/v1/unwind-itanium.h lrwxr-xr-x 1 root wheel 15 2020-11-27 21:37:38 /usr/include/unwind.h@ -> c++/v1/unwind.h However that may not be a generally acceptable solution, especially if we still have WITHOUT_CXX? Otherwise, we should install the actual unwind*.h files in /usr/include and make symlinks in /usr/include/c++/v1. Or maybe leave the latter out entirely, but that could break some esoteric use cases. An exp-run would be required, in any case. That said, I also remember there being some discussion about us having multiple different unwind.h (and friends) in our tree, in fact there are four (!): /usr/src/include/unwind.h /usr/src/contrib/llvm-project/libunwind/include/unwind.h /usr/src/contrib/llvm-project/clang/lib/Headers/unwind.h /usr/src/contrib/libcxxrt/unwind.h The first one is some old version from HP, the second is from llvm libunwind, the third is a clang internal wrapper, and the last is from libcxxrt, which is the one we currently install into /usr/include/c++/v1. At some point it would probably be nice to use the one from llvm libunwind, which is probably the most maintained one. It should then also be safe to put the clang unwind.h in /usr/lib/clang/x.y.z/include, as it is supposed to work well with the other.
https://reviews.freebsd.org/D34005 after universe completes, I'll request an exp-run.
commit c00d345665366a89aaba7244d6f078dc756f4c53 Author: John Baldwin <jhb@FreeBSD.org> Date: Thu Feb 10 18:57:49 2022 +0100 Install unwind.h into /usr/include Install headers from LLVM's libunwind in place of the headers from libcxxrt and allow C applications to use the library. As part of this, remove include/unwind.h and switch libthr over to using the installed unwind.h. Reviewed by: dim, emaste MFC after: 10 days Differential Revision: https://reviews.freebsd.org/D34065