Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Aug 2023 15:11:48 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        Juraj Lutter <otis@FreeBSD.org>
Cc:        Mike Karels <mike@karels.net>, FreeBSD Toolchain <freebsd-toolchain@freebsd.org>, Current FreeBSD <freebsd-current@freebsd.org>
Subject:   Re: Error crosscompiling 14.0-ALPHA1 on amd64 for arm64.aarch64
Message-ID:  <DA4841F4-5E66-4924-8D96-3BA1BFF053A2@yahoo.com>
In-Reply-To: <D9B03C8B-6A38-4638-BA65-2FB9F70A1C10@FreeBSD.org>
References:  <3B0BBEB1-D16C-405A-B2FA-F53022CFC925.ref@yahoo.com> <3B0BBEB1-D16C-405A-B2FA-F53022CFC925@yahoo.com> <3AE647E3-B988-4387-BF56-A2DB6533B5FD@FreeBSD.org> <B1A70DF1-994F-47D9-95F2-B79E559EF747@yahoo.com> <3C630E2F-959E-46BC-8DAE-DA19C3A6912E@yahoo.com> <D9B03C8B-6A38-4638-BA65-2FB9F70A1C10@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Aug 13, 2023, at 14:37, Juraj Lutter <otis@FreeBSD.org> wrote:

> On 13 Aug 2023, at 23:13, Mark Millard <marklmi@yahoo.com> wrote:
>>=20
>> On Aug 13, 2023, at 14:01, Mark Millard <marklmi@yahoo.com> wrote:
>>=20
>>> On Aug 13, 2023, at 13:19, Juraj Lutter <otis@freebsd.org> wrote:
>>>=20
>>>>> On 13 Aug 2023, at 21:13, Mark Millard <marklmi@yahoo.com> wrote:
>>>>>=20
>>>>> But the offical CI builds on amd64 do not have the problem.
>>>>>=20
>>>>> We still have not found what is different about your context from =
the
>>>>> standard context used for CI builds and snapshot builds, all of =
which
>>>>> have worked find building on amd64 to target aarch64 with armv7 =
support.
>>>>=20
>>>> My src.conf:
>>>>=20
>>>> WITHOUT_PROFILE=3Dyes
>>>> WITHOUT_TESTS=3Dyes
>>>> WITHOUT_STATIC=3Dyes
>>>>=20
>>>> WITHOUT_LLVM_TARGET_ALL=3Dyes
>>>=20
>>> Starting below this is wrong presuming all
>>> builds are actually done on amd64:
>>>=20
>>>> .if "${TARGET}" =3D=3D "arm64" && "${TARGET_ARCH}" =3D=3D "aarch64"
>>>> KERNCONF?=3DGENERIC-MMCCAM
>>>> REPODIR?=3D/data/poudriere/packages/pkgbase
>>>> MODULES_EXTRA=3D"rpi_ft5406"
>>>> WITH_LLVM_TARGET_AARCH64=3Dyes
>>>> WITH_LLVM_TARGET_ARM=3Dyes
>>>> .else
>>>> KERNCONF?=3DGENERIC-NODEBUG
>>>> REPODIR?=3D/data/poudriere/packages/pkgbase
>>>> WITH_LLVM_TARGET_AARCH64=3Dyes
>>>> WITH_LLVM_TARGET_X86=3Dyes
>>>> .endif
>>>=20
>>> Ending here.
>>>=20
>>> This is written as if there were separate toolchains for
>>> each target. That is not how llvm/clang/lld works,
>>> unlike gcc. One toolchain covers all the targets. That
>>> is what the FreBSD llvm support is structured for.
>>>=20
>>> You want the one llvm/clang/lld toolchain that includes
>>> everything required to build any/all of:
>>>=20
>>> A) amd64
>>> B) i386 for amd64's lib32
>>> C) aarch64
>>> D) armv7 for aarch64's lib32
>>>=20
>>> So the *_LLVM_TARGET_* parts would be more like:
>>>=20
>>> WITHOUT_PROFILE=3Dyes
>>> WITHOUT_TESTS=3Dyes
>>> WITHOUT_STATIC=3Dyes
>>>=20
>>> WITHOUT_LLVM_TARGET_ALL=3Dyes
>>> WITH_LLVM_TARGET_AARCH64=3Dyes
>>> WITH_LLVM_TARGET_X86=3Dyes
>>> WITH_LLVM_TARGET_AARCH64=3Dyes
>>> WITH_LLVM_TARGET_ARM=3Dyes
>>=20
>=20
> If you look closer, you will see that:
>=20
> WITH_LLVM_TARGET_AARCH64=3Dyes

Looks like the above was my typing mistake: WITH_LLVM_TARGET_AMD64 ?

> WITH_LLVM_TARGET_X86=3Dyes
>=20
> is in effect when I do =E2=80=9Cmake buildworld=E2=80=9D without any =
TARGET and TARGET_ARCH, i.e. when I build the OS for the host (that is, =
14.0/amd64).

WITH_LLVM_TARGET_??? and WITHOUT_LLVM_TARGET_??? control
building the LLVM/clang/lld toolchain.

What matters is when the llvm/clang/lld materials are built and =
installed,
and when they are used.

The way the builds work for building aarch64 and armv7
buildworld and/or buildkernel materials on amd64, the
one-and-the-same toolchain is used thus inside one
buildworld/buildkernel run:

A) some amd64 files are generated that are later poteitnally run
    by the amd64 system. (So there is amd64 code generation
    involved.)

B) lots of aarch64/armv7 files are generated that are not run by
    the amd64 system. (So there is aarch64/armv7 code generation
    involved too.)

The same toolchain is used for both (A) and (B) inside one buildworld
run. The toolchain has to support all those targets inside the one
buildworld/buildkernel run.

The whole type of analysis of avoiding having targets you intend
to use not being in some of your toolchain builds is just
inappropriate for FreeBSD and how it uses LLVM. Prat of the point
of LLVM is to avoid having distinct tool chains (or toolchain
builds) for different targets of interest. One toolchain is
sufficient.

You need to quit using the conditional logic for=20
???_LLVM_TARGET_??? definitions if your builds are going to
systematically work. What you are doing is not like what the
CI or snapshot build so that work just fine. no FreeBSD
documentatino suggests what you are doing. Make things work
more like those and things should work just fine.

> But once I specify make TARGET=3Darm64 TARGET_ARCH=3Daarch64, only the =
lines:
>=20
> WITH_LLVM_TARGET_AARCH64=3Dyes
> WITH_LLVM_TARGET_ARM=3Dyes

And that is a problem with what you are doing, givne your use
of WITHOUT_LLVM_TARGET_ALL=3Dyes .

> are in effect. The line =E2=80=9CWITH_LLVM_TARGET_ARM=3Dyes=E2=80=9D =
has only been added today for a test, but it did not make any =
difference.

As I would expect.

Make sure that all the targets you are going to build for
have "WITH_" status all the time in the amd64 build system,
not just sometimes.

"WITHOUT_" status should only be for targets that you will
never use when building via the amd64 build system.


=3D=3D=3D
Mark Millard
marklmi at yahoo.com




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?DA4841F4-5E66-4924-8D96-3BA1BFF053A2>