compiling with ports llvm11 breaks on mman.h: struct shm_larg epage_conf

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

compiling with ports llvm11 breaks on mman.h: struct shm_larg epage_conf

Ronald Klop
Hi,

Because I'm tired of hours of compilation of llvm/clang I'm testing  
compiling FreeBSD with llvm11 from a pkg.

Setup a jail with 13-CURRENT. Compilation of the installed version went  
fine.
Today I svn up'd and compiled and compilation broke.

/lib/clang/11.0.0/include -fstack-protector-strong -Wsystem-headers  
-Werror -Wall -[29/1822]
t-y2k -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body  
-Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare  
-Wno-unused-value -Wno-parentheses-equality -Wno-unused-function  
-Wno-enum-conversion -Wno-unused-local-typedef  
-Wno-address-of-packed-member -
Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter  
-Qunused-arguments    -I/usr/src/li
b/libutil -I/usr/src/lib/msun/amd64 -I/usr/src/lib/msun/x86  
-I/usr/src/lib/msun/src -c /usr/
src/lib/libc/sys/shm_open.c -o shm_open.o
/usr/src/lib/libc/sys/shm_open.c:64:28: error: variable has incomplete  
type 'struct shm_larg
epage_conf'
         struct shm_largepage_conf slc;
                                   ^
/usr/src/lib/libc/sys/shm_open.c:64:9: note: forward declaration of  
'struct shm_largepage_co
nf'
         struct shm_largepage_conf slc;


I can see the difference between /usr/include/sys/mman.h and  
/usr/src/sys/sys/mman.h is exactly about these symbols.
Why is the base compiler using the latter and ports llvm11 the former?

Configuration of my src.conf and make.conf is described in  
https://blog.klop.ws/2020/08/waiting-for-clang-forever-and-ever.html .


Do I miss some directive about system header files?

Regards,

Ronald.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: compiling with ports llvm11 breaks on mman.h: struct shm_larg epage_conf

Dimitry Andric-4
On 12 Sep 2020, at 17:43, Ronald Klop <[hidden email]> wrote:

>
> Because I'm tired of hours of compilation of llvm/clang I'm testing compiling FreeBSD with llvm11 from a pkg.
>
> Setup a jail with 13-CURRENT. Compilation of the installed version went fine.
> Today I svn up'd and compiled and compilation broke.
>
> /lib/clang/11.0.0/include -fstack-protector-strong -Wsystem-headers -Werror -Wall -[29/1822]
> t-y2k -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-address-of-packed-member -
> Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter  -Qunused-arguments    -I/usr/src/li
> b/libutil -I/usr/src/lib/msun/amd64 -I/usr/src/lib/msun/x86 -I/usr/src/lib/msun/src -c /usr/
> src/lib/libc/sys/shm_open.c -o shm_open.o
> /usr/src/lib/libc/sys/shm_open.c:64:28: error: variable has incomplete type 'struct shm_larg
> epage_conf'
>        struct shm_largepage_conf slc;
>                                  ^
> /usr/src/lib/libc/sys/shm_open.c:64:9: note: forward declaration of 'struct shm_largepage_co
> nf'
>        struct shm_largepage_conf slc;
>
>
> I can see the difference between /usr/include/sys/mman.h and /usr/src/sys/sys/mman.h is exactly about these symbols.
> Why is the base compiler using the latter and ports llvm11 the former?
>
> Configuration of my src.conf and make.conf is described in https://blog.klop.ws/2020/08/waiting-for-clang-forever-and-ever.html .
>
>
> Do I miss some directive about system header files?
During what stage is this, and is it an incremental (e.g. -DNO_CLEAN)
build? With this kind of failure, it is usually required to be able to
inspect the full buildworld log, and the exact command line you used to
invoke make. If you can, upload that somewhere so it can be viewed.

That said, it looks like something is messing up your include order,
as during a very early stage in buildword, the sys/sys/ headers are
symlinked to objdir/tmp/legacy/usr/include/sys/. This should include
the mman.h header.

