!ayCRiZriCVtuCUpeLp:nixos.org

Nix Cross Compiling

483 Members
101 Servers

Load older messages


SenderMessageTime
17 Apr 2025
@rosssmyth:matrix.orgrosssmyth* I think PDP had a funny thing where this was not always true, but that was also before IEEE floats19:39:50
@rosssmyth:matrix.orgrosssmythLLVM makes a lot of assumptions about the fp environment, so I would be surprised if llvm even supported such a thing.19:41:27
@rosssmyth:matrix.orgrosssmyth* LLVM makes a lot of implicit assumptions about the fp environment, so I would be surprised if llvm even supported such a thing.19:43:28
@trofi:matrix.org@trofi:matrix.org

Checking gcc source tree for case of WORDS_BIG_ENDIAN != FLOAT_WORDS_BIG_ENDIAN git grep -P '#define (FLOAT_)?WORDS_BIG_ENDIAN' https://bpa.st/raw/NKQQ I think I only see pdp11:

gcc/config/pdp11/pdp11.h:#define WORDS_BIG_ENDIAN 1
gcc/config/pdp11/pdp11.h:#define FLOAT_WORDS_BIG_ENDIAN 0
21:28:05
@trofi:matrix.org@trofi:matrix.org (and it's one of two targets(along with mmix) that explicitly defines FLOAT_WORDS_BIG_ENDIAN, mmix probably does it out of redundancy) 21:30:35
18 Apr 2025
@rosscomputerguy:matrix.orgTristan Ross
qttranslations> -- Install configuration: "Release"
qttranslations> -- Installing: /nix/store/fx4yvhdpq7kld3gq0dqcxd5y7yb4i942-qttranslations-6.9.0/translations/assistant_ar.qm
qttranslations> CMake Error at src/translations/cmake_install.cmake:54 (file):
qttranslations>   file INSTALL cannot copy file
qttranslations>   "/build/qttranslations-everywhere-src-6.9.0/build//nix/store/fx4yvhdpq7kld3gq0dqcxd5y7yb4i942-qttranslations-6.9.0/translations/assistant_ar.qm"
qttranslations>   to
qttranslations>   "/nix/store/fx4yvhdpq7kld3gq0dqcxd5y7yb4i942-qttranslations-6.9.0/translations/assistant_ar.qm":
qttranslations>   Permission denied.
qttranslations> Call Stack (most recent call first):
qttranslations>   src/cmake_install.cmake:47 (include)
qttranslations>   cmake_install.cmake:47 (include)
qttranslations>
qttranslations>
qttranslations> FAILED: CMakeFiles/install.util
qttranslations> cd /build/qttranslations-everywhere-src-6.9.0/build && /nix/store/lc66gmgm58bbx4y5jjkqscriwvshp9fd-cmake-3.31.6/bin/cmake -P cmake_install.cmake
qttranslations> ninja: build stopped: subcommand failed.

Compiling with neoverse-n1 in gcc.tune, qttranslations failed in an odd way

01:01:51
@rosscomputerguy:matrix.orgTristan RossDang, gfortran is broken and it's the same as https://github.com/NixOS/nixpkgs/issues/37495002:54:22
@simon.brandner:envs.netŠimon Brandner joined the room.07:29:01
@simon.brandner:envs.netŠimon Brandner Hi, could someone please help me out with making a nix shell for compiling using arm-linux-gnueabihf-gcc with -lrt and -lpthread on my x86 system? Thank you 07:31:35
@dramforever:matrix.orgdramforever try pkgsCross.armv7l-hf-multiplatform.stdenv.cc? 07:34:11
@dramforever:matrix.orgdramforever

like this

$ cat hello.c                      
#include <stdio.h>
int main() { printf("hello sizeof(void*) = %zd\n", sizeof(void*)); }
$ vim hello.c                
$ armv7l-unknown-linux-gnueabihf-gcc -o armhello -lrt -lpthread hello.c
$ qemu-arm
qemu: no user program specified
$ qemu-arm ./armhello 
hello sizeof(void*) = 4
07:36:33
@dramforever:matrix.orgdramforever *

like this

$ cat hello.c
#include <stdio.h>
int main() { printf("hello sizeof(void*) = %zd\n", sizeof(void*)); }
$ armv7l-unknown-linux-gnueabihf-gcc -o armhello -lrt -lpthread hello.c
$ qemu-arm ./armhello
hello sizeof(void*) = 4
07:36:54
@simon.brandner:envs.netŠimon BrandnerI'll give it a go in a minute07:40:21
@simon.brandner:envs.netŠimon Brandner

So I simply tried nix-shell -p pkgsCross.armv7l-hf-multiplatform.stdenv.cc, if that is what you meant and got these errors:

/nix/store/viscj6hs10c5as7h53cxxw59yvgk505z-armv7l-unknown-linux-gnueabihf-binutils-2.43.1/bin/armv7l-unknown-linux-gnueabihf-ld: cannot find -lrt: No such file or directory
/nix/store/viscj6hs10c5as7h53cxxw59yvgk505z-armv7l-unknown-linux-gnueabihf-binutils-2.43.1/bin/armv7l-unknown-linux-gnueabihf-ld: cannot find -lpthread: No such file or direc
tory
/nix/store/viscj6hs10c5as7h53cxxw59yvgk505z-armv7l-unknown-linux-gnueabihf-binutils-2.43.1/bin/armv7l-unknown-linux-gnueabihf-ld: cannot find -lc: No such file or directory
07:55:38
@dramforever:matrix.orgdramforeveri can't reproduce this problem, how are you running this?09:36:34
@dramforever:matrix.orgdramforeverwhat are you compiling09:36:39
@dramforever:matrix.orgdramforeverhmm, could it be different a nixpkgs version?09:40:02
@dramforever:matrix.orgdramforever yeah i don't get see any problem on latest nixos-unstable (2631b0b7abcea6e640ce31cd78ea58910d31e650) 10:11:22
@simon.brandner:envs.netŠimon Brandner

So this turned out to work:

# flake.nix
{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
  };
  outputs = {nixpkgs, ...}: let
    system = "x86_64-linux";
    pkgs = import nixpkgs {
      inherit system;
      crossSystem = {
        config = "armv7l-linux-gnueabihf";
      };
    };
  in {
    devShells.${system}.default = import ./nix/shell.nix {inherit pkgs;};
  };
}

