Bug 261412

Summary: [exp-run] With llvm-unwind headers placed in /usr/include
Product: Ports & Packages Reporter: Dimitry Andric <dim>
Component: Ports FrameworkAssignee: Port Management Team <portmgr>
Status: Closed Overcome By Events    
Severity: Affects Many People CC: emaste, jbeich, ports-bugs, sbz, yuri
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 261397    

Description Dimitry Andric freebsd_committer freebsd_triage 2022-01-23 10:41:36 UTC
As reported in bug 261397, we are currently missing unwind.h and related headers in /usr/include, so some programs can't find them. We do have these headers in /usr/include/c++/v1, as part of the libcxxrt and libc++ installation, but this does not seem to be a standard location.

In https://reviews.freebsd.org/D34005 I have a patch that accomplishes two things:
* It moves unwind headers to /usr/include
* It uses the llvm-libunwind headers instead of the older libcxxrt ones

Please perform an exp-run with this patch applied, making sure that the obsolete files are deleted (to get rid of the unwind headers in /usr/include/c++/v1).
Comment 1 Antoine Brodin freebsd_committer freebsd_triage 2022-02-02 18:41:05 UTC
Here are the new failure logs:

http://gohan04.nyi.freebsd.org/data/main-amd64-PR261412-default/2022-01-31_21h03m46s/logs/errors/google-perftools-2.9.1_3.log
http://gohan04.nyi.freebsd.org/data/main-amd64-PR261412-default/2022-01-31_21h03m46s/logs/errors/libreoffice-7.2.5.2.log
http://gohan04.nyi.freebsd.org/data/main-amd64-PR261412-default/2022-01-31_21h03m46s/logs/errors/libreoffice6-6.4.7_19.log
http://gohan04.nyi.freebsd.org/data/main-amd64-PR261412-default/2022-01-31_21h03m46s/logs/errors/apache-openoffice-4.1.11.log
http://gohan04.nyi.freebsd.org/data/main-amd64-PR261412-default/2022-01-31_21h03m46s/logs/errors/apache-openoffice-devel-4.2.1633255994,4.log
http://gohan04.nyi.freebsd.org/data/main-amd64-PR261412-default/2022-01-31_21h03m46s/logs/errors/open-vm-tools-nox11-11.3.5_1,2.log
http://gohan04.nyi.freebsd.org/data/main-amd64-PR261412-default/2022-01-31_21h03m46s/logs/errors/open-vm-tools-11.3.5_1,2.log
http://gohan04.nyi.freebsd.org/data/main-amd64-PR261412-default/2022-01-31_21h03m46s/logs/errors/virtualbox-ose-additions-6.1.32.log
http://gohan04.nyi.freebsd.org/data/main-amd64-PR261412-default/2022-01-31_21h03m46s/logs/errors/virtualbox-ose-additions-legacy-5.2.44_3.log
http://gohan04.nyi.freebsd.org/data/main-amd64-PR261412-default/2022-01-31_21h03m46s/logs/errors/virtualbox-ose-additions-nox11-6.1.32.log
http://gohan04.nyi.freebsd.org/data/main-amd64-PR261412-default/2022-01-31_21h03m46s/logs/errors/virtualbox-ose-additions-nox11-legacy-5.2.44_3.log
http://gohan04.nyi.freebsd.org/data/main-amd64-PR261412-default/2022-01-31_21h03m46s/logs/errors/tvheadend-4.2.8_5.log
http://gohan04.nyi.freebsd.org/data/main-amd64-PR261412-default/2022-01-31_21h03m46s/logs/errors/ltrace-0.6.0.log

google-perftools and ltrace seem related to unwind,  the others look strange
Comment 2 Ed Maste freebsd_committer freebsd_triage 2022-02-02 19:36:07 UTC
google-perftools:

ld: error: ./.libs/libtcmalloc_debug.so: undefined reference to unw_getcontext [--no-allow-shlib-undefined]
ld: error: ./.libs/libtcmalloc_debug.so: undefined reference to unw_init_local [--no-allow-shlib-undefined]
ld: error: ./.libs/libtcmalloc_debug.so: undefined reference to unw_step [--no-allow-shlib-undefined]
ld: error: ./.libs/libtcmalloc_debug.so: undefined reference to unw_get_reg [--no-allow-shlib-undefined]
c++: error: linker command failed with exit code 1 (use -v to see invocation)

presumably just exposed by HAVE_LIBUNWIND_H being true now



ltrace:

execute_program.c:4:10: fatal error: 'libunwind-ptrace.h' file not found
#include <libunwind-ptrace.h>
         ^~~~~~~~~~~~~~~~~~~~
1 error generated.

which comes from:

#if defined(HAVE_LIBUNWIND)
#include <libunwind-ptrace.h>
#endif /* defined(HAVE_LIBUNWIND) */

Interestingly they have a check for libunwind-ptrace.h specifically:

/* Define to 1 if you have the <libunwind-ptrace.h> header file. */
#undef HAVE_LIBUNWIND_PTRACE_H
Comment 3 Dimitry Andric freebsd_committer freebsd_triage 2022-02-02 20:55:51 UTC
Also not related to libunwind are the errors of the form:

error: implicit declaration of function 'insmntque1' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

E.g. likely some kernel API change. These are in the logs:

open-vm-tools-11.3.5_1,2.log
open-vm-tools-nox11-11.3.5_1,2.log
virtualbox-ose-additions-6.1.32.log
virtualbox-ose-additions-legacy-5.2.44_3.log
virtualbox-ose-additions-nox11-6.1.32.log
virtualbox-ose-additions-nox11-legacy-5.2.44_3.log
Comment 4 Ed Maste freebsd_committer freebsd_triage 2022-02-09 21:58:11 UTC
CC google-perftools and ltrace maintainers
Comment 5 Dimitry Andric freebsd_committer freebsd_triage 2022-02-13 13:33:10 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