launchbadge / sqlx

🧰 The Rust SQL Toolkit. An async, pure Rust SQL crate featuring compile-time checked queries without a DSL. Supports PostgreSQL, MySQL, and SQLite.
Apache License 2.0
12.36k stars 1.18k forks source link

Feature SQLite fails to build on aarch64 #3287

Open jasonish opened 2 weeks ago

jasonish commented 2 weeks ago

Bug Description

Build failure on aarch64 with feature "sqlite".

Minimal Reproduction

Info

Introduced with commit 0ea90881c1889e264ed919bd273b3b9f8fb38728.

Build error:

   Compiling sqlx-sqlite v0.8.0-alpha.0 (/home/jason/sqlx/sqlx-sqlite)
error[E0308]: mismatched types
   --> sqlx-sqlite/src/connection/mod.rs:274:43
    |
274 |             let database = CStr::from_ptr(database).to_str().unwrap_or_default();
    |                            -------------- ^^^^^^^^ expected `*const u8`, found `*const i8`
    |                            |
    |                            arguments to this function are incorrect
    |
    = note: expected raw pointer `*const u8`
               found raw pointer `*const i8`
note: associated function defined here
   --> /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/ffi/c_str.rs:274:25

error[E0308]: mismatched types
   --> sqlx-sqlite/src/connection/mod.rs:275:40
    |
275 |             let table = CStr::from_ptr(table).to_str().unwrap_or_default();
    |                         -------------- ^^^^^ expected `*const u8`, found `*const i8`
    |                         |
    |                         arguments to this function are incorrect
    |
    = note: expected raw pointer `*const u8`
               found raw pointer `*const i8`
note: associated function defined here
   --> /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/ffi/c_str.rs:274:25

error[E0308]: mismatched types
   --> sqlx-sqlite/src/connection/mod.rs:364:22
    |
364 |                 Some(update_hook::<F>),
    |                 ---- ^^^^^^^^^^^^^^^^ expected fn pointer, found fn item
    |                 |
    |                 arguments to this enum variant are incorrect
    |
    = note: expected fn pointer `unsafe extern "C" fn(_, _, *const u8, *const u8, _)`
                  found fn item `extern "C" fn(_, _, *const i8, *const i8, _) {connection::update_hook::<F>}`
help: the type constructed contains `extern "C" fn(*mut c_void, i32, *const i8, *const i8, i64) {connection::update_hook::<F>}` due to the type of the argument passed
   --> sqlx-sqlite/src/connection/mod.rs:364:17
    |
364 |                 Some(update_hook::<F>),
    |                 ^^^^^----------------^
    |                      |
    |                      this argument influences the type of `Some`
note: tuple variant defined here
   --> /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/option.rs:580:5

For more information about this error, try `rustc --explain E0308`.
error: could not compile `sqlx-sqlite` (lib) due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
error: could not compile `sqlx-sqlite` (lib) due to 3 previous errors