Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Sep 2020 18:46:52 +0200
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Ronald Klop <ronald-lists@klop.ws>
Cc:        FreeBSD Current <freebsd-current@freebsd.org>
Subject:   Re: compiling with ports llvm11 breaks on mman.h: struct shm_larg epage_conf
Message-ID:  <5A7AD7E7-70ED-4029-9CD7-EE366FAE3BE8@FreeBSD.org>
In-Reply-To: <11FD9B3A-E977-4188-99BF-B05BFDCFE923@FreeBSD.org>
References:  <op.0qt8mkhjkndu52@sjakie> <E9CD402D-D7AF-4947-9BA1-086ECE2D74A0@FreeBSD.org> <op.0qunatz6kndu52@sjakie> <11FD9B3A-E977-4188-99BF-B05BFDCFE923@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On 13 Sep 2020, at 20:56, Dimitry Andric <dim@FreeBSD.org> wrote:
> 
> On 12 Sep 2020, at 23:00, Ronald Klop <ronald-lists@klop.ws> wrote:
>> 
>> On Sat, 12 Sep 2020 18:28:03 +0200, Dimitry Andric <dim@freebsd.org> wrote:
>>> On 12 Sep 2020, at 17:43, Ronald Klop <ronald-lists@klop.ws> 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


[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.2

iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCX1+efAAKCRCwXqMKLiCW
ozWVAJ9s1YTQBs9YxliVSLU912Etq6tHVwCggDHcqb1Dz5J1Owg0GfzyzqzCaws=
=od9R
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5A7AD7E7-70ED-4029-9CD7-EE366FAE3BE8>