Bug 261397 - unwind* headers are in wrong location
Summary: unwind* headers are in wrong location
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: standards (show other bugs)
Version: 13.0-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: Dimitry Andric
URL:
Keywords:
Depends on: 261412
Blocks:
  Show dependency treegraph
 
Reported: 2022-01-21 22:26 UTC by Piotr Kubaj
Modified: 2022-02-13 13:33 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Piotr Kubaj freebsd_committer 2022-01-21 22:26:42 UTC
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.
Comment 1 Dimitry Andric freebsd_committer 2022-01-21 23:32:30 UTC
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.
Comment 2 Dimitry Andric freebsd_committer 2022-01-22 21:08:52 UTC
https://reviews.freebsd.org/D34005

after universe completes, I'll request an exp-run.
Comment 3 Dimitry Andric freebsd_committer 2022-02-13 13:33:41 UTC
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