Skip to contentSkip to conversation

32-bit build issues

PATCH Applied David Disseldorp 2 participants 3 messages Jun 20, 2024

lore
Share & tools
lore
#0 lore raw

cover 32-bit build issues

I've run into a few 32-bit arch specific issues when attempting to package the latest v1.9.1 tools release:
- c_long vs i64 type mixing for keyctl_search()
* This one looks pretty straightforward, see follow-up PATCH 1/1 mail

- error[E0588]: packed type cannot transitively contain a #[repr(align)] type
* maybe related to https://github.com/rust-lang/rust-bindgen/issues/2179

       --> bcachefs-tools-1.9.1/target/release/build/bch_bindgen-ea7db20b4c53ec29/out/bcachefs.rs:32702:1
        |
  32702 | pub struct bkey_inode_buf {
        | ^^^^^^^^^^^^^^^^^^^^^^^^^
        |
  note: `bch_inode_v3` has a `#[repr(align)]` attribute
       --> bcachefs-tools-1.9.1/target/release/build/bch_bindgen-ea7db20b4c53ec29/out/bcachefs.rs:8988:1
        |
  8988  | pub struct bch_inode_v3 {
        | ^^^^^^^^^^^^^^^^^^^^^^^
  note: `bkey_inode_buf` contains a field of type `bkey_i_inode_v3`
       --> bcachefs-tools-1.9.1/target/release/build/bch_bindgen-ea7db20b4c53ec29/out/bcachefs.rs:32703:9
        |
  32703 |     pub inode: bkey_i_inode_v3,
        |         ^^^^^
  note: ...which contains a field of type `bch_inode_v3`
       --> bcachefs-tools-1.9.1/target/release/build/bch_bindgen-ea7db20b4c53ec29/out/bcachefs.rs:28906:9
        |

28906 | pub v: bch_inode_v3,
* see https://build.opensuse.org/public/build/home:ddiss:bcachefs_upstream_vendor/openSUSE_Tumbleweed/i586/bcachefs-tools/_log

- undefined reference to `atomic64_try_cmpxchg'
* this looks like an arm7l specific regression from the

    atomic64_cmpxchg -> atomic64_try_cmpxchg conversion in 7d79fba1a

* see https://build.opensuse.org/public/build/home:ddiss:bcachefs_upstream_vendor/openSUSE_Tumbleweed/armv7l/bcachefs-tools/_log

Logs for successful v1.7.0 builds can be found at
https://build.opensuse.org/public/build/filesystems/openSUSE_Tumbleweed/i586/bcachefs-tools/_log
https://build.opensuse.org/public/build/filesystems/openSUSE_Tumbleweed/armv7l/bcachefs-tools/_log

Cheers, David

#1 lore raw

PATCH 1/1 key: use c_long type for keyctl_search() helper fn

The keyctl_search() C function returns a long, which is already reflected in the KeyHandle._id type. The search_keyring() helper function currently returns a Result<i64>, which breaks 32-bit builds for e.g. armv7l:
error[E0308]: mismatched types

     --> src/key.rs:121:16
      |
  121 |             Ok(key_id)
      |             -- ^^^^^^ expected `i64`, found `i32`
      |             |
      |             arguments to this enum variant are incorrect
...
  error[E0308]: mismatched types
     --> src/key.rs:135:24
      |
  135 |                 _id:   id,
      |                        ^^ expected `i32`, found `i64`

Fix this by changing search_keyring() to return a Result<c_long>.

Fixes f72ded6a ("fix(key): search for key in all relevant keyrings")
---
 src/key.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/key.rs +1 -1
index 96eb491d..0e061ee5 100644
@@ -110,7 +110,7 @@ impl KeyHandle {
         }
     }
 
-    fn search_keyring(keyring: i32, key_name: &CStr) -> Result<i64> {
+    fn search_keyring(keyring: i32, key_name: &CStr) -> Result<c_long> {
         let key_name = CStr::as_ptr(key_name);
         let key_type = c_str!("user");
 
Signature · 1 line
2.35.3
#2 lore raw

Re: [tools PATCH 1/1] key: use c_long type for keyctl_search() helper fn

Quoted 18 lines · David Disseldorp

The keyctl_search() C function returns a long, which is already reflected in the KeyHandle._id type. The search_keyring() helper function currently returns a Result<i64>, which breaks 32-bit builds for e.g. armv7l:
error[E0308]: mismatched types

     --> src/key.rs:121:16
      |
  121 |             Ok(key_id)
      |             -- ^^^^^^ expected `i64`, found `i32`
      |             |
      |             arguments to this enum variant are incorrect
...
  error[E0308]: mismatched types
     --> src/key.rs:135:24
      |
  135 |                 _id:   id,
      |                        ^^ expected `i32`, found `i64`
Quoted 4 lines

Fix this by changing search_keyring() to return a Result<c_long>.

Fixes f72ded6a ("fix(key): search for key in all relevant keyrings")

Thanks, applied