Nix Cross Compiling | 581 Members | |
| 130 Servers |
| Sender | Message | Time |
|---|---|---|
| 3 Nov 2021 | ||
| here you need to inspect targetPlatform I think | 20:09:58 | |
| hostPlatform is the platform that runs the compiler you are building | 20:10:26 | |
| so it's likely to be x86 64 | 20:11:03 | |
In reply to @symphorien:xlumurb.euHmm. When I patched boost for mips32r2, the code after optionals (stdenv.hostPlatform != stdenv.buildPlatform) was significant and responsible to setting the architecture. | 20:14:22 | |
In reply to @symphorien:xlumurb.eu* Hmm. When I patched boost for mips32r2, the code after optionals (stdenv.hostPlatform != stdenv.buildPlatform) was significant and responsible fpr setting the architecture. | 20:14:38 | |
| boost is not a compiler | 20:14:48 | |
* Hmm. When I patched boost for mips32r2, the code after optionals (stdenv.hostPlatform != stdenv.buildPlatform) was significant and responsible for setting the architecture. | 20:15:00 | |
| host platform is the platform the code you compile runs on -> for a lib, it's where you put the .so so mips | 20:15:21 | |
| In my mind these two statements about what is host platform come into conflict :) | 20:17:22 | |
| when you compile a compiler for mips but that runs on x86, hostplatform = x86 and target = mips | 20:18:59 | |
| when you compile boost for mips, hostplatform = mips, target = whatever | 20:19:15 | |
| because $out/bin/gcc is x86 and $out/lib/boost is mips | 20:19:31 | |
| phrased differently, hostplatform is the platform of executables that go in $out | 20:20:28 | |
| modulo the fact that gcc contains some libs for the target platforms but let's keep it simple and approximate | 20:21:14 | |
Btw, if somebody interested getting ldd for host platform when cross-compiling I managed to get this with (pkgs.glibcCross.overrideAttrs (_: { preFixup = null; })).bin. Full command:nix-build --dry-run -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/d4590d21006387dcb190c516724cb1e41c0f8fdf.tar.gz -E 'with import <nixpkgs> { overlays = [ (self: super: { wrapCC = cc: super.wrapCC (cc.overrideAttrs (def: { configureFlags = def.configureFlags ++ [ "--disable-libsanitizer" ]; })); }) ]; crossSystem = { config = "mipsel-linux"; gcc.arch = "mips32r2"; gcc.abi = "32"; }; }; (glibcCross.overrideAttrs (_: { preFixup = null; })).bin'.And it runs fine on the hardware. | 21:45:00 | |
The trick is to use glibcCross instead of glibc. | 21:45:59 | |
* Btw, if somebody interested getting ldd for host platform when cross-compiling I managed to get this with (pkgs.glibcCross.overrideAttrs (_: { preFixup = null; })).bin. Full command:nix-build -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/d4590d21006387dcb190c516724cb1e41c0f8fdf.tar.gz -E 'with import <nixpkgs> { overlays = [ (self: super: { wrapCC = cc: super.wrapCC (cc.overrideAttrs (def: { configureFlags = def.configureFlags ++ [ "--disable-libsanitizer" ]; })); }) ]; crossSystem = { config = "mipsel-linux"; gcc.arch = "mips32r2"; gcc.abi = "32"; }; }; (glibcCross.overrideAttrs (_: { preFixup = null; })).bin'.And it runs fine on the hardware. | 21:55:38 | |
| 22:01:14 | ||
@AleXoundOS:matrix.org: yeah, I think you should be able to apply --disable-libsanitizer only for cross-compiler (or set more specific constraints). def is a set of known attributes being evaluated. Probably something like if (def.stdenv.buildPlatform != def.stdenv.hostPlatform) then [ "--disable-libsanitizer" ] else []. Totally untested. | 22:31:23 | |
| lib.optional is shorter for this usecase | 22:38:32 | |
| 4 Nov 2021 | ||
@AleXoundOS:matrix.org: btw I looked into it and it seems fine to install ldd etc in the cross case as well: https://github.com/NixOS/nixpkgs/pull/144417 | 01:10:13 | |
* @AleXoundOS:matrix.org: btw I looked into it and it seems fine to install ldd etc in the cross case for the normal derivation as well: https://github.com/NixOS/nixpkgs/pull/144417 | 01:10:24 | |
| 5 Nov 2021 | ||
In reply to @trofi:matrix.org
| 16:02:49 | |
What finally worked is easy (after symphorien explained platforms terms):overlay-embedded = self: super: { wrapCC = cc: super.wrapCC ( cc.overrideAttrs ( def: { configureFlags = def.configureFlags ++ ( super.lib.optional def.stdenv.targetPlatform.isMips "--disable-libsanitizer" ); } ) ); }; | 16:03:59 | |
* What finally worked is easy (after symphorien explained platforms terms):self: super: { wrapCC = cc: super.wrapCC ( cc.overrideAttrs ( def: { configureFlags = def.configureFlags ++ ( super.lib.optional def.stdenv.targetPlatform.isMips "--disable-libsanitizer" ); } ) ); }; | 16:04:18 | |
* What finally worked is easy (after symphorien explained platforms terms):self: super: { wrapCC = cc: super.wrapCC ( cc.overrideAttrs ( def: { configureFlags = def.configureFlags ++ ( super.lib.optional super.stdenv.targetPlatform.isMips "--disable-libsanitizer" ); } ) ); }; | 16:05:52 | |
* What finally worked is easy (after symphorien explained platforms terms):self: super: { wrapCC = cc: super.wrapCC ( cc.overrideAttrs ( def: { configureFlags = def.configureFlags ++ (super.lib.optional super.stdenv.targetPlatform.isMips "--disable-libsanitizer" ); } ) ); }; | 16:08:00 | |
| 6 Nov 2021 | ||
| 09:18:43 | ||
| 7 Nov 2021 | ||
| 17:25:38 | ||
| 9 Nov 2021 | ||
| 16:05:03 | ||