!ayCRiZriCVtuCUpeLp:nixos.org

Nix Cross Compiling

381 Members
91 Servers

Load older messages


SenderMessageTime
6 Sep 2024
@k900:0upti.meK900(we as in Qt maintainers)13:55:18
@vramp:matrix.orgvramp joined the room.17:50:17
@vramp:matrix.orgvrampI am struggling with using the cross compilation nixpkgs in a nix shell for development. When I use the package for my architecture (x86 64 linux), my build tool (zig) sees the system libraries and headers. When I switch my shell to use the cross compiliation packages (aarch64 multiplatform), I have to explicitly find the store paths in my NIX_LDFLAGS and NIX_CFLAGS_COMPILE and add them, but then I can cross compile fine. Is there maybe some Arch-dependent path/env var convention of GCC that zig lacks? Is there an example of how to get the lib and header store paths in my shell.nix (like, to set them to environment variables) so that I can pass them to my build tool?18:07:15
@k900:0upti.meK900Our GCC is wrapped specifically to find things correctly18:07:41
@k900:0upti.meK900Your presumably-external zig probably isn't18:07:53
@vramp:matrix.orgvrampah, i am using an external zig binary at the moment, i can try with a zig from nixpkgs to see if there is some magic that someone has added to that recipe18:10:04
@curid:matrix.orgCuridis there some ultra-pure option that masks system libs?18:41:16
@k900:0upti.meK900What system libs?18:43:07
@curid:matrix.orgCurid Everything in /usr/that isn't provided by the shell 18:59:23
@curid:matrix.orgCurid * Everything in /usr/that isn't provided by the nix-shell 18:59:33
@k900:0upti.meK900Oh, on non-NixOS? No, not really19:00:16
@curid:matrix.orgCuridMaybe it'd enter a chroot and only symlink the nix-shell files19:00:26
@k900:0upti.meK900 But you could do --ignore-environment to at least remove things from PATH 19:00:27
@artturin:matrix.orgArtturin nix in fakechroot maybe 🤔 19:41:47
@artturin:matrix.orgArtturinThere's a way to enter the build sandbox but I can't remember what the program is19:45:52
@artturin:matrix.orgArtturinOh and bubblewrap could work too19:51:29
@artturin:matrix.orgArtturinhttps://www.joachim-breitner.de/blog/812-Convenient_sandboxed_development_environment19:52:07
@artturin:matrix.orgArtturinAh here20:04:53
@artturin:matrix.orgArtturinhttps://github.com/Mic92/cntr20:04:54
@artturin:matrix.orgArtturinhttps://github.com/NixOS/nixpkgs/blob/master/doc/hooks/breakpoint.section.md20:11:00
@artturin:matrix.orgArtturin
diff --git a/pkgs/by-name/he/hello/package.nix b/pkgs/by-name/he/hello/package.nix
index 487bc033a23f..dc210011e62b 100644
--- a/pkgs/by-name/he/hello/package.nix
+++ b/pkgs/by-name/he/hello/package.nix
@@ -6,6 +6,7 @@
 , testers
 , versionCheckHook
 , hello
+, breakpointHook
 }:
 
 stdenv.mkDerivation (finalAttrs: {
@@ -19,11 +20,17 @@ stdenv.mkDerivation (finalAttrs: {
 
   doCheck = true;
 
+  nativeBuildInputs = [ breakpointHook ];
   doInstallCheck = true;
   nativeInstallCheckInputs = [
     versionCheckHook
   ];
 
+  postFixup = ''
+    exit 1
+
+  '';
+
   # Give hello some install checks for testing purpose.
   postInstallCheck = ''
     stat "''${!outputBin}/bin/${finalAttrs.meta.mainProgram}"
$ sudo cntr attach -t command cntr-/nix/store/h5x8skq6zgc3iibvkyaz8cq18p6n8hln-hello-2.12.1
[sudo] password for artturin:
artturinlinux% ls
bin  build  dev  etc  nix  proc  tmp  var
20:13:28
@artturin:matrix.orgArtturin Meh ls / shows stuff outside the build so can't be used to mask system files, bwrap is probably the best way 20:27:39
@artturin:matrix.orgArtturin

Hmm well it does have cntr exec

artturinlinux% /nix/store/xfr7105hv2c15j3nbixjl96cp52174z0-cntr-1.5.3/bin/cntr exec ls /
bin  build  dev  etc  nix  proc  tmp  var
20:33:18
@kamillaova:matrix.orgKamilla 'ovaimage.png
Download image.png
23:26:06
@kamillaova:matrix.orgKamilla 'ova
qtdeclarative>   Qt6ShaderTools_DIR was computed by CMake or specified on the command line
qtdeclarative>   by the user:

just... lol

23:26:18
@kamillaova:matrix.orgKamilla 'ovaqtdeclarative now started compiling correctly, 3000+ files vs 700 files (Qt6ShaderToolsTools_DIR -> Qt6ShaderTools_DIR)23:30:07
@kamillaova:matrix.orgKamilla 'ova * qtdeclarative now started compiling correctly, 3000+ files vs 700 files (Qt6ShaderToolsTools_DIR -> Qt6ShaderTools_DIR) UPD: nvm, this is a pkgsBuildBuild's one 23:31:59
7 Sep 2024
@kamillaova:matrix.orgKamilla 'ovaimage.png
Download image.png
01:11:50
@kamillaova:matrix.orgKamilla 'ovaFINALLY01:11:51
@kamillaova:matrix.orgKamilla 'ovahow is this even possible? "I know where Qt6Quick is, but I want to find it in qtbase" ??? https://yaso.su/0nVd8JoL02:01:27

There are no newer messages yet.


Back to Room ListRoom Version: 6