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

Build failure with 0.10.3 on aarch64 #279

Closed
thias opened this issue Nov 14, 2023 · 3 comments
Closed

Build failure with 0.10.3 on aarch64 #279

thias opened this issue Nov 14, 2023 · 3 comments

Comments

@thias
Copy link

thias commented Nov 14, 2023

I've bumped into a build issue with Aerospike's early alpha module. It's happening on aarch64 only, x86_64 builds fine. It used to build fine for both archs with php-rs version earlier than 0.10.3.

aerospike/php-client#9

I'm pasting the same output from the ticket above here:

   [...]
   Compiling ext-php-rs v0.10.3
   Compiling aerospike-sync v0.1.0 (https://github.com/aerospike/aerospike-client-rust.git?branch=php-rs#56a13d54)
error[E0308]: mismatched types
   --> /builddir/build/BUILD/php-client-0.2.0-vendor/vendor/ext-php-rs/src/types/object.rs:149:17
    |
147 |             let res = zend_hash_str_find_ptr_lc(
    |                       ------------------------- arguments to this function are incorrect
148 |                 &(*self.ce).function_table,
149 |                 name.as_ptr() as *const i8,
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `i8`
    |
    = note: expected raw pointer `*const u8`
               found raw pointer `*const i8`
note: function defined here
   --> /builddir/build/BUILD/php-client-0.2.0-vendor/NTS/target/debug/build/ext-php-rs-522d80dcff97b12d/out/bindings.rs:3:12213
    |
3   | ...estroy (ht : * mut HashTable) ; } extern "C" { pub fn zend_hash_str_find_ptr_lc (ht : * const HashTable , str_ : * const :: std :: os ...
    |                                                          ^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /builddir/build/BUILD/php-client-0.2.0-vendor/vendor/ext-php-rs/src/zend/function.rs:55:47
   |
55 |             let res = zend_fetch_function_str(name.as_ptr() as *const i8, name.len());
   |                       ----------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `i8`
   |                       |
   |                       arguments to this function are incorrect
   |
   = note: expected raw pointer `*const u8`
              found raw pointer `*const i8`
note: function defined here
  --> /builddir/build/BUILD/php-client-0.2.0-vendor/NTS/target/debug/build/ext-php-rs-522d80dcff97b12d/out/bindings.rs:3:41473
   |
3  | ...val , pub prev : zend_vm_stack , } extern "C" { pub fn zend_fetch_function_str (name : * const :: std :: os :: raw :: c_char , len : u...
   |                                                           ^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> /builddir/build/BUILD/php-client-0.2.0-vendor/vendor/ext-php-rs/src/zend/function.rs:68:21
   |
66 |                 let res = zend_hash_str_find_ptr_lc(
   |                           ------------------------- arguments to this function are incorrect
67 |                     &ce.function_table,
68 |                     name.as_ptr() as *const i8,
   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `i8`
   |
   = note: expected raw pointer `*const u8`
              found raw pointer `*const i8`
note: function defined here
  --> /builddir/build/BUILD/php-client-0.2.0-vendor/NTS/target/debug/build/ext-php-rs-522d80dcff97b12d/out/bindings.rs:3:12213
   |
3  | ...estroy (ht : * mut HashTable) ; } extern "C" { pub fn zend_hash_str_find_ptr_lc (ht : * const HashTable , str_ : * const :: std :: os ...
   |                                                          ^^^^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0308`.

Searching for the error, I came across https://users.rust-lang.org/t/expected-const-i8-found-const-u8-for-c-function-pointer-waiting-for-a-const-char/2441 which mentions that std::ffi::CString could be the correct structure to us for cases like this.

@thias
Copy link
Author

thias commented Nov 15, 2023

It seems to me that the issue might have been introduced in 064ef74 by @danog.

@danog danog closed this as completed in bd54b38 Nov 17, 2023
danog added a commit that referenced this issue Nov 17, 2023
@danog
Copy link
Collaborator

danog commented Nov 17, 2023

Should be all good now!

@thias
Copy link
Author

thias commented Nov 20, 2023

It built fine now, thanks a lot!

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

No branches or pull requests

2 participants