-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add macro compile options #9425
Conversation
I think the intention here is good, but I'm not sure it's correct. When cross compiling you have macros run in the host system, but the code is generated for a different target system. The flags of the compiler will be relative to the target system, and it's incorrect to set those too for the host system (the macro run code won't compile). So I think we should only do this if we are not cross-compiling. Basically, cross-compiling and macro About link flags, maybe it's fine to pass those along, I'm not sure. Is this for macro run? |
Yes this is for macro run. Also LGTM, except for skipping the pass when cross compiling, including link flags. So stay as is when in cross compile mode. |
This might be fine as a first step, but for cross compilation, target configuration needs to be independent of host configuration. So there needs to be a way to specificy compiler options for the host system explicitly. |
This is a proposal for a proper implementation: We need specific compiler options for the host system (used for macro run). They could be specified as command line arguments (exactly the same as the existing options but with We probably don't need to implement the whole host options thing right now. A simple and quick fix like this to just use the target options as defaults is a good start. I don't think assigning |
Maybe More on topic, using default compile options for macro runs when in cross compile mode for the moment sounds good to me, until we solve this holistically. Using above approach or something else. |
Closing. The intended use case should be resolved by #9920 |
Compiling Macros within Crystal currently uses system default compile options, not using the options passed to the compiler itself. In order to be compatible with confined build systems like Yocto, the compiler options should be respected across the board, so that even the macros only use libraries explicitly provided by that system if needed.
Concretely, Yocto loads all dependencies (i.e. libraries, binaries, etc.) for it's packages into a folder, and any executable built within the system should only use the provided files, to ensure build portability and repeatability.