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

MacOS (arm64): root struct of file 'c' has no member named 'utsname' #15839

Closed
simon0191 opened this issue May 24, 2023 · 1 comment · Fixed by #15843
Closed

MacOS (arm64): root struct of file 'c' has no member named 'utsname' #15839

simon0191 opened this issue May 24, 2023 · 1 comment · Fixed by #15843
Labels
bug Observed behavior contradicts documented or intended behavior os-macos standard library This issue involves writing Zig code for the standard library.
Milestone

Comments

@simon0191
Copy link

Zig Version

0.11.0-dev.3220+447a30299

Steps to Reproduce and Observed Behavior

Reproduce

Run the following program:

const std = @import("std");

pub fn main() !void {
    const stdout_file = std.io.getStdOut().writer();
    var bw = std.io.bufferedWriter(stdout_file);
    const stdout = bw.writer();

    try stdout.print("{}\n", .{std.os.uname()});

    try bw.flush();
}

Result

zig build run
zig build-exe hello-world Debug native: error: the following command failed with 1 compilation errors:
/Users/simon/zig/zig/build/stage3/bin/zig build-exe /Users/simon/zig/hello-world/src/main.zig --cache-dir /Users/simon/zig/hello-world/zig-cache --global-cache-dir /Users/simon/.cache/zig --name hello-world --listen=-
Build Summary: 0/5 steps succeeded; 1 failed (disable with -fno-summary)
run transitive failure
└─ run hello-world transitive failure
   ├─ zig build-exe hello-world Debug native 1 errors
   └─ install transitive failure
      └─ install hello-world transitive failure
         └─ zig build-exe hello-world Debug native (reused)
/Users/simon/zig/zig/build/stage3/lib/zig/std/os.zig:195:27: error: root struct of file 'c' has no member named 'utsname'
pub const utsname = system.utsname;
                    ~~~~~~^~~~~~~~
referenced by:
    uname: /Users/simon/zig/zig/build/stage3/lib/zig/std/os.zig:5745:16
    main: src/main.zig:19:51
    remaining reference traces hidden; use '-freference-trace' to see all reference traces

Expected Behavior

Something like this:

utsname{ .sysname = Darwin, .nodename = xxx, .release = 5.8.12_1, .version = xxxx .machine = x86_64, .domainname = xxxx }
@simon0191 simon0191 added the bug Observed behavior contradicts documented or intended behavior label May 24, 2023
@simon0191 simon0191 changed the title MacOS: root struct of file 'c' has no member named 'utsname' MacOS (arm64): root struct of file 'c' has no member named 'utsname' May 24, 2023
@simon0191
Copy link
Author

Maybe related #6469

@Vexu Vexu added standard library This issue involves writing Zig code for the standard library. os-macos labels May 24, 2023
@Vexu Vexu added this to the 0.11.0 milestone May 24, 2023
Vexu pushed a commit that referenced this issue May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior os-macos standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants