[Pkg-rust-maintainers] Bug#1074412: rust-apr:FTBFS:build failure(arguments to this function are incorrect)

Yue Gui yuemeng.gui at gmail.com
Fri Jun 28 10:59:47 BST 2024


Source: rust-apr
Version: 0.1.9-1
Severity: serious
Tags: FTBFS, patch
User: debian-riscv at lists.debian.org
Usertags: riscv64
X-Debbugs-Cc: debian-riscv at lists.debian.org

Dear rust-apr Maintainer,
The package rust-apr build failed on arch riscv64,arm64,ppc64el and s490x
caused by incorrect arguments.The crucial buildd log below:
```

     Running `CARGO=/usr/bin/cargo CARGO_CRATE_NAME=apr
CARGO_MANIFEST_DIR=/<<PKGBUILDDIR>> CARGO_PKG_AUTHORS='Jelmer Vernooij
<jelmer at apache.org>' CARGO_PKG_DESCRIPTION='Rust bindings for Apache
Portable Runtime'
CARGO_PKG_HOMEPAGE='https://github.com/jelmer/apr-rs'
CARGO_PKG_LICENSE=Apache-2.0 CARGO_PKG_LICENSE_FILE=''
CARGO_PKG_NAME=apr
CARGO_PKG_REPOSITORY='https://github.com/jelmer/apr-rs.git'
CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.1.9
CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1
CARGO_PKG_VERSION_PATCH=9 CARGO_PKG_VERSION_PRE=''
CARGO_PRIMARY_PACKAGE=1
LD_LIBRARY_PATH='/<<PKGBUILDDIR>>/target/debug/deps:/usr/lib'
OUT_DIR=/<<PKGBUILDDIR>>/target/riscv64gc-unknown-linux-gnu/debug/build/apr-b417133e16d63cef/out
rustc --crate-name apr --edition=2021 src/lib.rs --error-format=json
--json=diagnostic-rendered-ansi,artifacts,future-incompat
--emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --test -C
metadata=5bed62fa808055ec -C extra-filename=-5bed62fa808055ec
--out-dir /<<PKGBUILDDIR>>/target/riscv64gc-unknown-linux-gnu/debug/deps
--target riscv64gc-unknown-linux-gnu -C
incremental=/<<PKGBUILDDIR>>/target/riscv64gc-unknown-linux-gnu/debug/incremental
-L dependency=/<<PKGBUILDDIR>>/target/riscv64gc-unknown-linux-gnu/debug/deps
-L dependency=/<<PKGBUILDDIR>>/target/debug/deps --extern
ctor=/<<PKGBUILDDIR>>/target/debug/deps/libctor-bd244608a47cb8e3.so -C
debuginfo=2 --cap-lints warn -C linker=riscv64-linux-gnu-gcc -C
link-arg=-Wl,-z,relro --remap-path-prefix
/<<PKGBUILDDIR>>=/usr/share/cargo/registry/apr-0.1.9
--remap-path-prefix
/<<PKGBUILDDIR>>/debian/cargo_registry=/usr/share/cargo/registry -L
native=/usr/lib/riscv64-linux-gnu -l apr-1 -l aprutil-1 -l ldap -l
lber -l apr-1 --cfg system_deps_have_apr_1 --cfg
system_deps_have_apr_util_1`
error[E0308]: arguments to this function are incorrect
 --> src/date.rs:5:14
  |
5 |     unsafe { apr_date_checkmask(data.as_ptr() as *const i8,
mask.as_ptr() as *const i8) != 0 }
  |              ^^^^^^^^^^^^^^^^^^
  |
note: expected `*const u8`, found `*const i8`
 --> src/date.rs:5:33
  |
5 |     unsafe { apr_date_checkmask(data.as_ptr() as *const i8,
mask.as_ptr() as *const i8) != 0 }
  |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  = note: expected raw pointer `*const u8`
             found raw pointer `*const i8`
note: expected `*const u8`, found `*const i8`
 --> src/date.rs:5:61
  |
5 |     unsafe { apr_date_checkmask(data.as_ptr() as *const i8,
mask.as_ptr() as *const i8) != 0 }
  |
^^^^^^^^^^^^^^^^^^^^^^^^^^
  = note: expected raw pointer `*const u8`
             found raw pointer `*const i8`
note: function defined here
 --> /usr/share/cargo/registry/apr-0.1.9/target/riscv64gc-unknown-linux-gnu/debug/build/apr-b417133e16d63cef/out/generated.rs:3:152799
  |
3 | ...r\n @return 1 if the string matches, 0 otherwise"] pub fn
apr_date_checkmask (data : * const :: std :: os :: raw :: c_char ,
mask : * ...
  |
^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
 --> src/date.rs:9:61
  |
9 |     let rv = unsafe {
crate::generated::apr_date_parse_http(data.as_ptr() as *const i8) };
  |                       -------------------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*const u8`, found `*const i8`
  |                       |
  |                       arguments to this function are incorrect
  |
  = note: expected raw pointer `*const u8`
             found raw pointer `*const i8`
