What is a native build environment?

2019-07-20 22:18发布

问题:

I am simply reading information off the interwebs, currently the cmake about page, and I need the information to fill in the gaps, it helps to see the big picture.

Surely the answer is straightforward, I hope. What is a native build environment?

Context: I need to know how to build software on my machine (CodeBlocks, etc), why I need to do this, the advantages of doing this, etc. But first, I need to know every piece of jargon I come across, and I could not find any explanations about exactly what a "Native build environment" is, although I can speculate to some degree.

回答1:

"Native" as in "runs directly in the host operating system" and not "runs in a virtual machine or emulator."

The particular point that CMake's about page is trying to convey is the manner in which CMake achieves cross-platform functionality: specifically not by virtualizing, but by cooperating/collaborating directly with the host system, and the "normal" ways the host system is used to doing things.

Is the build environment then just the directory holding all the garbage needed for a compiler to build the software then?

That's an oversimplification – there's nothing to say that it's a single directory – but more or less, yes. The term is not jargon, it literally means "the state of the world" (aka, environment) needed for the build.

What would you call the other thing then, Non-native?

Sure, or virtualized, or emulated, or whatever other intermediate layer has been added.

Why do we need the distinction as well?

Why not? It's useful to have a concise, clear, simple term so we can communicate precisely and with minimal confusion and ambiguity.



回答2:

Why 'non-native'? If you haven't already figured this out - there is something called cross-compilation.

Simply put, if I don't have access to target hardware (or an equivalent virtual machine) on which the software needs to run, how do I develop this software on my host and package it to run on that target?

Cross-compilation addresses this by providing necessary tools that perform a translation (or other important low-level stuff) to give you the final software. Such an environment to develop software is called non-native.

Well, I believe we need the term to state the technique.



标签: cmake