[Pkg-rust-maintainers] Bug#1092626: rust-cpufeatures: FTBFS: Cherry-pick upstream patch to fix "`HWCAP_CPUCFG` not found in crate `libc`"

zhangdandan zhangdandan at loongson.cn
Fri Jan 10 03:39:26 GMT 2025


Source: rust-cpufeatures
Version: 0.2.11-1
Severity: normal
Tags: ftbfs patch
User: debian-loongarch at lists.debian.org
Usertags: loong64
X-Debbugs-CC: debian-loongarch at lists.debian.org

Dear maintainers,

Compiling the rust-cpufeatures failed for loong64 in the Debian Package 
Auto-Building environment.
The error log is as follows,
```
......
error[E0425]: cannot find value `HWCAP_CPUCFG` in crate `libc`
   --> src/loongarch64.rs:82:39
    |
82 |     pub const CPUCFG: c_ulong = libc::HWCAP_CPUCFG;
    |                                       ^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `HWCAP_LAM` in crate `libc`
   --> src/loongarch64.rs:83:36
    |
83 |     pub const LAM: c_ulong = libc::HWCAP_LAM;
    |                                    ^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `HWCAP_UAL` in crate `libc`
   --> src/loongarch64.rs:84:36
    |
84 |     pub const UAL: c_ulong = libc::HWCAP_UAL;
    |                                    ^^^^^^^^^ not found in `libc`
......
```

The full build log can be found at 
https://buildd.debian.org/status/fetch.php?pkg=rust-cpufeatures&arch=loong64&ver=0.2.11-1%2Bb1&stamp=1736041499&raw=0.

About the above build error on loong64, due to there are inconsistent 
phenomena between rust-libc 0.2.169-1 and rust-cpufeatures 0.2.11-1.
When rust-libc's version is 0.2.169-1(built on December,28,2024), 
rust-cpufeatures's version should be >=v0.2.13.
So, I have 2 suggestions,
1.Please upgrade Debian rust-cpufeatures version higher than(including) 
v0.2.13.
Now the lastest version in upstream is v0.2.16.
2.Please consider the patch I attached.
Backport patch to Debian rust-cpufeatures 0.2.11-1.

Based on the attached patch, I have built rust-cpufeatures 
0.2.11-1+loong64 locally.
```
    dh_builddeb -O--buildsystem=cargo
dpkg-deb: building package 'librust-cpufeatures-dev' in 
'../librust-cpufeatures-dev_0.2.11-1+loong64_loong64.deb'.
  dpkg-genbuildinfo -O../rust-cpufeatures_0.2.11-1+loong64_loong64.buildinfo
  dpkg-genchanges -O../rust-cpufeatures_0.2.11-1+loong64_loong64.changes
```

Best regards,
Dandan Zhang

-------------- next part --------------
A non-text attachment was scrubbed...
Name: rust-cpufeatures-cherry-pick-loongarch64-code-from-upstream.patch
Type: text/x-patch
Size: 2116 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-rust-maintainers/attachments/20250110/74933091/attachment.bin>


More information about the Pkg-rust-maintainers mailing list