sqlx icon indicating copy to clipboard operation
sqlx copied to clipboard

Feature SQLite fails to build on aarch64

Open jasonish opened this issue 3 weeks ago • 0 comments

Bug Description

Build failure on aarch64 with feature "sqlite".

Minimal Reproduction

  • Build on an arm64 system
  • OR cross build --target aarch64-unknown-linux-musl --features sqlite

Info

  • SQLx version: git main (commit: 1388fc8acc07b41ab38f4dc096f03ba9c7b851f8)
  • SQLx features enabled: sqlite
  • Database server and version: libsqlite3-sys v0.28.0
  • Operating system: Fedora Linux 40 (x86_64), Debian/RaspberryPi OS 11 (aarch64)
  • rustc --version: 1.78.0

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

jasonish avatar Jun 13 '24 18:06 jasonish