!ayCRiZriCVtuCUpeLp:nixos.org

Nix Cross Compiling

581 Members
130 Servers

Load older messages


SenderMessageTime
3 Nov 2021
@symphorien:xlumurb.eusymphorienhere you need to inspect targetPlatform I think20:09:58
@symphorien:xlumurb.eusymphorienhostPlatform is the platform that runs the compiler you are building20:10:26
@symphorien:xlumurb.eusymphorienso it's likely to be x86 6420:11:03
@AleXoundOS:matrix.org@AleXoundOS:matrix.org
In reply to @symphorien:xlumurb.eu
hostPlatform is the platform that runs the compiler you are building
Hmm. 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
@AleXoundOS:matrix.org@AleXoundOS:matrix.org
In reply to @symphorien:xlumurb.eu
hostPlatform is the platform that runs the compiler you are building
* 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
@symphorien:xlumurb.eusymphorienboost is not a compiler20:14:48
@AleXoundOS:matrix.org@AleXoundOS:matrix.org * 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
@symphorien:xlumurb.eusymphorienhost platform is the platform the code you compile runs on -> for a lib, it's where you put the .so so mips20:15:21
@AleXoundOS:matrix.org@AleXoundOS:matrix.orgIn my mind these two statements about what is host platform come into conflict :)20:17:22
@symphorien:xlumurb.eusymphorienwhen you compile a compiler for mips but that runs on x86, hostplatform = x86 and target = mips20:18:59
@symphorien:xlumurb.eusymphorienwhen you compile boost for mips, hostplatform = mips, target = whatever20:19:15
@symphorien:xlumurb.eusymphorienbecause $out/bin/gcc is x86 and $out/lib/boost is mips20:19:31
@symphorien:xlumurb.eusymphorienphrased differently, hostplatform is the platform of executables that go in $out20:20:28
@symphorien:xlumurb.eusymphorienmodulo the fact that gcc contains some libs for the target platforms but let's keep it simple and approximate20:21:14
@AleXoundOS:matrix.org@AleXoundOS:matrix.org 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
@AleXoundOS:matrix.org@AleXoundOS:matrix.org The trick is to use glibcCross instead of glibc. 21:45:59
@AleXoundOS:matrix.org@AleXoundOS:matrix.org * 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
@piegames:matrix.orgpiegames set a profile picture.22:01:14
@trofi:matrix.orgtrofi @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
@sandro:supersandro.deSandrolib.optional is shorter for this usecase22:38:32
4 Nov 2021
@sternenseemann:systemli.orgsterni @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
@sternenseemann:systemli.orgsterni * @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
@AleXoundOS:matrix.org@AleXoundOS:matrix.org
In reply to @trofi:matrix.org
@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.

stdenv is not there: error: attribute 'stdenv' missing, at .... And nixpkgs manual states:

The function overrideAttrs allows overriding the attribute set passed to a stdenv.mkDerivation call

stdenv is not in attribute set.

16:02:49
@AleXoundOS:matrix.org@AleXoundOS:matrix.org 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
@AleXoundOS:matrix.org@AleXoundOS:matrix.org * 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
@AleXoundOS:matrix.org@AleXoundOS:matrix.org * 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
@AleXoundOS:matrix.org@AleXoundOS:matrix.org * 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
@test:boba.bestTseb joined the room.09:18:43
7 Nov 2021
@mic92:nixos.devMic92 set a profile picture.17:25:38
9 Nov 2021
@nurelin:matrix.orgnurelin set a profile picture.16:05:03

Show newer messages


Back to Room ListRoom Version: 6