rust-bio / rust-bio-tools

A set of command line utilities based on Rust-Bio.
MIT License
182 stars 24 forks source link

xlsxwriter v0.3.5 compiling failed #256

Closed adrianodemarino closed 1 year ago

adrianodemarino commented 1 year ago

Hi, thanks a lot for this amazing repo.

I'm trying to install it via cargo install --path .

this is the error i get on a Apple M2 Pro macOS Ventura 13.4.1:

   Compiling xlsxwriter v0.3.5
error[E0412]: cannot find type `size_t` in crate `libxlsxwriter_sys`
    --> /Users/adrianodemarino/.cargo/registry/src/index.crates.io-6f17d22bba15001f/xlsxwriter-0.3.5/src/worksheet.rs:1126:52
     |
1126 |                 buffer.len() as libxlsxwriter_sys::size_t,
     |                                                    ^^^^^^ help: a type alias with a similar name exists: `time_t`
     |
    ::: /Users/adrianodemarino/Downloads/rust_pro/rust-bio-tools-0.42.0/target/release/build/libxlsxwriter-sys-cc1660963e333409/out/bindings.rs:3:6995
     |
3    | ... , stringify ! (_offset))) ; } pub type FILE = __sFILE ; pub type time_t = __darwin_time_t ; pub type lxw_row_t = u32 ; pub type lxw_col_t = u16 ; pub const lxw_boolean_LXW_FALSE ...
     |                                                             --------------- similarly named type alias `time_t` defined here

error[E0412]: cannot find type `size_t` in crate `libxlsxwriter_sys`
    --> /Users/adrianodemarino/.cargo/registry/src/index.crates.io-6f17d22bba15001f/xlsxwriter-0.3.5/src/worksheet.rs:1150:52
     |
1150 |                 buffer.len() as libxlsxwriter_sys::size_t,
     |                                                    ^^^^^^ help: a type alias with a similar name exists: `time_t`
     |
    ::: /Users/adrianodemarino/Downloads/rust_pro/rust-bio-tools-0.42.0/target/release/build/libxlsxwriter-sys-cc1660963e333409/out/bindings.rs:3:6995
     |
3    | ... , stringify ! (_offset))) ; } pub type FILE = __sFILE ; pub type time_t = __darwin_time_t ; pub type lxw_row_t = u32 ; pub type lxw_col_t = u16 ; pub const lxw_boolean_LXW_FALSE ...
     |                                                             --------------- similarly named type alias `time_t` defined here

error[E0063]: missing fields `output_buffer` and `output_buffer_size` in initializer of `lxw_workbook_options`
  --> /Users/adrianodemarino/.cargo/registry/src/index.crates.io-6f17d22bba15001f/xlsxwriter-0.3.5/src/workbook.rs:90:40
   |
90 |             let mut workbook_options = libxlsxwriter_sys::lxw_workbook_options {
   |                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `output_buffer` and `output_buffer_size`

Some errors have detailed explanations: E0063, E0412.
For more information about an error, try `rustc --explain E0063`.
error: could not compile `xlsxwriter` (lib) due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
^C  Building [=======================> ] 448/456: librocksdb-sys(build)
fxwiegand commented 1 year ago

Hi! If xlsxwriter brakes the compilation on apple silicon try updating the package with cargo update -p xlsxwriter. If that works feel free to open a PR that updates the dependency!

adrianodemarino commented 1 year ago

I tried using the latest version of xlsxwriter (v0.6.0), but I encountered a different error.

error[E0599]: no method named `add_worksheet` found for enum `std::result::Result` in the current scope
   --> src/csv/report.rs:131:24
    |
131 |     let mut sheet = wb.add_worksheet(Some("Report"))?;
    |                        ^^^^^^^^^^^^^ method not found in `Result<Workbook, XlsxError>`
    |
note: the method `add_worksheet` exists on the type `xlsxwriter::Workbook`
   --> /Users/adrianodemarino/.cargo/registry/src/index.crates.io-6f17d22bba15001f/xlsxwriter-0.6.0/src/workbook.rs:157:5
    |
157 | /     pub fn add_worksheet<'a>(
158 | |         &'a self,
159 | |         sheet_name: Option<&str>,
160 | |     ) -> Result<Worksheet<'a>, XlsxError> {
    | |_________________________________________^
help: use the `?` operator to extract the `xlsxwriter::Workbook` value, propagating a `Result::Err` value to the caller
    |
131 |     let mut sheet = wb?.add_worksheet(Some("Report"))?;
    |                       +

error[E0599]: no method named `close` found for enum `std::result::Result` in the current scope
   --> src/csv/report.rs:147:8
    |
147 |     wb.close()?;
    |        ^^^^^ method not found in `Result<Workbook, XlsxError>`
    |
note: the method `close` exists on the type `xlsxwriter::Workbook`
   --> /Users/adrianodemarino/.cargo/registry/src/index.crates.io-6f17d22bba15001f/xlsxwriter-0.6.0/src/workbook.rs:277:5
    |
277 |     pub fn close(mut self) -> Result<(), XlsxError> {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: use the `?` operator to extract the `xlsxwriter::Workbook` value, propagating a `Result::Err` value to the caller
    |
147 |     wb?.close()?;
    |       +

For more information about this error, try `rustc --explain E0599`.
error: could not compile `rust-bio-tools` (bin "rbt") due to 2 previous errors
error: failed to compile `rust-bio-tools v0.42.0 (/Users/adrianodemarino/Downloads/rust_pro/rust-bio-tools-0.42.0)`, intermediate artifacts can be found at `/Users/adrianodemarino/Downloads/rust_pro/rust-bio-tools-0.42.0/target`
fxwiegand commented 1 year ago

Ah i see! So there must have been some changes in the API since v0.3.5. I'll quickly have a look into that. I assume you're planning to use rbt for something other than it's rbt csv-report function right?

adrianodemarino commented 1 year ago

Thank you very much for your time. Indeed, I wanted to try it because I'm new to Rust and wanted to experiment a bit with this repository

fxwiegand commented 1 year ago

Great! Just in case you wanted to try the rbt csv-report command (which is causing the error cause it used the xlsx writer package) I would have pointed you to its successor datavzrd.

fxwiegand commented 1 year ago

Should be fixed with https://github.com/rust-bio/rust-bio-tools/pull/257. If you want to try around immediately without waiting for the PR to be merged just checkout the branch with the fix.

adrianodemarino commented 1 year ago

thanks a lot, it worked perfectly now :)