note: function defined here
 --> /usr/share/cargo/registry/apr-0.1.9/target/riscv64gc-unknown-linux-gnu/debug/build/apr-b417133e16d63cef/out/generated.rs:3:153452
  |
3 | ...ould be out of range or if the date is invalid."] pub fn
apr_date_parse_http (date : * const :: std :: os :: raw :: c_char) ->
apr_tim...
  |
^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> src/date.rs:18:60
   |
18 |     let rv = unsafe {
crate::generated::apr_date_parse_rfc(data.as_ptr() as *const i8) };
   |                       ------------------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*const u8`, found `*const i8`
   |                       |
   |                       arguments to this function are incorrect
   |
   = note: expected raw pointer `*const u8`
              found raw pointer `*const i8`
note: function defined here
  --> /usr/share/cargo/registry/apr-0.1.9/target/riscv64gc-unknown-linux-gnu/debug/build/apr-b417133e16d63cef/out/generated.rs:3:154709
   |
3  | ...would be out of range or if the date is invalid."] pub fn
apr_date_parse_rfc (date : * const :: std :: os :: raw :: c_char) ->
apr_tim...
   |
^^^^^^^^^^^^^^^^^^

error[E0308]: arguments to this function are incorrect
   --> src/getopt.rs:186:13
    |
186 |             crate::generated::apr_getopt(
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: expected `*const u8`, found `*const i8`
   --> src/getopt.rs:188:17
    |
188 |                 opts.as_slice().as_ptr(),
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^
    = note: expected raw pointer `*const u8`
               found raw pointer `*const i8`
note: expected `*mut *const u8`, found `&mut *const i8`
   --> src/getopt.rs:190:17
    |
190 |                 &mut option_arg,
    |                 ^^^^^^^^^^^^^^^
    = note:    expected raw pointer `*mut *const u8`
            found mutable reference `&mut *const i8`
note: function defined here
   --> /usr/share/cargo/registry/apr-0.1.9/target/riscv64gc-unknown-linux-gnu/debug/build/apr-b417133e16d63cef/out/generated.rs:3:141847
    |
3   | ...APR_SUCCESS  --  The next option was found.\n </PRE>"] pub fn
apr_getopt (os : * mut apr_getopt_t , opts : * const :: std :: os ::
raw...
    |
^^^^^^^^^^

error[E0308]: mismatched types
   --> src/getopt.rs:201:59
    |
201 |                         unsafe { std::ffi::CStr::from_ptr(option_arg) }
    |                                  ------------------------
^^^^^^^^^^ 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
   --> /usr/src/rustc-1.70.0/library/core/src/ffi/c_str.rs:260:25

error[E0308]: mismatched types
   --> src/getopt.rs:237:17
    |
233 |             crate::generated::apr_getopt_long(
    |             --------------------------------- arguments to this
function are incorrect
...
237 |                 &mut option_arg,
    |                 ^^^^^^^^^^^^^^^ expected `*mut *const u8`, found
`&mut *const i8`
    |
    = note:    expected raw pointer `*mut *const u8`
            found mutable reference `&mut *const i8`
note: function defined here
   --> /usr/share/cargo/registry/apr-0.1.9/target/riscv64gc-unknown-linux-gnu/debug/build/apr-b417133e16d63cef/out/generated.rs:3:143529
    |
3   | ...s\n at the end (the original argv is unaffected)."] pub fn
apr_getopt_long (os : * mut apr_getopt_t , opts : * const
apr_getopt_option...
    |
^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> src/getopt.rs:247:59
    |
247 |                         unsafe { std::ffi::CStr::from_ptr(option_arg) }
    |                                  ------------------------
^^^^^^^^^^ 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
   --> /usr/src/rustc-1.70.0/library/core/src/ffi/c_str.rs:260:25

error[E0308]: mismatched types
   --> src/hash.rs:218:48
    |
218 |         crate::generated::apr_hashfunc_default(key.as_ptr() as
*const i8, &mut len)
    |         --------------------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*const u8`, found `*const i8`
    |         |
    |         arguments to this function are incorrect
    |
    = note: expected raw pointer `*const u8`
               found raw pointer `*const i8`
note: function defined here
   --> /usr/share/cargo/registry/apr-0.1.9/target/riscv64gc-unknown-linux-gnu/debug/build/apr-b417133e16d63cef/out/generated.rs:3:78199
    |
3   | ...ern "C" { # [doc = " The default hash function."] pub fn
apr_hashfunc_default (key : * const :: std :: os :: raw :: c_char ,
klen : * ...
    |
^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> src/pool.rs:70:45
   |
70 |             generated::apr_pool_tag(self.0, tag.as_ptr() as *const i8);
   |             -----------------------
^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*const u8`, found `*const i8`
   |             |
   |             arguments to this function are incorrect
   |
   = note: expected raw pointer `*const u8`
              found raw pointer `*const i8`
note: function defined here
  --> /usr/share/cargo/registry/apr-0.1.9/target/riscv64gc-unknown-linux-gnu/debug/build/apr-b417133e16d63cef/out/generated.rs:3:38668
   |
3  | ...n @param pool The pool to tag\n @param tag  The tag"] pub fn
apr_pool_tag (pool : * mut apr_pool_t , tag : * const :: std :: os ::
raw...
   |
^^^^^^^^^^^^

error[E0308]: mismatched types
  --> src/status.rs:76:17
   |
74 |             crate::generated::apr_strerror(
   |             ------------------------------ arguments to this
function are incorrect
75 |                 *self as crate::generated::apr_status_t,
76 |                 buf.as_mut_ptr() as *mut i8,
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*mut u8`,
found `*mut i8`
   |
   = note: expected raw pointer `*mut u8`
              found raw pointer `*mut i8`
note: function defined here
  --> /usr/share/cargo/registry/apr-0.1.9/target/riscv64gc-unknown-linux-gnu/debug/build/apr-b417133e16d63cef/out/generated.rs:3:21091
   |
3  | ...aram bufsize Size of the buffer to hold the string."] pub fn
apr_strerror (statcode : apr_status_t , buf : * mut :: std :: os ::
raw :...
   |
^^^^^^^^^^^^

error[E0308]: mismatched types
  --> src/time.rs:16:41
   |
16 |             crate::generated::apr_ctime(buf.as_mut_ptr() as *mut
i8, self.0);
   |             ---------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*mut u8`, found `*mut i8`
   |             |
   |             arguments to this function are incorrect
   |
   = note: expected raw pointer `*mut u8`
              found raw pointer `*mut i8`
note: function defined here
  --> /usr/share/cargo/registry/apr-0.1.9/target/riscv64gc-unknown-linux-gnu/debug/build/apr-b417133e16d63cef/out/generated.rs:3:54136
   |
3  | ...r String to write to.\n @param t the time to convert"] pub fn
apr_ctime (date_str : * mut :: std :: os :: raw :: c_char , t :
apr_time...
   |                                                                  ^^^^^^^^^

error[E0308]: mismatched types
  --> src/time.rs:27:47
   |
27 |             crate::generated::apr_rfc822_date(buf.as_mut_ptr() as
*mut i8, self.0);
   |             ---------------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*mut u8`, found `*mut i8`
   |             |
   |             arguments to this function are incorrect
   |
   = note: expected raw pointer `*mut u8`
              found raw pointer `*mut i8`
note: function defined here
  --> /usr/share/cargo/registry/apr-0.1.9/target/riscv64gc-unknown-linux-gnu/debug/build/apr-b417133e16d63cef/out/generated.rs:3:53650
   |
3  | ...tring to write to.\n @param t the time to convert"] pub fn
apr_rfc822_date (date_str : * mut :: std :: os :: raw :: c_char , t :
apr_t...
   |
^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> src/uri.rs:134:17
    |
132 |             let status = crate::generated::apr_uri_parse_hostinfo(
    |
---------------------------------------- arguments to this function
are incorrect
133 |                 pool.as_mut_ptr(),
134 |                 hostinfo.as_ptr() as *const i8,
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*const
u8`, found `*const i8`
    |
    = note: expected raw pointer `*const u8`
               found raw pointer `*const i8`
note: function defined here
   --> /usr/share/cargo/registry/apr-0.1.9/target/riscv64gc-unknown-linux-gnu/debug/build/apr-b417133e16d63cef/out/generated.rs:3:152200
    |
3   | ... @return APR_SUCCESS for success or error code"] pub fn
apr_uri_parse_hostinfo (p : * mut apr_pool_t , hostinfo : * const ::
std :: os...
    |
^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> src/uri.rs:152:17
    |
150 |             let status = crate::generated::apr_uri_parse(
    |                          -------------------------------
arguments to this function are incorrect
151 |                 pool.as_mut_ptr(),
152 |                 url.as_ptr() as *const i8,
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*const u8`,
found `*const i8`
    |
    = note: expected raw pointer `*const u8`
               found raw pointer `*const i8`
note: function defined here
   --> /usr/share/cargo/registry/apr-0.1.9/target/riscv64gc-unknown-linux-gnu/debug/build/apr-b417133e16d63cef/out/generated.rs:3:151794
    |
3   | ...ut\n @return APR_SUCCESS for success or error code"] pub fn
apr_uri_parse (p : * mut apr_pool_t , uri : * const :: std :: os ::
raw ::...
    |
^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> src/uri.rs:176:55
    |
176 |     unsafe {
crate::generated::apr_uri_port_of_scheme(scheme.as_ptr() as *const i8)
}
    |              ----------------------------------------
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `*const u8`, found `*const i8`
    |              |
    |              arguments to this function are incorrect
    |
    = note: expected raw pointer `*const u8`
               found raw pointer `*const i8`
note: function defined here
   --> /usr/share/cargo/registry/apr-0.1.9/target/riscv64gc-unknown-linux-gnu/debug/build/apr-b417133e16d63cef/out/generated.rs:3:150380
    |
3   | ...eme\n @return The default port for this scheme"] pub fn
apr_uri_port_of_scheme (scheme_str : * const :: std :: os :: raw ::
c_char) ->...
    |
^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0308`.
error: could not compile `apr` due to 15 previous errors

Caused by:
  process didn't exit successfully: `CARGO=/usr/bin/cargo
CARGO_CRATE_NAME=apr CARGO_MANIFEST_DIR=/<<PKGBUILDDIR>>
CARGO_PKG_AUTHORS='Jelmer Vernooij <jelmer at apache.org>'
CARGO_PKG_DESCRIPTION='Rust bindings for Apache Portable Runtime'
CARGO_PKG_HOMEPAGE='https://github.com/jelmer/apr-rs'
CARGO_PKG_LICENSE=Apache-2.0 CARGO_PKG_LICENSE_FILE=''
CARGO_PKG_NAME=apr
CARGO_PKG_REPOSITORY='https://github.com/jelmer/apr-rs.git'
CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.1.9
CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1
CARGO_PKG_VERSION_PATCH=9 CARGO_PKG_VERSION_PRE=''
CARGO_PRIMARY_PACKAGE=1
LD_LIBRARY_PATH='/<<PKGBUILDDIR>>/target/debug/deps:/usr/lib'
OUT_DIR=/<<PKGBUILDDIR>>/target/riscv64gc-unknown-linux-gnu/debug/build/apr-b417133e16d63cef/out
rustc --crate-name apr --edition=2021 src/lib.rs --error-format=json
--json=diagnostic-rendered-ansi,artifacts,future-incompat
--emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --test -C
metadata=5bed62fa808055ec -C extra-filename=-5bed62fa808055ec
--out-dir /<<PKGBUILDDIR>>/target/riscv64gc-unknown-linux-gnu/debug/deps
--target riscv64gc-unknown-linux-gnu -C
incremental=/<<PKGBUILDDIR>>/target/riscv64gc-unknown-linux-gnu/debug/incremental
-L dependency=/<<PKGBUILDDIR>>/target/riscv64gc-unknown-linux-gnu/debug/deps
-L dependency=/<<PKGBUILDDIR>>/target/debug/deps --extern
ctor=/<<PKGBUILDDIR>>/target/debug/deps/libctor-bd244608a47cb8e3.so -C
debuginfo=2 --cap-lints warn -C linker=riscv64-linux-gnu-gcc -C
link-arg=-Wl,-z,relro --remap-path-prefix
/<<PKGBUILDDIR>>=/usr/share/cargo/registry/apr-0.1.9
--remap-path-prefix
/<<PKGBUILDDIR>>/debian/cargo_registry=/usr/share/cargo/registry -L
native=/usr/lib/riscv64-linux-gnu -l apr-1 -l aprutil-1 -l ldap -l
lber -l apr-1 --cfg system_deps_have_apr_1 --cfg
system_deps_have_apr_util_1` (exit status: 1)
dh_auto_test: error: /usr/share/cargo/bin/cargo test --all returned
exit code 101
make[1]: *** [debian/rules:6: override_dh_auto_test] Error 25
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
make: *** [debian/rules:3: binary-arch] Error 2
dpkg-buildpackage: error: debian/rules binary-arch subprocess returned
exit status 2

```
The full buildd log is here:
https://buildd.debian.org/status/fetch.php?pkg=rust-apr&arch=riscv64&ver=0.1.9-1&stamp=1699404678&raw=0

My solution to this issue:
The error message indicates a type mismatch in the Rust code, where a
*const i8 is being passed instead of the expected *const u8. This is due to
differences in type definitions in C and Rust. Specifically, in C, char is
often defined as i8 in Rust, while in Rust u8 is used for unsigned 8-bit
integers.I can create a patch to replace `i8` with 'u8'.I have tested that
on local and it works well.The patch is in the attachment, please let me
know wheather this solution can be accepted.

Gui-Yue
Best Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-rust-maintainers/attachments/20240628/e1e78ada/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_incorrect_arguments.patch
Type: application/octet-stream
Size: 6253 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-rust-maintainers/attachments/20240628/e1e78ada/attachment-0001.obj>


More information about the Pkg-rust-maintainers mailing list