Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature SQLite fails to build on aarch64 #3287

Closed
jasonish opened this issue Jun 13, 2024 · 0 comments · Fixed by #3288
Closed

Feature SQLite fails to build on aarch64 #3287

jasonish opened this issue Jun 13, 2024 · 0 comments · Fixed by #3288
Labels

Comments

@jasonish
Copy link
Contributor

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: 1388fc8)
  • 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 0ea9088.

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 jasonish added the bug label Jun 13, 2024
jasonish added a commit to jasonish/sqlx that referenced this issue Jun 13, 2024
Use "c_char" instead of "i8" as it resolves to the correct string type
on different architectures.

Fixes: launchbadge#3287
jasonish added a commit to jasonish/sqlx that referenced this issue Jun 21, 2024
Use "c_char" instead of "i8" as it resolves to the correct string type
on different architectures.

Fixes: launchbadge#3287
jasonish added a commit to jasonish/sqlx that referenced this issue Jul 20, 2024
Use "c_char" instead of "i8" as it resolves to the correct string type
on different architectures.

Fixes: launchbadge#3287
abonander pushed a commit that referenced this issue Jul 22, 2024
Use "c_char" instead of "i8" as it resolves to the correct string type
on different architectures.

Fixes: #3287
jrasanen pushed a commit to jrasanen/sqlx that referenced this issue Oct 14, 2024
Use "c_char" instead of "i8" as it resolves to the correct string type
on different architectures.

Fixes: launchbadge#3287
jrasanen pushed a commit to jrasanen/sqlx that referenced this issue Oct 14, 2024
Use "c_char" instead of "i8" as it resolves to the correct string type
on different architectures.

Fixes: launchbadge#3287
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant