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 can't cross compile mingw #144

Open
Vexu opened this issue Oct 21, 2022 · 7 comments
Open

stage2 can't cross compile mingw #144

Vexu opened this issue Oct 21, 2022 · 7 comments
Labels
bug Something isn't working

Comments

@Vexu
Copy link
Member

Vexu commented Oct 21, 2022

To reproduce on Linux:

$ touch empty.c
$ echo "pub fn main() void {}" > main.zig
$ zig build-exe a.zig a.c -target x86_64-windows -fstage1
$ zig build-exe main.zig empty.c -target x86_64-windows
error(mingw): clang exited with code 1 and stderr: error: unknown target triple 'native-unknown-linux-gnu', please use -triple or -arch

error(mingw): clang exited with code 1 and stderr: error: unknown target triple 'native-unknown-linux-gnu', please use -triple or -arch

error: unable to generate DLL import .lib file: ClangPreprocessorFailed
@Vexu Vexu added the bug Something isn't working label Oct 21, 2022
@kubkon
Copy link
Member

kubkon commented Oct 24, 2022

Hmm, I cannot seem to repro this locally.

@Vexu
Copy link
Member Author

Vexu commented Oct 24, 2022

I don't know if it matters but this happens on a Zig binary built without stage1.

@kubkon
Copy link
Member

kubkon commented Oct 24, 2022

I wonder if this is due to how Zig is built. My invocation is something like:

$ ./stage3/bin/zig build -p stage4 -Dstatic-llvm --search-prefix /home/kubkon/dev/zig-bootstrap/out/x86_64-linux-musl-baseline 

@Vexu
Copy link
Member Author

Vexu commented Oct 24, 2022

Mine is pretty much the same except that --search-prefix points at zig-bootstrap/out/native-linux-gnu-native/

@andrewrk
Copy link
Member

I haven't looked into this yet but as a clue - "native" is a zig-only concept; it's supposed to get resolved into a concrete architecture before it gets sent to LLVM.

@Vexu
Copy link
Member Author

Vexu commented Oct 24, 2022

It seems to work properly on a zig binary built by cmake and a release zig binary built by the cmake zig but not on a debug Zig built by that release zig.

@Vexu Vexu transferred this issue from ziglang/zig Dec 21, 2022
@Vexu
Copy link
Member Author

Vexu commented Dec 21, 2022

This is caused by passing native to build, I think it should either resolve to the canonical value or be disallowed entirely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants