Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compile failed on mac #384

Open
openersoft opened this issue Jul 17, 2024 · 3 comments
Open

compile failed on mac #384

openersoft opened this issue Jul 17, 2024 · 3 comments

Comments

@openersoft
Copy link


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
Copy link
Collaborator

bconn98 commented Jul 21, 2024

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
Copy link
Collaborator

bconn98 commented Jul 21, 2024

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
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants