Uh oh!
There was an error while loading. Please reload this page.
mingw: Use aro instead of clang for preprocessing import libs - #17771
Conversation
68f16db to
fb0fb5bCompareandrewrk
commented
Oct 29, 2023
I suggest to put a check for |
ehaas
commented
Oct 30, 2023
Is there a way to test this locally if I don't have access to a windows machine? I don't want to spam the CI with attempts, since I'm not totally sure where the check should go. It seems like the function is being used, since we're hitting that panic - does that mean that if |
andrewrk
commented
Oct 30, 2023
Yes, here is a way to test it:
If you get the compile error, it's incorrectly including aro in the build. The check goes at the top of if (build_options.only_core_functionality) @panic("building import libs not included in core functionality"); |
andrewrk
commented
Oct 31, 2023
Oops, I gave you some bad advice. It should be checking We don't want the logic to be part of zig1.wasm, however we do want the logic to be part of zig2.c. The use case for |
ehaas
commented
Oct 31, 2023
Ok, if I add that I assume it means it's also safe for me to remove the |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| }); | ||
| errdefer comp.gpa.free(lib_final_path); | ||
| if (!build_options.have_llvm) return error.ZigCompilerNotBuiltWithLLVMExtensions; |
There was a problem hiding this comment.
Ah, I forgot about this. I'll open another issue for making zig support writing import libraries from def files.
ehaas
commented
Nov 2, 2023
@Vexu I will need your help integrating the arocc's |
Vexu
commented
Nov 2, 2023
I don't think there's going to be an easy way to do so because of the bootstrapping process. I'd just copy the generated files from the cache and replace the def files. |
One possible option would be to add a stubbed def file and then in CMake add that as the module for the def files for the purpose of bootstrapping. For building them regularly it should be easy enough to copy some parts from Aro's This should enable bootstrapping: pubfnwith(comptimeProperties: type) type {
returnstruct {
tag: Tag=@enumFromInt(0),
properties: Properties=undefined,
pubconstmax_param_count=1;
pubconstlongest_name=0;
pubconstdata= [_]@This(){.{}};
pubinlinefnfromName(_: []constu8) ?@This() {
returnif (@hasField(Properties, "declspec")) nullelse .{};
}
pubfnnameFromUniqueIndex(_: u16, _: []u8) []u8 {
return"";
}
pubfnuniqueIndex(_: []constu8) ?u16 {
returnnull;
}
pubconstTag=enum(u16) { _ };
pubfnnameFromTag(_: Tag) NameBuf {
return .{};
}
pubfntagFromName(name: []constu8) ?Tag {
return@enumFromInt(name.len);
}
pubconstNameBuf=struct {
pubfnspan(_: *constNameBuf) []constu8 {
return"";
}
};
};
} |
ref: 45eb8a700bfa885af7144a54ffd01f291c6f598f
1459d8a to
caa2c12Compareehaas
commented
Nov 3, 2023
The issue I was seeing was that stage3 was unable to build the zig compiler due to not finding the def files. I fixed it with the following diff: I'm not sure if this is the correct fix; I also did this without your changes to this branch or to aro from today. |
andrewrk
commented
Nov 3, 2023
Please don't add any additional logic to CMakeLists.txt. Zig should depend on Aro only as a set of zig files. I don't want to add any Aro-related build system logic to zig's build process. |
Co-authored-by: Veikka Tuominen <git@vexu.eu>
Vexu
commented
Nov 3, 2023
I think the issue was Vexu/arocc@9f4c28a |
ehaas
commented
Nov 3, 2023
If we want to completely eliminate the |
Based on manual testing, this produces the same output for
kernel32.defwhen compared to clang, other than minor whitespace differences (clang puts a newline at the beginning, and a trailing space on one line which aro does not)Testing steps:
test.czig build-lib -target x86_64-windows-gnu -lkernel32 --verbose-cc test.ca. This will print a
zig clangline to stderr; the output path is the final argument./zig-out/bin/zig build-lib -target x86_64-windows-gnu -lkernel32 --verbose-cc test.ca. This will print
output path: <ZIG_CACHE_PATH>/o/<SOME HASH>/kernel32.defx86_64-windows-gnu,x86-windows-gnu,arm-windows-gnu,aarch64-windows-gnuI manually tested error handling by editing
kernel32.def.into have an invalid preprocessing directive and got the following:Closes#17753