estk / log4rs

A highly configurable logging framework for Rust
Apache License 2.0
1k stars 148 forks source link

compile failed on mac #384

Open openersoft opened 3 months ago

openersoft commented 3 months ago

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

bconn98 commented 3 months ago

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?

bconn98 commented 3 months ago

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.

openersoft commented 3 months ago

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.