Bug 1218701 - llvm17 on i586: fails to build with RPM 4.19
Summary: llvm17 on i586: fails to build with RPM 4.19
Status: RESOLVED FIXED
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Other (show other bugs)
Version: Current
Hardware: Other Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: Aaron Puchert
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-10 12:33 UTC by Ana Guerrero
Modified: 2024-06-20 12:39 UTC (History)
2 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
llvm17 on i586 with RPM 4.19 (14.65 MB, text/plain)
2024-01-10 12:33 UTC, Ana Guerrero
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ana Guerrero 2024-01-10 12:33:28 UTC
Created attachment 871750 [details]
llvm17 on i586 with RPM 4.19

The remaining blocker for RPM 4.19 to go is llvm17 failing to build on i586, please see attached log.
Comment 1 Ana Guerrero 2024-01-10 12:34:09 UTC
In case it helps, from the bottom of the log:


[12316s] ********************
[12346s] Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
[12346s] 
[12346s] 1 warning(s) in tests
[12346s] ********************
[12346s] Failed Tests (2):
[12346s]   Clang Tools :: clang-tidy/checkers/abseil/duration-factory-scale.cpp
[12346s]   Clang Tools :: clang-tidy/checkers/altera/struct-pack-align.cpp
[12346s] 
[12346s] 
[12346s] Testing Time: 31.18s
[12346s]   Unsupported      :   1
[12346s]   Passed           : 797
[12346s]   Expectedly Failed:   2
[12346s]   Failed           :   2
[12346s] error: Bad exit status from /var/tmp/rpm-tmp.HNfYRP (%check)
Comment 2 Fabian Vogt 2024-01-10 15:51:09 UTC
Looking at the build log, there is this diff:

-  -- LLVM host triple: i586-suse-linux
-  -- LLVM default target triple: i586-suse-linux
+  -- LLVM host triple: i686-suse-linux
+  -- LLVM default target triple: i686-suse-linux

Which is coming from %_host_cpu:

# Figure out the host triple.
%ifarch armv6hl
# See https://build.opensuse.org/request/show/968066.
%define host_cpu armv6kz
%else
%define host_cpu %{_host_cpu}
%endif

The build happens on a recent x86_64 VM with an x86_64 kernel and 32bit x86 userspace, so technically i686 is actually more correct than i586 and IMO not an RPM regression.

I guess the clang-tidy testsuite failure is because of https://github.com/llvm/llvm-project/issues/40805, which is related to floating point precision.
Comment 3 Fabian Vogt 2024-01-10 15:54:54 UTC
(In reply to Fabian Vogt from comment #2)
> The build happens on a recent x86_64 VM with an x86_64 kernel and 32bit x86
> userspace, so technically i686 is actually more correct than i586 and IMO
> not an RPM regression.

FTR, the most likely cause upstream is https://github.com/rpm-software-management/rpm/commit/26d3802390602c6aadc523bfb84426914c8fa050
Comment 4 Aaron Puchert 2024-01-10 23:21:14 UTC
(In reply to Fabian Vogt from comment #2)
> Looking at the build log, there is this diff:
> 
> -  -- LLVM host triple: i586-suse-linux
> -  -- LLVM default target triple: i586-suse-linux
> +  -- LLVM host triple: i686-suse-linux
> +  -- LLVM default target triple: i686-suse-linux
> 
> Which is coming from %_host_cpu:
> 
> # Figure out the host triple.
> %ifarch armv6hl
> # See https://build.opensuse.org/request/show/968066.
> %define host_cpu armv6kz
> %else
> %define host_cpu %{_host_cpu}
> %endif
> 
> The build happens on a recent x86_64 VM with an x86_64 kernel and 32bit x86
> userspace, so technically i686 is actually more correct than i586 and IMO
> not an RPM regression.

The intent here is actually not to figure out the host, but the "default target": what the compiler will emit without explicit --target=<triple>. Presumably our default target is still i586 and not i686, so how do I get that? Maybe %{_target_cpu}? With the current RPM, that's just an alias on x86_64:

/usr/lib/rpm/macros:%_build_cpu         %{_host_cpu}
/usr/lib/rpm/macros:%_host_cpu          x86_64
/usr/lib/rpm/macros:%_target_cpu                %{_host_cpu}

Though maybe that's not actually where it comes from, since I can override the target when building the package.

Conceptually, using the _target_* macros instead of _host_* macros seems definitely right, but I'm not sure if it would fix the issue.

The clang-tidy tests are not a big issue, but I don't think we want i686 as default target.
Comment 5 Fabian Vogt 2024-01-11 07:35:49 UTC
(In reply to Aaron Puchert from comment #4)
> Presumably our default target is still i586 and not i686, so how do I get
> that? Maybe %{_target_cpu}? With the current RPM, that's just an alias on
> x86_64:
> 
> /usr/lib/rpm/macros:%_build_cpu         %{_host_cpu}
> /usr/lib/rpm/macros:%_host_cpu          x86_64
> /usr/lib/rpm/macros:%_target_cpu                %{_host_cpu}
>
> Though maybe that's not actually where it comes from, since I can override
> the target when building the package.

Correct.
 
> Conceptually, using the _target_* macros instead of _host_* macros seems
> definitely right, but I'm not sure if it would fix the issue.
> 
> The clang-tidy tests are not a big issue, but I don't think we want i686 as
> default target.

So using %_target_cpu is necessary in any case and with some luck also addresses
the build failure, worth a try.
Comment 6 Fabian Vogt 2024-01-11 11:28:17 UTC
(In reply to Fabian Vogt from comment #5)
> So using %_target_cpu is necessary in any case and with some luck also
> addresses
> the build failure, worth a try.

Works! https://build.opensuse.org/package/live_build_log/home:favogt:branches:devel:tools:compiler/llvm17/rpm/i586

https://build.opensuse.org/request/show/1138113
Comment 7 OBSbugzilla Bot 2024-01-12 01:35:02 UTC
This is an autogenerated message for OBS integration:
This bug (1218701) was mentioned in
https://build.opensuse.org/request/show/1138185 Factory / llvm17
Comment 8 OBSbugzilla Bot 2024-03-12 09:55:46 UTC
This is an autogenerated message for OBS integration:
This bug (1218701) was mentioned in
https://build.opensuse.org/request/show/1157115 Backports:SLE-15-SP5 / llvm17
Comment 9 Ana Guerrero 2024-04-29 12:27:26 UTC
This is fixed already.