log4rs icon indicating copy to clipboard operation
log4rs copied to clipboard

compile failed on mac

Open openersoft opened this issue 1 year ago • 3 comments


System

system : macOS Sonoma 14.4.1 Chip: Apple M1

active-toolchain stable-aarch64-apple-darwin (default)

Cargo.toml

[workspace.dependencies.log] version = "0.4"

[workspace.dependencies.log4rs] version = "1.3.0"

Compile output:

error[E0433]: failed to resolve: use of undeclared crate or module imp --> /og4rs-1.3.0/src/encode/writer/console.rs:54:9 | 54 | imp::Writer::stdout().map(ConsoleWriter) | ^^^ use of undeclared crate or module imp | note: enum crate::append::console::Writer exists but is inaccessible --> /log4rs-1.3.0/src/append/console.rs:49:1 | 49 | enum Writer { | ^^^^^^^^^^^ not accessible

error[E0433]: failed to resolve: use of undeclared crate or module imp --> /log4rs-1.3.0/src/encode/writer/console.rs:62:9 | 62 | imp::Writer::stderr().map(ConsoleWriter) | ^^^ use of undeclared crate or module imp | note: enum crate::append::console::Writer exists but is inaccessible --> /log4rs-1.3.0/src/append/console.rs:49:1 | 49 | enum Writer { | ^^^^^^^^^^^ not accessible

Building [=======================> ] 352/354: log4rs

Done in 452ms. error[E0433]: failed to resolve: use of undeclared crate or module imp --> /log4rs-1.3.0/src/encode/writer/console.rs:46:26 | 46 | pub struct ConsoleWriter(imp::Writer); | ^^^ use of undeclared crate or module imp

error[E0433]: failed to resolve: use of undeclared crate or module imp --> /log4rs-1.3.0/src/encode/writer/console.rs:96:34 | 96 | pub struct ConsoleWriterLock<'a>(imp::WriterLock<'a>); | ^^^ use of undeclared crate or module imp

openersoft avatar Jul 17 '24 03:07 openersoft

Hello @openersoft! It looks like the "missing" imp's are being caused by the rustc compiler not recognizing your OS as belonging to the unix target_family. Have you seen this issue occur with other crates?

gauntl3t12 avatar Jul 21 '24 23:07 gauntl3t12

It does look like it "should" work though. Our configuration targets are utilizing the rustc compilation flags for OS as the console must be written too differently depending on the platform we are targeting. Based on this response from the duckduckgo AI search results. I unfortunately do not have any Mac Silicon to test against, if you discover we should be using a better configuration target, please feel free to create a PR!

Yes, the cfg(unix) configuration option in Rust applies to macOS, including M1 Macs. The cfg(unix) configuration option is set for Unix-like operating systems, which includes macOS.

gauntl3t12 avatar Jul 21 '24 23:07 gauntl3t12

It does look like it "should" work though. Our configuration targets are utilizing the rustc compilation flags for OS as the console must be written too differently depending on the platform we are targeting. Based on this response from the duckduckgo AI search results. I unfortunately do not have any Mac Silicon to test against, if you discover we should be using a better configuration target, please feel free to create a PR!

ok, i'll try to change back to log4rs and build again. thank for your response.

openersoft avatar Jul 23 '24 13:07 openersoft

closing for inactivity

estk avatar May 26 '25 07:05 estk