# zig rc: Fix include directory detection when cross-compiling from certain host archs \(\#24288\) · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/e8377659560497beb36ec1f981b024f74292c1b9)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: e8377659560497beb36ec1f981b024f74292c1b9

Requested commit: e8377659560497beb36ec1f981b024f74292c1b9

Commit: e8377659560497beb36ec1f981b024f74292c1b9

Tree: a2c00b2800368763c7ef6710f6c2e55c795bdac2

Author: Alex Rønne Petersen

Committer: GitHub

## Message

```
zig rc: Fix include directory detection when cross-compiling from certain host archs (#24288)

* resinator: Only preprocess when the input is an .rc file

* resinator: Fix include directory detection when cross-compiling from certain host archs

Previously, resinator would use the host arch as the target arch when looking for windows-gnu include directories. However, Zig only thinks it can provide a libc for targets specified in the `std.zig.target.available_libcs` array, which only includes a few for windows-gnu. Therefore, when cross-compiling from a host architecture that doesn't have a windows-gnu target in the available_libcs list, resinator would fail to detect the MinGW include directories.

Now, the custom option `/:target` is passed to `zig rc` which is intended for the COFF object file target, but can be re-used for the include directory target as well. For the include directory target, resinator will convert the MachineType to the relevant arch, or fail if there is no  equivalent arch/no support for detecting the includes for the MachineType (currently 64-bit Itanium and EBC).

Fixes the `windows_resources` standalone test failing when the host is, for example, `riscv64-linux`.
```

## Parents

- [d3363b7a61cc0833d6eb60077b90cf12b95155f0](https://git.cafe/gitcafe/zig/commit/d3363b7a61cc0833d6eb60077b90cf12b95155f0?format=markdown)

- [09f4e2d9d138d313b93ab10cbac1fee2a8f4e9f0](https://git.cafe/gitcafe/zig/commit/09f4e2d9d138d313b93ab10cbac1fee2a8f4e9f0?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/e8377659560497beb36ec1f981b024f74292c1b9?format=markdown)