and

# nix/shell.nix
{pkgs, ...}:
pkgs.mkShell {
  buildInputs = [
    pkgs.glibc
    pkgs.glibc.static
  ];

  makeFlags = [
    "CC=${pkgs.stdenv.cc.targetPrefix}cc"
    "CXX=${pkgs.stdenv.cc.targetPrefix}g++"
  ];
}

with pkgs.glibc.static being the thing that made the difference

10:32:16
@simon.brandner:envs.netŠimon Brandner(it simply turned out the program needed to be statically linked, so it needed the static version of glibc which now makes sense given the circumstances 😅)13:18:42
19 Apr 2025
@jopejoe1:matrix.orgjopejoe1 (4094@eh22) changed their display name from jopejoe1 to jopejoe1 (4094@eh22).12:59:36
@alexfmpe:matrix.orgalexfmpe changed their profile picture.23:55:44
20 Apr 2025
@colin:uninsane.orgColinanyone given thought about how to get blueprint-compiler to be cross friendly?02:54:51
@colin:uninsane.orgColinit's used by a lot of gtk4 apps. runs at compile time and wants to load the GI typelibs used by the application. not sure how to wrangle that except by building an extra copy of every runtime dependency, but targeting the build machine, so that blueprint-compiler can import it02:57:11
@dramforever:matrix.orgdramforeverone possible way is to use an emulator of the host platform03:27:18
@dramforever:matrix.orgdramforever try grepping stdenv.hostPlatform.emulator nix nixpkgs for examples 03:27:53
@dramforever:matrix.orgdramforever * try grepping stdenv.hostPlatform.emulator in nixpkgs for examples 03:27:56
@dramforever:matrix.orgdramforever... you know you have nix brain when you typo "in" into "nix"03:28:15
@spikespaz:envs.netspikespaz set a profile picture.04:26:18
21 Apr 2025
@rosscomputerguy:matrix.orgTristan Ross

Trying to fix pkgsLLVM.linux to work correctly, got this odd issue:

linux> make -f /build/linux-6.6.87/tools/build/Makefile.build dir=. obj=fixdep
linux> /nix/store/rpxlridr3yn6mbmd34r0bya9qv91b79s-gcc-wrapper-14.2.1.20250322/bin/cc   -o /build/linux-6.6.87/build/tools/bpf/resolve_btfids/fixdep /build/linux-6.6.87/build/tools/bpf/resolve_btfids/fixdep-in.o
linux> mkdir -p /build/linux-6.6.87/build/tools/bpf/resolve_btfids//libsubcmd
linux> make -C /build/linux-6.6.87/tools/lib/subcmd/ OUTPUT=/build/linux-6.6.87/build/tools/bpf/resolve_btfids/libsubcmd/ \
linux>             DESTDIR=/build/linux-6.6.87/build/tools/bpf/resolve_btfids/libsubcmd/ AR="/nix/store/0w9bd0ljiyj2crmywkm0mvm4nwsswgb0-binutils-wrapper-2.44/bin/ar" CC="/nix/store/rpxlridr3yn6mbmd34r0bya9qv91b79s-gcc-wrapper-14.2.1.20250322/bin/cc" LD="/nix/store/0w9bd0ljiyj2crmywkm0mvm4nwsswgb0-binutils-wrapper-2.44/bin/ld" ARCH="arm64" CROSS_COMPILE="" EXTRA_CFLAGS="" prefix= subdir= \
linux>             /build/linux-6.6.87/build/tools/bpf/resolve_btfids/libsubcmd/libsubcmd.a install_headers
linux> exec-cmd.c:2:10: fatal error: linux/compiler.h: No such file or directory
linux>     2 | #include <linux/compiler.h>
linux>       |          ^~~~~~~~~~~~~~~~~~
linux> compilation terminated.
linux> make[6]: *** [/build/linux-6.6.87/tools/build/Makefile.build:98: /build/linux-6.6.87/build/tools/bpf/resolve_btfids/libsubcmd/exec-cmd.o] Error 1
linux> make[5]: *** [Makefile:80: /build/linux-6.6.87/build/tools/bpf/resolve_btfids/libsubcmd/libsubcmd-in.o] Error 2
linux> make[4]: *** [Makefile:58: /build/linux-6.6.87/build/tools/bpf/resolve_btfids//libsubcmd/libsubcmd.a] Error 2
linux> make[3]: *** [Makefile:76: bpf/resolve_btfids] Error 2
linux> make[2]: *** [/build/linux-6.6.87/Makefile:1362: tools/bpf/resolve_btfids] Error 2
linux> make[1]: *** [/build/linux-6.6.87/Makefile:234: __sub-make] Error 2
linux> make[1]: Leaving directory '/build/linux-6.6.87/build'
linux> make: *** [Makefile:234: __sub-make] Error 2
00:12:07

Show newer messages


Back to Room ListRoom Version: 6