informationsea / xlsxwriter-rs

Excel file writer for Rust
https://crates.io/crates/xlsxwriter
Apache License 2.0
265 stars 44 forks source link

Compile failed of v0.5.0 on ARM Mac Osx #41

Closed Eugenio-Liso closed 1 year ago

Eugenio-Liso commented 1 year ago

Hello there!

I'm trying to compile a project which depends on xlsxwriter version 0.4.0. I immediately encountered the problem addressed here so I have upgraded its version to 0.5.0.

The problem above has gone away but unfortunately I have another problem when trying to compile:

#26 286.6    Compiling xlsxwriter v0.5.0
#26 286.7 error[E0412]: cannot find type `c_char` in module `std::ffi`
#26 286.7    --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/xlsxwriter-0.5.0/src/worksheet/filter.rs:108:91
#26 286.7     |
#26 286.7 108 |             value_string: c_string_helper.add_opt(self.value.to_str())? as *mut std::ffi::c_char,
#26 286.7     |                                                                                           ^^^^^^ not found in `std::ffi`
#26 286.7     |
#26 286.7 help: consider importing one of these items
#26 286.7     |
#26 286.7 1   | use crate::c_char;
#26 286.7     |
#26 286.7 1   | use std::os::raw::c_char;
#26 286.7     |
#26 286.7 
#26 286.7 error[E0412]: cannot find type `c_char` in module `std::ffi`
#26 286.7    --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/xlsxwriter-0.5.0/src/worksheet/filter.rs:271:70
#26 286.7     |
#26 286.7 271 |                 .map(|x| Ok(cstring_helper.add(x)? as *mut std::ffi::c_char)),
#26 286.7     |                                                                      ^^^^^^ not found in `std::ffi`
#26 286.7     |
#26 286.7 help: consider importing one of these items
#26 286.7     |
#26 286.7 1   | use crate::c_char;
#26 286.7     |
#26 286.7 1   | use std::os::raw::c_char;
#26 286.7     |
#26 286.7 
#26 286.7 error[E0412]: cannot find type `c_char` in module `std::ffi`
#26 286.7    --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/xlsxwriter-0.5.0/src/worksheet/mod.rs:338:93
#26 286.7     |
#26 286.7 338 |             author: workbook.register_option_str(self.author.as_deref())? as *mut std::ffi::c_char,
#26 286.7     |                                                                                             ^^^^^^ not found in `std::ffi`
#26 286.7     |
#26 286.7 help: consider importing one of these items
#26 286.7     |
#26 286.7 5   | use crate::c_char;
#26 286.7     |
#26 286.7 5   | use std::os::raw::c_char;
#26 286.7     |
#26 286.7 
#26 286.7 error[E0412]: cannot find type `c_char` in module `std::ffi`
#26 286.7    --> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/xlsxwriter-0.5.0/src/worksheet/mod.rs:345:35
#26 286.7     |
#26 286.7 345 |                 as *mut std::ffi::c_char,
#26 286.7     |                                   ^^^^^^ not found in `std::ffi`
#26 286.7     |
#26 286.7 help: consider importing one of these items
#26 286.7     |
#26 286.7 5   | use crate::c_char;
#26 286.7     |
#26 286.7 5   | use std::os::raw::c_char;
#26 286.7     |
#26 286.7 
#

It seems to be another problem linked to ARM. The compiler suggests to import some additional crates in xslxwriter.

Thank you!

informationsea commented 1 year ago

Please update Rust or try latest commit in github. std::ffi::c_char was introduced in Rust 1.64.0.