Commit graph

81 commits

Author SHA1 Message Date
Adam Joseph de88969f12 lib/systems: fix uname.processor for powerpc{32,64}, mips64
Cross-compilation of anything downstream of gtk3 requires qemu (due to
gobject-introspection) with --target-list=*-linux-user.  Without this commit,
those qemu builds will fail on a powerpc64le host due to qemu being configured
with --cpu=powerpc64le instead of --cpu=ppc64le.  Unfortunately the build
failure message from qemu in this situation is extremely cryptic.

The root cause turns out not to be the qemu expression, but rather the fact that
on powerpc64le hostPlatform.uname.processor returns the gnu-name (powerpc64le)
for the cpu instead of the linux-name (ppc64le) for the cpu.

uname.processor on mips64el also needs adjustment -- the Linux-name is "mips64"
for both big and little endian (unlike powerpc64, where the Linux-name includes
a "le" suffix):

```
nix@oak:/tmp$ uname -m; lscpu | head -n2
mips64
Architecture:        mips64
Byte Order:          Little Endian
```

uname.processor on powerpc32 has also been adjusted.
2023-01-01 16:20:50 -08:00
figsoda 695d4bc76b lib: fix typos 2022-12-17 18:59:29 -05:00
John Ericson cd27a5b436
Merge pull request #82131 from Ericson2314/bsd-cross
FreeBSD packages: Init at 13.1
2022-11-13 21:35:17 -05:00
Jörg Thalheim 87f4f101d7 cross/mingw: fix emulator for mingw32 2022-11-06 20:29:37 +01:00
John Ericson 66aa02f190 lib/systems: Support FreeBSD
A tricky thing about FreeBSD is that there is no stable ABI across
versions. That means that putting in the version as part of the config
string is paramount.

We have a parsed represenation that separates name versus version to
accomplish this. We include FreeBSD versions 12 and 13 to demonstrate
how it works.
2022-11-04 16:49:28 -04:00
Ivan Nikolaenko f251840237 lib/systems/default.nix: add efiArch suffixes
Move already implemented functionality to the upper level so
it could be used in a more generic way.

Signed-off-by: Ivan Nikolaenko <ivan.nikolaenko@unikie.com>
2022-09-29 08:02:35 +00:00
Artturi d73864ae2f
Merge pull request #189314 from Artturin/addemulatoravailable 2022-09-13 21:13:07 +03:00
Artturin 20f90d3921 lib/systems: add emulatorAvailable
```
nix-repl> pkgsCross.arm-embedded.stdenv.hostPlatform.emulatorAvailable pkgsCross.arm-embedded.buildPackages
false

nix-repl> pkgsCross.aarch64-multiplatform.stdenv.hostPlatform.emulatorAvailable pkgsCross.aarch64-multiplatform.buildPackages
true
```

will be useful for stuff like handling https://github.com/NixOS/nixpkgs/issues/187109
2022-09-11 19:34:15 +03:00
Adam Joseph ba3c562fdc
lib/systems: uname.processor is "uname -m", not "uname -p" (#189958)
The comment in lib/systems/default.nix for uname.processor indicates that it
should match `uname -p`.  I tried that command and found that it reports
`unknown` on all of these machines:

- `x86_64-linux`
- `aarch64-linux`
- `mips64el-linux`
- `powerpc64le-linux`

The command `uname -m` reports the expected value on all of the above.

I think the comment is wrong.  So I fixed it.
2022-09-06 10:17:09 -05:00
Minijackson 4db467f7e9
lib/systems: add MicroBlaze architectures 2022-08-25 16:00:42 +02:00
Daniel Olsen 875d77ca03 lib/systems: Add staticLibrary and library
staticLibrary includes common extensions for static libraries
library is a new common attribute that includes both shared and static extensions
2022-08-16 08:36:57 +00:00
Sandro 7c073f917a
lib/system: resolve TODO 2022-08-02 14:13:18 +02:00
Jari Vetoniemi 539222e8d4 canExecute: check for android 2022-06-29 18:27:16 +09:00
Nick Cao eef4bbd82f
stdenv: fix evaluation of platform emulator 2022-05-24 12:01:56 +08:00
sternenseemann 82c434b3de lib.systems: inform isCompatible users about removal 2022-05-23 21:26:03 +02:00
sternenseemann acb063701a lib.systems.elaborate: expose canExecute predicate over isCompatible
canExecute is like isCompatible, but also checks that the Kernels are
_equal_, i.e. that both platforms use the same syscall interface. This
is crucial in order to actually be able to execute binaries for the
other platform.

isCompatible is dropped, since it has changed semantically and there's
no use case left in nixpkgs.
2022-05-23 21:25:04 +02:00
sternenseemann 168b926435 lib.systems: remove supported, replace with flakeExposed
Since the list only gates the platforms the nixpkgs flake exposes
packages to build on, the `hydra` label made little sense. It was also
only used for this purpose, so the `tier*` attributes were largely
unnecessary.

To reflect the intention more accurately, we expose
`lib.systems.flakeExposed` and use it to gate flake.nix's system list.
2022-05-23 15:27:30 +02:00
Adam Joseph 12371a51e6 lib/systems: add mips64el definitions
MIPS has a large space of {architecture,abi,endianness}; this commit
adds all of them to lib/systems/platforms.nix so we can be done with
it.

Currently lib/systems/inspect.nix has a single "isMips" predicate,
which is a bit ambiguous now that we will have both mips32 and mips64
support, with the latter having two ABIs.  Let's add four new
predicates (isMips32, isMips64, isMips64n32, and isMips64n64) and
treat the now-ambiguous isMips as deprecated in favor of the
more-specific predicates.  These predicates are used mainly for
enabling/disabling target-specific workarounds, and it is extremely
rare that a platform-specific workaround is needed, and both mips32
and mips64 need exactly the same workaround.

The separate predicates (isMips64n32 and isMips64n64) for ABI
distinctions are, unfortunately, useful.  Boost's user-scheduled
threading (used by nix) does does not currently supports mips64n32,
which is a very desirable ABI on routers since they rarely have
more than 2**32 bytes of DRAM.
2022-03-10 20:30:16 -08:00
Jonas Chevalier 8377a7bca9
lib: add list of supported systems (#140428)
Adds the first 3 tiers of RFC0046 that are being used in flake.nix.
2021-10-05 11:14:47 +02:00
Sergei Trofimovich 34e468dc42 lib/systems: add minimal s390x-linux cross-compile support
Tested basic functionality as:

    $ nix-build --arg crossSystem '{ config = "s390x-unknown-linux-gnu"; }' -A re2c
    $ file ./result/bin/re2c
    $ ./result/bin/re2c: ELF 64-bit MSB executable, IBM S/390, version 1 (SYSV),
    dynamically linked, interpreter ...-gnu-2.33-50/lib/ld64.so.1, for GNU/Linux 2.6.32, not stripped
    $ qemu-s390x ./result/bin/re2c --version
    re2c 2.2
2021-09-09 10:58:47 +00:00
Andrew Childs 755d980440 darwin: use "11.0" as sdk and minimum version on aarch64-darwin 2021-05-17 00:27:03 +09:00
John Ericson 18c38f8aee treewide: All the linker to be chosen independently
This will begin the process of breaking up the `useLLVM` monolith. That
is good in general, but I hope will be good for NetBSD and Darwin in
particular.

Co-authored-by: sterni <sternenseemann@systemli.org>
2021-05-14 21:29:51 +00:00
Andrew Childs 6c4ce7960e bintools-wrapper, cc-wrapper: parameterize darwin min version variable
These variables are the ones that the standard toolchain uses, so we
should use those and not always use MACOSX_DEPLOYMENT_TARGET.

See 236a426c12/cctools/ld64/src/ld/PlatformSupport.cpp (L54-L55)
2021-04-11 09:47:10 +09:00
Andrew Childs 44f09ccabf darwin: move deployment target and sdk version to platform config 2021-03-26 15:10:22 +09:00
Andrew Childs 1303257d88 lib/systems: add darwinArch 2021-03-02 17:13:15 +09:00
Ryan Burns 8baac2af75 lib/systems: fix linuxArch for power + riscv
Looks like these got left behind in the
kernelArch -> linuxArch migration.

Fixes:
* pkgsCross.powernv.linuxHeaders
* pkgsCross.riscv64.linuxHeaders
* pkgsCross.riscv32.linuxHeaders
and dependees
2021-01-25 17:57:05 -08:00
John Ericson 9c213398b3 lib: Clean up how linux and gcc config is specified
Second attempt of 8929989614589ee3acd070a6409b2b9700c92d65; see that
commit for details.

This reverts commit 0bc275e634.
2021-01-23 10:01:28 -05:00
Jonathan Ringer 0bc275e634
Revert "lib: Clean up how linux and gcc config is specified"
This is a stdenv-rebuild, and should not be merged
into master

This reverts commit 8929989614.
2021-01-22 14:07:06 -08:00
John Ericson 8929989614 lib: Clean up how linux and gcc config is specified
The `platform` field is pointless nesting: it's just stuff that happens
to be defined together, and that should be an implementation detail.

This instead makes `linux-kernel` and `gcc` top level fields in platform
configs. They join `rustc` there [all are optional], which was put there
and not in `platform` in anticipation of a change like this.

`linux-kernel.arch` in particular also becomes `linuxArch`, to match the
other `*Arch`es.

The next step after is this to combine the *specific* machines from
`lib.systems.platforms` with `lib.systems.examples`, keeping just the
"multiplatform" ones for defaulting.
2021-01-21 22:44:09 -05:00
Ben Siraphob b77ca83282 lib/systems: add emulator for mmix 2020-12-31 13:22:12 +07:00
Linus Heckemann 2ee35e1fce lib/systems: fix kernelArch for x86_64
IA64 (Itanium) is something completely different and certainly not
what we want! x86_64 code lives in arch/x86 just like "classic" x86.
2020-12-17 11:10:38 +01:00
John Ericson 40e7be11c8 lib.systems.platforms: Make selection more flexible
We dont have to match on exact strings if we get accessed to `parsed`.

Co-authored-by: Matthew Bauer <mjbauer95@gmail.com>
2020-11-29 00:03:45 +00:00
John Ericson 1965a241fc
Merge pull request #61019 from volth/gcc.arch-amd
platform.gcc.arch: support for AMD CPUs
2020-09-01 22:31:16 -04:00
Dmitry Bogatov 55195119d5 Distinguish pkgsStatic from pkgsMusl via stdenv.targetPlatform
This change allows derivations to distinguish dynamic musl build and
static musl build in cases where upstream build system can't detect it
by itself.
2020-08-27 18:36:34 -04:00
volth cf7b63df5b gcc.arch: refactor, move tables under lib/ 2020-08-05 11:18:26 +00:00
Aaron Janse 60fd049b65 redox: add as target 2020-07-21 13:11:36 -07:00
Emery Hemingway 9f91fa02a6 lib/systems: Add Genode platform definitions
Add platform definitions for 64-bit ARM and x86. This is sufficient for
for building Genode where a toolchain is provided as an overlay.

Toolchain: git+https://git.sr.ht/~ehmry/genodepkgs?rev=14fc773ac9ecd2cbb30cb4612b284eee83d83546
2020-03-24 20:41:21 +05:30
John Ericson 2682170f21
Merge pull request #80814 from matthewbauer/default-newlib-for-none
lib/systems: Assume newlib when no kernel and no libc is provided
2020-02-22 15:36:03 -05:00
Matthew Bauer 8009c20711 lib/systems: Assume newlib when no kernel and no libc is provided
newlib is the default for most tools when no kernel is provided. Other
exist, but this seems like a safe default.
2020-02-22 12:37:46 -05:00
Chuck a7835b936e lib.systems.elaborate: isArm -> isAarch32
This is the last reference to isArm.  isArm is deprecated after 18.03.
This substitution was performed tree-wide in #37401.
2020-02-05 10:56:14 -08:00
Michael Bishop 4aa1ffae04
initial implementation of vc4 cross-compile 2019-11-19 22:19:15 -04:00
oxalica c98da73802
lib.systems: remove redundant mapping 2019-11-04 12:13:30 +08:00
oxalica 955d032b47
lib.systems: handle mips family properly 2019-11-03 22:10:06 +08:00
volth 35d68ef143 treewide: remove redundant quotes 2019-08-26 21:40:19 +00:00
Matthew Bauer 635b762569 systems: allow passing in string for cross/localSystem
This makes things a little bit more convenient. Just pass in like:

$ nix-build ’<nixpkgs>’ -A hello --argstr localSystem x86_64-linux --argstr crossSystem aarch64-linux
2019-06-04 11:17:25 -04:00
Matthew Bauer 40271ae138 systems: remove forMeta
This is unused now.
2019-06-04 11:09:43 -04:00
Matthew Bauer dbb94b984f wasmtime: init and use for emulation
This isn’t really an "emulator" but it’s the closest concept we have
right now.
2019-04-23 21:48:57 -04:00
Matthew Bauer 9abff4af4f wasm: init cross target
Adds pkgsCross.wasm32 and pkgsCross.wasm64. Use it to build Nixpkgs
with a WebAssembly toolchain.

stdenv/cross: use static overlay on isWasm

isWasm doesn’t make sense dynamically linked.
2019-04-23 21:48:57 -04:00
Matthew Bauer d8934feba1 kernel-headers: infer ARCH from config triple
This makes us less reliant on the systems/examples.nix. You should be
able to cross compile with just your triple:

$ nix build --arg crossSystem '{ config = "armv6l-unknown-linux-gnueabi"; }' stdenv
2019-04-19 14:53:48 -04:00
Matthew Bauer 5eea658778 systems: correct qemu architectures
ppc64le and ppc64 are different targets in the configure script. We
can’t use the same one.

TODO: canonicalize similar ones based on qemu’s configure script.
2019-04-19 12:03:56 -04:00