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

stage2 unable to build stage3 on x86_64 macos: panic: incorrect alignment #12387

Closed
Tracked by #12368
andrewrk opened this issue Aug 9, 2022 · 2 comments · Fixed by #12398
Closed
Tracked by #12368

stage2 unable to build stage3 on x86_64 macos: panic: incorrect alignment #12387

andrewrk opened this issue Aug 9, 2022 · 2 comments · Fixed by #12398
Labels
arch-x86_64 64-bit x86 bug Observed behavior contradicts documented or intended behavior frontend Tokenization, parsing, AstGen, Sema, and Liveness. linking os-macos
Milestone

Comments

@andrewrk
Copy link
Member

andrewrk commented Aug 9, 2022

Zig Version: 0.10.0-dev.3511+17511a48f

andy@Andrews-Air-2:~/dev/zig/build$ stage2/bin/zig build -p stage3 -Denable-llvm -Denable-stage1
MachO Flush... thread 7320547 panic: incorrect alignment
/Users/andy/dev/zig/src/link/MachO/Object.zig:104:72: 0x1032c60bc in link.MachO.Object.parse (zig1)
                    @alignCast(@alignOf(macho.nlist_64), &self.contents[symtab.symoff]),
                                                                       ^
/Users/andy/dev/zig/src/link/MachO/Archive.zig:228:21: 0x1032b8f44 in link.MachO.Archive.parseObject (zig1)
    try object.parse(allocator, cpu_arch);
                    ^
/Users/andy/dev/zig/src/link/MachO.zig:2676:51: 0x103377880 in link.MachO.resolveSymbolsInArchives (zig1)
            const object = try archive.parseObject(gpa, cpu_arch, offsets.items[0]);
                                                  ^
/Users/andy/dev/zig/src/link/MachO.zig:1108:42: 0x1032440dd in link.MachO.linkOneShot (zig1)
        try self.resolveSymbolsInArchives();
                                         ^
/Users/andy/dev/zig/src/link/MachO.zig:414:45: 0x1032266d8 in link.MachO.flush (zig1)
        .one_shot => return self.linkOneShot(comp, prog_node),
                                            ^
/Users/andy/dev/zig/src/link.zig:641:72: 0x103223788 in link.File.flush (zig1)
            .macho => return @fieldParentPtr(MachO, "base", base).flush(comp, prog_node),
                                                                       ^
/Users/andy/dev/zig/src/Compilation.zig:2335:24: 0x1031bef48 in Compilation.flush (zig1)
    comp.bin_file.flush(comp, prog_node) catch |err| switch (err) {
                       ^
/Users/andy/dev/zig/src/Compilation.zig:2316:23: 0x1031b1e35 in Compilation.update (zig1)
        try comp.flush(main_progress_node);
                      ^
/Users/andy/dev/zig/src/main.zig:3327:20: 0x103149030 in main.updateModule (zig1)
    try comp.update();
                   ^

Same command works fine on my M1 mac. You need to check out the stage3-default branch (#12368) to replicate this. I'm using homebrew LLVM and zig env says

error: Zig was built/linked incorrectly: LLVM and Clang have separate copies of libc++
       If you are dynamically linking LLVM, make sure you dynamically link libc++ too
@andrewrk andrewrk added bug Observed behavior contradicts documented or intended behavior os-macos frontend Tokenization, parsing, AstGen, Sema, and Liveness. arch-x86_64 64-bit x86 labels Aug 9, 2022
@andrewrk andrewrk added this to the 0.10.0 milestone Aug 9, 2022
@kubkon
Copy link
Member

kubkon commented Aug 9, 2022

OK, got a local repro in my 10.15.7 x64 macos VM and will investigate next.

@kubkon
Copy link
Member

kubkon commented Aug 10, 2022

Just an FYI that this is not reproable on my 12 x64 macos, sadly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-x86_64 64-bit x86 bug Observed behavior contradicts documented or intended behavior frontend Tokenization, parsing, AstGen, Sema, and Liveness. linking os-macos
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants