Compilation failure on master on OpenBSD #242

Closed
opened 2023-07-03 00:42:19 +03:00 by 22h49 · 7 comments

The first problem is the 0.9.75 version of openssl-sys which is too old to support newer versions of LibreSSL. Doing cargo update or patching the package fixes the issue.

During compilation the following is thrown:

error[E0425]: cannot find value `LC_TIME_MASK` in crate `libc`
  --> melib/src/utils/datetime.rs:97:18
   |
97 |     Time = libc::LC_TIME_MASK,
   |                  ^^^^^^^^^^^^ not found in `libc`

error[E0425]: cannot find value `LC_ALL_MASK` in crate `libc`
  --> melib/src/utils/datetime.rs:98:17
   |
98 |     All = libc::LC_ALL_MASK,
   |                 ^^^^^^^^^^^ not found in `libc`

warning: unused import: `std::os::unix::io::AsRawFd`
  --> melib/src/utils/shellexpand.rs:25:5
   |
25 | use std::os::unix::io::AsRawFd;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

Fixing the values manually to 2 and 2 << 1 respectively solves the problem (the source of libc provides these hardcoded values)

The first problem is the `0.9.75` version of `openssl-sys` which is too old to support newer versions of LibreSSL. Doing `cargo update` or patching the package fixes the issue. During compilation the following is thrown: ``` error[E0425]: cannot find value `LC_TIME_MASK` in crate `libc` --> melib/src/utils/datetime.rs:97:18 | 97 | Time = libc::LC_TIME_MASK, | ^^^^^^^^^^^^ not found in `libc` error[E0425]: cannot find value `LC_ALL_MASK` in crate `libc` --> melib/src/utils/datetime.rs:98:17 | 98 | All = libc::LC_ALL_MASK, | ^^^^^^^^^^^ not found in `libc` warning: unused import: `std::os::unix::io::AsRawFd` --> melib/src/utils/shellexpand.rs:25:5 | 25 | use std::os::unix::io::AsRawFd; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default ``` Fixing the values manually to `2` and `2 << 1` respectively solves the problem (the source of libc provides these hardcoded values)

Hello thanks a lot for the report! We need to push a fix for the openssl dependency.

As for the locale stuff, the openbsd port of meli has this patch:

9553e57ddd/mail/meli/patches/patch-modcargo-crates_libc-0_2_126_src_unix_bsd_netbsdlike_openbsd_mod_rs

https://patch-diff.githubusercontent.com/raw/rust-lang/libc/pull/2965.diff

Index: modcargo-crates/libc-0.2.126/src/unix/bsd/netbsdlike/openbsd/mod.rs
--- modcargo-crates/libc-0.2.126/src/unix/bsd/netbsdlike/openbsd/mod.rs.orig
+++ modcargo-crates/libc-0.2.126/src/unix/bsd/netbsdlike/openbsd/mod.rs
@@ -1628,6 +1628,18 @@ pub const EPROC_SLEADER: i32 = 0x02; // session leader
 pub const EPROC_UNVEIL: i32 = 0x04; // has unveil settings
 pub const EPROC_LKUNVEIL: i32 = 0x08; // unveil is locked
 
+pub const LC_COLLATE_MASK: ::c_int = 1 << ::LC_COLLATE;
+pub const LC_CTYPE_MASK: ::c_int = 1 << ::LC_CTYPE;
+pub const LC_MONETARY_MASK: ::c_int = 1 << ::LC_MONETARY;
+pub const LC_NUMERIC_MASK: ::c_int = 1 << ::LC_NUMERIC;
+pub const LC_TIME_MASK: ::c_int = 1 << ::LC_TIME;
+pub const LC_MESSAGES_MASK: ::c_int = 1 << ::LC_MESSAGES;
+
+const _LC_LAST: ::c_int = 7;
+pub const LC_ALL_MASK: ::c_int = (1 << _LC_LAST) - 2;
+
+pub const LC_GLOBAL_LOCALE: ::locale_t = -1isize as ::locale_t;
+
 const_fn! {
     {const} fn _ALIGN(p: usize) -> usize {
         (p + _ALIGNBYTES) & !_ALIGNBYTES

Maybe we should incorporate these under a #[cfg(target_os="openbsd")] attribute. I would like to remove the libc locale dependency in the long term.

Hello thanks a lot for the report! We need to push a fix for the openssl dependency. As for the locale stuff, the openbsd port of meli has this patch: https://github.com/openbsd/ports/blob/9553e57ddd27e94ac1451149e12ec9e07d906c12/mail/meli/patches/patch-modcargo-crates_libc-0_2_126_src_unix_bsd_netbsdlike_openbsd_mod_rs ```diff https://patch-diff.githubusercontent.com/raw/rust-lang/libc/pull/2965.diff Index: modcargo-crates/libc-0.2.126/src/unix/bsd/netbsdlike/openbsd/mod.rs --- modcargo-crates/libc-0.2.126/src/unix/bsd/netbsdlike/openbsd/mod.rs.orig +++ modcargo-crates/libc-0.2.126/src/unix/bsd/netbsdlike/openbsd/mod.rs @@ -1628,6 +1628,18 @@ pub const EPROC_SLEADER: i32 = 0x02; // session leader pub const EPROC_UNVEIL: i32 = 0x04; // has unveil settings pub const EPROC_LKUNVEIL: i32 = 0x08; // unveil is locked +pub const LC_COLLATE_MASK: ::c_int = 1 << ::LC_COLLATE; +pub const LC_CTYPE_MASK: ::c_int = 1 << ::LC_CTYPE; +pub const LC_MONETARY_MASK: ::c_int = 1 << ::LC_MONETARY; +pub const LC_NUMERIC_MASK: ::c_int = 1 << ::LC_NUMERIC; +pub const LC_TIME_MASK: ::c_int = 1 << ::LC_TIME; +pub const LC_MESSAGES_MASK: ::c_int = 1 << ::LC_MESSAGES; + +const _LC_LAST: ::c_int = 7; +pub const LC_ALL_MASK: ::c_int = (1 << _LC_LAST) - 2; + +pub const LC_GLOBAL_LOCALE: ::locale_t = -1isize as ::locale_t; + const_fn! { {const} fn _ALIGN(p: usize) -> usize { (p + _ALIGNBYTES) & !_ALIGNBYTES ``` Maybe we should incorporate these under a `#[cfg(target_os="openbsd")]` attribute. I would like to remove the libc locale dependency in the long term.
Manos Pitsidianakis added the
bug
bsd
labels 2023-07-03 00:58:15 +03:00

@22h49 Could you confirm if branch fix/242 fixes compilation on OpenBSD?

@22h49 Could you confirm if branch [`fix/242`](https://git.meli.delivery/meli/meli/src/branch/fix/242) fixes compilation on OpenBSD?

The compilation now fails with

error[E0412]: cannot find crate `c_int` in the list of imported crates
   --> melib/src/utils/datetime.rs:103:19
    |
103 | const _LC_LAST: ::c_int = 7;
    |                   ^^^^^ not found in the list of imported crates
    |
help: consider importing one of these items
    |
40  | use core::ffi::c_int;
    |
40  | use libc::c_int;
    |
40  | use std::ffi::c_int;
    |
40  | use std::os::raw::c_int;
    |
help: if you import `c_int`, refer to it directly
    |
103 - const _LC_LAST: ::c_int = 7;
103 + const _LC_LAST: c_int = 7;
The compilation now fails with ```rust error[E0412]: cannot find crate `c_int` in the list of imported crates --> melib/src/utils/datetime.rs:103:19 | 103 | const _LC_LAST: ::c_int = 7; | ^^^^^ not found in the list of imported crates | help: consider importing one of these items | 40 | use core::ffi::c_int; | 40 | use libc::c_int; | 40 | use std::ffi::c_int; | 40 | use std::os::raw::c_int; | help: if you import `c_int`, refer to it directly | 103 - const _LC_LAST: ::c_int = 7; 103 + const _LC_LAST: c_int = 7; ```

But indeed all of the openssl issues have been fixed, so I don't know if you want to close this issue or also resolve the libc dependency (or cfg gate it on OpenBSD)

But indeed all of the openssl issues have been fixed, so I don't know if you want to close this issue or also resolve the libc dependency (or `cfg` gate it on OpenBSD)

@22h49 I pushed a fix. It's night time now so I'll try to test it tomorrow on a virtualized openbsd. Feel free to close the issue if you want or I'll close it when I verify it, either is equally fine.

@22h49 I pushed a fix. It's night time now so I'll try to test it tomorrow on a virtualized openbsd. Feel free to close the issue if you want or I'll close it when I verify it, either is equally fine.

Can confirm that it's compiling and working now on OpenBSD on the fixed branch, closing. (Also thanks for writing and maintaining this, meli is quite cool)

Can confirm that it's compiling and working now on OpenBSD on the fixed branch, closing. (Also thanks for writing and maintaining this, meli is quite cool)
22h49 closed this issue 2023-07-04 02:01:09 +03:00

@22h49 and thank you for taking the time to report this!

@22h49 and thank you for taking the time to report this!
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: meli/meli#242
There is no content yet.