-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
build: module imports do not respect target OS #20492
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
Comments
IIRC this is intended behaviour that different modules can have different |
I see, thank you for linking the correct pull request! It seems the motivation is that, quoting from #18160:
It does indeed seem useful to be able to vary these compilation options across different modules. However, I think this doesn't apply to all compilation options. Specifically, I would consider the target OS a per-compilation option rather than a per-module option. Let me rephrase the two problems mentioned in the original comment:
Some other options also look like natural per-compilation options, e.g. CPU architecture, object format and PIC. EDIT: Closely related question in #14719:
From #14731 (review), emphasis mine:
Perhaps too much was moved? |
Working As Designed |
Zig Version
0.14.0-dev.144+a31fe8aa3
Steps to Reproduce and Observed Behavior
In the following example, a Linux executable is allowed to import a module targeting WASI.
Related Ziggit topic
Expected Behavior
I see two problems with this behavior:
builtin
does not behave as one might expect.Module.CreateOptions
argument ofaddModule
does not do what one might expect.I think the build system should do one of the following:
builtin
, orbuiltin
will differ between the importing and the imported modules.I don't know which is better, partly because I don't understand why
Module
was designed to carry compilation options in the first place.The text was updated successfully, but these errors were encountered: