-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
override ppc64le %_host_cpu #1195
override ppc64le %_host_cpu #1195
Conversation
We were not able to find or create Copr project
Please check your configuration for:
|
33ea8eb
to
7fd18b4
Compare
Before trodding deeper into these dark woods, it would be good to check what the current state of things is in rpm >= 4.19 where config.guess has nothing to do with anything (because cmake is used). |
Thank you for your comment, @pmatilai. OK, but that's not even in Rawhide, right? I'd like to fix builds for EPEL7+. Otherwise yes, 4.19 seems to use CMAKE_HOST_SYSTEM_PROCESSOR, which is E.g. %{java_arches} expands to just As noted above, Koji overrides |
@pmatilai do you think this patch is a wrong idea? |
Per rpm-software-management/rpm#791 it seems this is going to be fixed for Fedora 39+ with rpm 4.19.0. Since we know the preferred fix ( |
I'm not @pmatilai, but I think that is reasonable. But does this behave reasonably when we do foreign arch mock runs (e.g. ppc64le on x86_64)? |
I guess? The
|
7fd18b4
to
608c1ad
Compare
In older RPM versions, the `%_host_cpu` macro was not correctly set for the `ppc64le` architecture. Let's work around this issue in Mock. This problem arises because RPM determines the per-distribution value of the `%_host_cpu` macro at its build time (rpm.rpm package). The value is provided by the build system, from the build environment analysis. Older RPM versions use the `config.guess` script (file copy from the Automake package) for this purpose. However, even as of 2024, this script still returns an incorrect architecture string on ppc64le boxes: $ /usr/lib/rpm/redhat/config.guess powerpc64le-unknown-linux-gnu ^^^^^^^^^^^ Newer versions of RPM (v4.19+ in Fedora 39+ and EL 10+) use the CMake build system, which sets the correct `%_host_cpu` value `ppc64le`. This commit addresses the issue by overriding the macro in older chroots (RPM v4.18 and earlier). This is what the Fedora Koji build system has been doing for **all** `ppc64le` Mock chroots for a long time—now, it's being applied for Mock users in `mock-core-configs`. The `%_host_cpu` macro is used by `/bin/rpmbuild` when validating architectures, especially with the `ExclusiveArch/ExcludeArch` checks for `BuildArch: noarch` packages. Maintainers sometimes do: BuildArch: noarch ExcludeArch: %java_arches However, since `%java_arches` doesn't include the "non-standard" `powerpc64le` architecture string (and no other "similar" macro does, including the more extensive ones like `%go_arches`), builds in Mock can fail early with the error: error: Architecture is not included: powerpc64le Building target platforms: ppc64le Building for target ppc64le This happens because: $ rpm --eval %java_arches aarch64 ppc64le s390x x86_64 $ rpm --eval %_host_cpu powerpc64le The arch-specific packages care about `%_target_cpu` value (which seems valid everywhere) so they don't suffer from this problem. The 'noarch' are affected because of the `%_target_cpu → %_host_cpu` fallback: https://github.com/rpm-software-management/rpm/blob/21457de886faf2415500a8bb7cc6c816d72939ef/build/parsePreamble.c#L442-L449 And given by fact that the `%_build_cpu` macro is just `%_host_cpu`: $ rpm --showrc | grep build_cpu -13: _build_cpu %{_host_cpu} Relates: fedora-copr/copr#2870 Relates: https://bugzilla.redhat.com/show_bug.cgi?id=1461288
608c1ad
to
2ca7f75
Compare
Trying to be brave, and marking this PR for review (see the commit message for the info). I still eventually believe this is worth merging (but it only affects EL 9 and older, all actively developed Fedora versions are OK). |
This is what Koji does for all architectures. The macro is used by
rpmbuild while matching 'ExclusiveArch' patterns. E.g. "%java_arches"
then contains 'ppc64le', but by default '_host_cpu' contains powerpc64le
on Fedora.
RPM checks %_target_cpu with %_build_cpu fallback:
https://github.com/rpm-software-management/rpm/blob/21457de886faf2415500a8bb7cc6c816d72939ef/build/parsePreamble.c#L442-L449
For 'BuildArch: noarch' packages, %_target_cpu is 'noarch', fallback is
used and '%_build_cpu' is defined as '%_host_cpu' in redhat-rpm-config.
This is set by 'config.guess' to powerpc64le.
TODO: submit a redhat-rpm-config issue
TODO: resolve other EPEL/Fedora targets
Relates: fedora-copr/copr#2870
Relates: https://bugzilla.redhat.com/show_bug.cgi?id=1461288