Jay
Jay

Reputation: 19

Why do I not need to specify OS version when cross-compiling?

Preface: my experience cross-compiling code is minimal, and I'm mostly coming at this from a golang background

I can cross-compile golang like so GOOS=<OS> GOARCH=<architecture> go build <source-file>
Where OS could be something like "linux" or "windows". Why do I not need to specify which version of linux or windows (or whatever else)? Surely e.g. linux has changed over the years and I should need to specify a version if it depends on it.

I guess another way to phrase this question is, if I compile some code on my linux machine, would that run on all older version of linux? Surely not

A related question: I suppose OS here means OS in the sense of the kernel, not OS in the wider sense it is sometimes used to mean the whole GNU+linux system etc.

Upvotes: 0

Views: 318

Answers (1)

colm.anseo
colm.anseo

Reputation: 22037

From the Go Wiki, the minimum supported Linux Kernel (GOARCH amd64 or 386) is:

2.6.23 or later

so basically any Linux distribution from late 2007 onwards.

Other Linux architectures (arm*, mips*, s390x) supported kernel versions can be found here.

Upvotes: 3

Related Questions