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

documentation: cross-compilation - partial rewrite #29418

Merged

Conversation

vanschelven
Copy link
Contributor

Motivation for this change

I personally had a hard time trying to understand what was being said in the cross-compilation section, and mentally rewrote some parts trying to figure it out.

When I finally did figure it out, I figured I might as well turn the understanding into a PR. I hope it is useful.

@mention-bot
Copy link

@vanschelven, thanks for your PR! By analyzing the history of the files in this pull request, we identified @Ericson2314 and @matthewbauer to be potential reviewers.

@vanschelven
Copy link
Contributor Author

@Ericson2314 @matthewbauer and others: Is there any way I can help to get this PR accepted? As it stands it's somewhat in limbo.

@Ericson2314
Copy link
Member

Ah sorry, I forgot about it. The others probably left it to me as I single-handedly wrote what's there today.

@@ -11,7 +11,7 @@
For example, a typical use of cross compilation is to compile programs for embedded devices.
These devices often don't have the computing power and memory to compile their own programs.
One might think that cross-compilation is a fairly niche concern, but there are advantages to being rigorous about distinguishing build-time vs run-time environments even when one is developing and deploying on the same machine.
Nixpkgs is increasingly adopting this opinion in that packages should be written with cross-compilation in mind, and nixpkgs should evaluate in a similar way (by minimizing cross-compilation-specific special cases) whether or not one is cross-compiling.
Nixpkgs is increasingly adopting the opinion that packages should be written with cross-compilation in mind, and nixpkgs should evaluate in a similar way (by minimizing cross-compilation-specific special cases) whether or not one is cross-compiling.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -52,30 +52,33 @@
<varlistentry>
<term><varname>hostPlatform</varname></term>
<listitem><para>
The "host platform" is the platform on which a package is run.
The "host platform" is the platform on which a package is to be run.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about "will be run"?

The target platform only applies to programming tools, and even then only is a good for for some of them.
Briefly, GCC, Binutils, GHC, and certain other tools are written in such a way such that a single build can only compile code for a single platform.
Thus, when building them, one must think ahead about which platforms they wish to use the tool to produce machine code for, and build binaries for each.
The "target platform" attribute is harder to understand.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not that its just hard to understand, but actually a flawed concept. It's hard to understand because it's bad, but not yet avoidable.

<para>
A build time dependency, however, implies a shift in platforms between the depending package and the depended-on package.
The meaning of a build time dependency is that to build the depending package we need to be able to run the depended-on's package.
The depending package's build platform is thus reflected in the depended-on package's host platform.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"is thus reflected" -> "is". They are exactly equal.

@vanschelven vanschelven force-pushed the small-documentation-improvements branch from 4ec70ee to fac7dba Compare October 25, 2017 11:13
@vanschelven
Copy link
Contributor Author

@Ericson2314 I have integrated your remarks into a new (now squashed) commit.

Copy link
Member

@Ericson2314 Ericson2314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one last nit. Thanks for your work!

The depending package's build platform is therefore equal to the depended-on package's host platform.
Analogously, the depending package's host platform is equal to the depended-on package's target platform.

In this manner, given the 3 platforms for one package, we can determine the three platforms for all its transitive build time dependencies.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the way that blank line snuck in :), maybe this should be its own pargraph?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we can remove the "build time" you added because this final paragraph will be talking about all kinds of dependencies, not just build time ones.

@vanschelven vanschelven force-pushed the small-documentation-improvements branch from fac7dba to b20916b Compare November 9, 2017 12:45
@vanschelven
Copy link
Contributor Author

@Ericson2314 I've included your last 2 nits in a final squashed commit. We should be good to go now!

@Ericson2314
Copy link
Member

Oops, sorry! I saw you pushed and mistakenly thought I had merged already. Thanks again!

@Ericson2314 Ericson2314 merged commit 350a5e3 into NixOS:master Nov 13, 2017
@Ericson2314 Ericson2314 added the 6.topic: cross-compilation Building packages on a different sort platform than than they will be run on label Nov 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: cross-compilation Building packages on a different sort platform than than they will be run on 8.has: documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants