Bug 274542 - devel/llvm: C99 include files are not included
Summary: devel/llvm: C99 include files are not included
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Brooks Davis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-17 17:31 UTC by Brendan Shanks
Modified: 2023-12-02 01:50 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (brooks)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brendan Shanks 2023-10-17 17:31:41 UTC
The LLVM ports do not include various standard C/C99 headers because of this patch: <https://cgit.freebsd.org/ports/tree/devel/llvm17/files/patch-clang_lib_Headers_CMakeLists.txt>

My specific problem is that this prevents Wine from using LLVM/clang from ports as a PE cross-compiler. In this case Wine uses clang in the 'x86_64-windows' mode, configure does a check in this mode and tries to build a sample file which includes <stddef.h>, and this fails.
LLVM/clang packages on other OSes (Gentoo Linux, macOS Homebrew) do include these files.

And more generally, anyone trying to use ports LLVM/clang to target a  freestanding/bare-metal environment would not be able to use any of these standard header files.
E.g. for a very simple test.c:
#include <stdint.h>

uint64_t hi(void)
{
        return 1;
}

and build with:
$ /usr/local/bin/clang --target=arm-none-eabi -nostdlib -o test.o test.c
Comment 1 Brooks Davis freebsd_committer freebsd_triage 2023-11-30 21:57:14 UTC
We either need to patch FreeBSD's include files so that it can build with the llvm ones installed or patch the llvm ones to honor FreeBSD's guard macros.  I'm not sure which is the best approach, but until that's resolved we're stuck in this situation.