-Dimitry


signature.asc (230 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: compiling with ports llvm11 breaks on mman.h: struct shm_larg epage_conf

Ronald Klop
On Sat, 12 Sep 2020 18:28:03 +0200, Dimitry Andric <[hidden email]> wrote:

> On 12 Sep 2020, at 17:43, Ronald Klop <[hidden email]> wrote:
>>
>> Because I'm tired of hours of compilation of llvm/clang I'm testing  
>> compiling FreeBSD with llvm11 from a pkg.
>>
>> Setup a jail with 13-CURRENT. Compilation of the installed version went  
>> fine.
>> Today I svn up'd and compiled and compilation broke.
>>
>> /lib/clang/11.0.0/include -fstack-protector-strong -Wsystem-headers  
>> -Werror -Wall -[29/1822]
>> t-y2k -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body  
>> -Wno-string-plus-int -Wno-unused-const-variable  
>> -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality  
>> -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef  
>> -Wno-address-of-packed-member -
>> Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter  
>> -Qunused-arguments    -I/usr/src/li
>> b/libutil -I/usr/src/lib/msun/amd64 -I/usr/src/lib/msun/x86  
>> -I/usr/src/lib/msun/src -c /usr/
>> src/lib/libc/sys/shm_open.c -o shm_open.o
>> /usr/src/lib/libc/sys/shm_open.c:64:28: error: variable has incomplete  
>> type 'struct shm_larg
>> epage_conf'
>>        struct shm_largepage_conf slc;
>>                                  ^
>> /usr/src/lib/libc/sys/shm_open.c:64:9: note: forward declaration of  
>> 'struct shm_largepage_co
>> nf'
>>        struct shm_largepage_conf slc;
>>
>>
>> I can see the difference between /usr/include/sys/mman.h and  
>> /usr/src/sys/sys/mman.h is exactly about these symbols.
>> Why is the base compiler using the latter and ports llvm11 the former?
>>
>> Configuration of my src.conf and make.conf is described in  
>> https://blog.klop.ws/2020/08/waiting-for-clang-forever-and-ever.html .
>>
>>
>> Do I miss some directive about system header files?
>
> During what stage is this, and is it an incremental (e.g. -DNO_CLEAN)
> build? With this kind of failure, it is usually required to be able to
> inspect the full buildworld log, and the exact command line you used to
> invoke make. If you can, upload that somewhere so it can be viewed.


It is during the building world stage and happens with and without  
NO_CLEAN.
Full command:
/usr/local/bin/clang11  -O2 -pipe -fno-common   -DNO__SCCSID -DNO__RCSID  
-I/usr/src/lib/libc
/include -I/usr/src/include -I/usr/src/lib/libc/amd64 -DNLS  
-D__DBINTERFACE_PRIVATE -I/usr/
src/contrib/gdtoa -I/usr/src/contrib/libc-vis -DINET6  
-I/usr/obj/usr/src/amd64.amd64/lib/lib
c -I/usr/src/lib/libc/resolv -D_ACL_PRIVATE -DPOSIX_MISTAKE  
-I/usr/src/lib/libmd -I/usr/src/
contrib/jemalloc/include -DMALLOC_PRODUCTION  
-I/usr/src/contrib/tzcode/stdtime -I/usr/src/li
b/libc/stdtime -I/usr/src/lib/libc/locale -DBROKEN_DES -DPORTMAP  
-DDES_BUILTIN -I/usr/src/li
b/libc/rpc -DWANT_HYPERV -DYP -DNS_CACHING -DSYMBOL_VERSIONING -g -MD  
-MF.depend.shm_open.o
  -MTshm_open.o -std=gnu99 -Wno-format-zero-length -nobuiltininc -idirafter  
/usr/local/llvm11
/lib/clang/11.0.0/include -fstack-protector-strong -Wsystem-headers  
-Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign  
-Wno-empty-body -Wno-string-plus-int -Wno-unused-
const-variable -Wno-tautological-compare -Wno-unused-value  
-Wno-parentheses-equality -Wno-un
used-function -Wno-enum-conversion -Wno-unused-local-typedef  
-Wno-address-of-packed-member -
Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter  
-Qunused-arguments    -I/usr/src/lib/libutil -I/usr/src/lib/msun/amd64  
-I/usr/src/lib/msun/x86 -I/usr/src/lib/msun/src -c /usr/
src/lib/libc/sys/shm_open.c -o shm_open.o



> That said, it looks like something is messing up your include order,
> as during a very early stage in buildword, the sys/sys/ headers are
> symlinked to objdir/tmp/legacy/usr/include/sys/. This should include
> the mman.h header.
>
> -Dimitry
>



I just added CROSS_TOOLCHAIN=llvm11 to make.conf and src.conf, but no  
difference. I think I need something with --sysroot, but am not sure if  
this is something I should set or which the build framework should set.

Any advice on this? Or a pointer to the right documentation?


Regards,

Ronald.
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

Re: compiling with ports llvm11 breaks on mman.h: struct shm_larg epage_conf

Dimitry Andric-4
On 12 Sep 2020, at 23:00, Ronald Klop <[hidden email]> wrote:
>
> On Sat, 12 Sep 2020 18:28:03 +0200, Dimitry Andric <[hidden email]> wrote:
>> On 12 Sep 2020, at 17:43, Ronald Klop <[hidden email]> wrote:
>>>
>>> Because I'm tired of hours of compilation of llvm/clang I'm testing compiling FreeBSD with llvm11 from a pkg.
...
It is during the building world stage and happens with and without NO_CLEAN.

> Full command:
> /usr/local/bin/clang11  -O2 -pipe -fno-common   -DNO__SCCSID -DNO__RCSID -I/usr/src/lib/libc
> /include -I/usr/src/include -I/usr/src/lib/libc/amd64 -DNLS  -D__DBINTERFACE_PRIVATE -I/usr/
> src/contrib/gdtoa -I/usr/src/contrib/libc-vis -DINET6 -I/usr/obj/usr/src/amd64.amd64/lib/lib
> c -I/usr/src/lib/libc/resolv -D_ACL_PRIVATE -DPOSIX_MISTAKE -I/usr/src/lib/libmd -I/usr/src/
> contrib/jemalloc/include -DMALLOC_PRODUCTION -I/usr/src/contrib/tzcode/stdtime -I/usr/src/li
> b/libc/stdtime -I/usr/src/lib/libc/locale -DBROKEN_DES -DPORTMAP -DDES_BUILTIN -I/usr/src/li
> b/libc/rpc -DWANT_HYPERV -DYP -DNS_CACHING -DSYMBOL_VERSIONING -g -MD  -MF.depend.shm_open.o
> -MTshm_open.o -std=gnu99 -Wno-format-zero-length -nobuiltininc -idirafter /usr/local/llvm11
> /lib/clang/11.0.0/include -fstack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-
> const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-un
> used-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-address-of-packed-member -
> Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter  -Qunused-arguments    -I/usr/src/lib/libutil -I/usr/src/lib/msun/amd64 -I/usr/src/lib/msun/x86 -I/usr/src/lib/msun/src -c /usr/
> src/lib/libc/sys/shm_open.c -o shm_open.o
After a pretty long build of the llvm11 port, I can at least reproduce your error. It looks like the problem is that clang11 does not get any --sysroot parameter passed.

If I install the devel/xtoolchain-llvm90 port and use that, I get a slightly different command line. Here's both of them, in diff --side-by-side format:

/usr/local/bin/clang11                                  |  /usr/local/bin/clang90
                                                        >   -target x86_64-unknown-freebsd13.0
                                                        >   --sysroot=/usr/obj/usr/src/amd64.amd64/tmp
                                                        >   -B/var/empty
 -O2                                                        -O2
 -pipe                                                      -pipe
 -fno-common                                                -fno-common
 -DNO__SCCSID                                               -DNO__SCCSID
 -DNO__RCSID                                                -DNO__RCSID
 -I/usr/src/lib/libc/include                                -I/usr/src/lib/libc/include
 -I/usr/src/include                                         -I/usr/src/include
 -I/usr/src/lib/libc/amd64                                  -I/usr/src/lib/libc/amd64
 -DNLS                                                      -DNLS
 -D__DBINTERFACE_PRIVATE                                    -D__DBINTERFACE_PRIVATE
 -I/usr/src/contrib/gdtoa                                   -I/usr/src/contrib/gdtoa
 -I/usr/src/contrib/libc-vis                                -I/usr/src/contrib/libc-vis
 -DINET6                                                    -DINET6
 -I/usr/obj/usr/src/amd64.amd64/lib/libc                    -I/usr/obj/usr/src/amd64.amd64/lib/libc
 -I/usr/src/lib/libc/resolv                                 -I/usr/src/lib/libc/resolv
 -D_ACL_PRIVATE                                             -D_ACL_PRIVATE
 -DPOSIX_MISTAKE                                            -DPOSIX_MISTAKE
 -I/usr/src/lib/libmd                                       -I/usr/src/lib/libmd
 -I/usr/src/contrib/jemalloc/include                        -I/usr/src/contrib/jemalloc/include
 -I/usr/src/contrib/tzcode/stdtime                          -I/usr/src/contrib/tzcode/stdtime
 -I/usr/src/lib/libc/stdtime                                -I/usr/src/lib/libc/stdtime
 -I/usr/src/lib/libc/locale                                 -I/usr/src/lib/libc/locale
 -DBROKEN_DES                                               -DBROKEN_DES
 -DPORTMAP                                                  -DPORTMAP
 -DDES_BUILTIN                                              -DDES_BUILTIN
 -I/usr/src/lib/libc/rpc                                    -I/usr/src/lib/libc/rpc
 -DWANT_HYPERV                                              -DWANT_HYPERV
 -DYP                                                       -DYP
 -DNS_CACHING                                               -DNS_CACHING
 -DSYMBOL_VERSIONING                                        -DSYMBOL_VERSIONING
 -g                                                         -g
 -MD                                                        -MD
 -MF.depend.shm_open.o                                      -MF.depend.shm_open.o
 -MTshm_open.o                                              -MTshm_open.o
 -std=gnu99                                                 -std=gnu99
 -Wno-format-zero-length                                    -Wno-format-zero-length
 -nobuiltininc                                              -nobuiltininc
 -idirafter /usr/local/llvm11/lib/clang/11.0.0/include  |   -idirafter /usr/local/llvm90/lib/clang/9.0.1/include
 -fstack-protector-strong                                   -fstack-protector-strong
 -Wsystem-headers                                           -Wsystem-headers
 -Werror                                                    -Werror
 -Wall                                                      -Wall
 -Wno-format-y2k                                            -Wno-format-y2k
 -Wno-uninitialized                                         -Wno-uninitialized
 -Wno-pointer-sign                                          -Wno-pointer-sign
 -Wno-empty-body                                            -Wno-empty-body
 -Wno-string-plus-int                                       -Wno-string-plus-int
 -Wno-unused-const-variable                                 -Wno-unused-const-variable
 -Wno-tautological-compare                                  -Wno-tautological-compare
 -Wno-unused-value                                          -Wno-unused-value
 -Wno-parentheses-equality                                  -Wno-parentheses-equality
 -Wno-unused-function                                       -Wno-unused-function
 -Wno-enum-conversion                                       -Wno-enum-conversion
 -Wno-unused-local-typedef                                  -Wno-unused-local-typedef
 -Wno-address-of-packed-member                              -Wno-address-of-packed-member
 -Wno-switch                                                -Wno-switch
 -Wno-switch-enum                                           -Wno-switch-enum
 -Wno-knr-promoted-parameter                                -Wno-knr-promoted-parameter
 -Qunused-arguments                                         -Qunused-arguments
 -I/usr/src/lib/libutil                                     -I/usr/src/lib/libutil
 -I/usr/src/lib/msun/amd64                                  -I/usr/src/lib/msun/amd64
 -I/usr/src/lib/msun/x86                                    -I/usr/src/lib/msun/x86
 -I/usr/src/lib/msun/src                                    -I/usr/src/lib/msun/src
 -c /usr/src/lib/libc/sys/shm_open.c                        -c /usr/src/lib/libc/sys/shm_open.c
 -o shm_open.o                                              -o shm_open.o

So except for the expected difference in the -idirafter option that points to the clang internal headers, the main problem is that for some reason, clang11 does not get the -target and --sysroot options passed.

-Dimitry


signature.asc (230 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: compiling with ports llvm11 breaks on mman.h: struct shm_larg epage_conf

Dimitry Andric-4
On 13 Sep 2020, at 20:56, Dimitry Andric <[hidden email]> wrote:

>
> On 12 Sep 2020, at 23:00, Ronald Klop <[hidden email]> wrote:
>>
>> On Sat, 12 Sep 2020 18:28:03 +0200, Dimitry Andric <[hidden email]> wrote:
>>> On 12 Sep 2020, at 17:43, Ronald Klop <[hidden email]> wrote:
>>>>
>>>> Because I'm tired of hours of compilation of llvm/clang I'm testing compiling FreeBSD with llvm11 from a pkg.
> ...
> It is during the building world stage and happens with and without NO_CLEAN.
>> Full command:
>> /usr/local/bin/clang11  -O2 -pipe -fno-common   -DNO__SCCSID -DNO__RCSID -I/usr/src/lib/libc
>> /include -I/usr/src/include -I/usr/src/lib/libc/amd64 -DNLS  -D__DBINTERFACE_PRIVATE -I/usr/
>> src/contrib/gdtoa -I/usr/src/contrib/libc-vis -DINET6 -I/usr/obj/usr/src/amd64.amd64/lib/lib
>> c -I/usr/src/lib/libc/resolv -D_ACL_PRIVATE -DPOSIX_MISTAKE -I/usr/src/lib/libmd -I/usr/src/
>> contrib/jemalloc/include -DMALLOC_PRODUCTION -I/usr/src/contrib/tzcode/stdtime -I/usr/src/li
>> b/libc/stdtime -I/usr/src/lib/libc/locale -DBROKEN_DES -DPORTMAP -DDES_BUILTIN -I/usr/src/li
>> b/libc/rpc -DWANT_HYPERV -DYP -DNS_CACHING -DSYMBOL_VERSIONING -g -MD  -MF.depend.shm_open.o
>> -MTshm_open.o -std=gnu99 -Wno-format-zero-length -nobuiltininc -idirafter /usr/local/llvm11
>> /lib/clang/11.0.0/include -fstack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-
>> const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-un
>> used-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-address-of-packed-member -
>> Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter  -Qunused-arguments    -I/usr/src/lib/libutil -I/usr/src/lib/msun/amd64 -I/usr/src/lib/msun/x86 -I/usr/src/lib/msun/src -c /usr/
>> src/lib/libc/sys/shm_open.c -o shm_open.o
>
> After a pretty long build of the llvm11 port, I can at least reproduce your error. It looks like the problem is that clang11 does not get any --sysroot parameter passed.
...
> So except for the expected difference in the -idirafter option that points to the clang internal headers, the main problem is that for some reason, clang11 does not get the -target and --sysroot options passed.

In the end it turns out that the problems is caused by setting CC (and CXX, etc) in make.conf. This has the unfortunate side-effect that any XCFLAGS are overridden during the world stages, such that the all-important --sysroot flags is not added.

In short, never set CC, CXX, CPP or LD in your make.conf or build environment, but use XCC, XCXX, XCPP and XLD instead. Better yet, install one of the llvm packages from the devel category, and set CROSS_TOOLCHAIN.

Keep an eye on https://wiki.freebsd.org/ExternalToolchain, which still has a little bit of outdated information, but is hopefully going to be updated soon.

-Dimitry


signature.asc (230 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: compiling with ports llvm11 breaks on mman.h: struct shm_larg epage_conf

Brooks Davis-2
On Mon, Sep 14, 2020 at 06:46:52PM +0200, Dimitry Andric wrote:

> On 13 Sep 2020, at 20:56, Dimitry Andric <[hidden email]> wrote:
> >
> > On 12 Sep 2020, at 23:00, Ronald Klop <[hidden email]> wrote:
> >>
> >> On Sat, 12 Sep 2020 18:28:03 +0200, Dimitry Andric <[hidden email]> wrote:
> >>> On 12 Sep 2020, at 17:43, Ronald Klop <[hidden email]> wrote:
> >>>>
> >>>> Because I'm tired of hours of compilation of llvm/clang I'm testing compiling FreeBSD with llvm11 from a pkg.
> > ...
> > It is during the building world stage and happens with and without NO_CLEAN.
> >> Full command:
> >> /usr/local/bin/clang11  -O2 -pipe -fno-common   -DNO__SCCSID -DNO__RCSID -I/usr/src/lib/libc
> >> /include -I/usr/src/include -I/usr/src/lib/libc/amd64 -DNLS  -D__DBINTERFACE_PRIVATE -I/usr/
> >> src/contrib/gdtoa -I/usr/src/contrib/libc-vis -DINET6 -I/usr/obj/usr/src/amd64.amd64/lib/lib
> >> c -I/usr/src/lib/libc/resolv -D_ACL_PRIVATE -DPOSIX_MISTAKE -I/usr/src/lib/libmd -I/usr/src/
> >> contrib/jemalloc/include -DMALLOC_PRODUCTION -I/usr/src/contrib/tzcode/stdtime -I/usr/src/li
> >> b/libc/stdtime -I/usr/src/lib/libc/locale -DBROKEN_DES -DPORTMAP -DDES_BUILTIN -I/usr/src/li
> >> b/libc/rpc -DWANT_HYPERV -DYP -DNS_CACHING -DSYMBOL_VERSIONING -g -MD  -MF.depend.shm_open.o
> >> -MTshm_open.o -std=gnu99 -Wno-format-zero-length -nobuiltininc -idirafter /usr/local/llvm11
> >> /lib/clang/11.0.0/include -fstack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-
> >> const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-un
> >> used-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-address-of-packed-member -
> >> Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter  -Qunused-arguments    -I/usr/src/lib/libutil -I/usr/src/lib/msun/amd64 -I/usr/src/lib/msun/x86 -I/usr/src/lib/msun/src -c /usr/
> >> src/lib/libc/sys/shm_open.c -o shm_open.o
> >
> > After a pretty long build of the llvm11 port, I can at least reproduce your error. It looks like the problem is that clang11 does not get any --sysroot parameter passed.
> ...
> > So except for the expected difference in the -idirafter option that points to the clang internal headers, the main problem is that for some reason, clang11 does not get the -target and --sysroot options passed.
>
> In the end it turns out that the problems is caused by setting CC (and CXX, etc) in make.conf. This has the unfortunate side-effect that any XCFLAGS are overridden during the world stages, such that the all-important --sysroot flags is not added.
>
> In short, never set CC, CXX, CPP or LD in your make.conf or build environment, but use XCC, XCXX, XCPP and XLD instead. Better yet, install one of the llvm packages from the devel category, and set CROSS_TOOLCHAIN.
>
> Keep an eye on https://wiki.freebsd.org/ExternalToolchain, which still has a little bit of outdated information, but is hopefully going to be updated soon.
I've made some modest updates to this page to reflect building with
modern LLVM ports.

-- Brooks

signature.asc (465 bytes) Download Attachment