!ayCRiZriCVtuCUpeLp:nixos.org

Nix Cross Compiling

339 Members
85 Servers

Load older messages


SenderMessageTime
21 Mar 2024
@mjolnir:nixos.orgNixOS Moderation Botchanged room power levels.18:03:11
@grahamc:nixos.org@grahamc:nixos.org left the room.20:07:49
@cleverca22:matrix.orgcleverca22
In reply to @trofi:matrix.org
If you publish your intermediate state I can try to build locally and check why it fails in more detail.
https://github.com/cleverca22/nixpkgs/tree/vc4-fixup
time nix-build -A gcc-vc4-unwrapped
21:39:17
@trofi:matrix.orgtrofi

Aha, a few notes:

  • add enableParallelBuilding = true; to make builds a bit faster
  • by default nixpkgs passes --disable-static, that is what breaks libstdc++. AFAIU it does not even try to link static binaries and fails at shared
  • you seem to build an early version of gcc without libc headers present. I would suggest throwing --without-headers as well (unless the gcc fork already bundles some version of libc).

The following was enough for me to get a C compiler that can produce assembly:

--- a/pkgs/development/compilers/gcc/vc4.nix
+++ b/pkgs/development/compilers/gcc/vc4.nix
@@ -21,4 +21,6 @@ stdenv.mkDerivation {
     "--disable-bootstrap"
     "--disable-shared"
+    "--without-headers"
+    "--enable-languages=c"
   ];
   buildInputs = [ gmp mpfr libmpc flex ];
@@ -26,4 +28,5 @@ stdenv.mkDerivation {
   dontUpdateAutotoolsGnuConfigScripts = true;
   hardeningDisable = [ "all" ];
+  enableParallelBuilding = true;
   preConfigure = ''
     # Perform the build in a different directory.

Example code: https://bpa.st/raw/L7PQ

22:10:38
@cleverca22:matrix.orgcleverca22 i try to wait on adding enableParallelBuilding until the build succeeds without it, since it can sometimes break things 22:22:47
@cleverca22:matrix.orgcleverca22 trofi: https://github.com/librerpi/lk-overlay/blob/master/default.nix#L5-L8
this commit of nixpkgs, was able to do both c and c++ with pkgsCross.vc4
22:24:26
@cleverca22:matrix.orgcleverca22so fixing c++ would still be on the todo list22:24:48
@cleverca22:matrix.orgcleverca22testing your above patch out now...22:26:18
@cleverca22:matrix.orgcleverca22
        # By default, disable static builds.
        if [ -z "${dontDisableStatic:-}" ]; then
            if grep -q enable-static "$configureScript"; then
                prependToVar configureFlags --disable-static
            fi
        fi
22:27:13
@cleverca22:matrix.orgcleverca22 ah yep, and i see that in setup.sh 22:27:17
@cleverca22:matrix.orgcleverca22which was set by the default gcc22:27:35
@cleverca22:matrix.orgcleverca22it does build with your above patch, trying some other things...22:32:34
@cleverca22:matrix.orgcleverca22 --with-headers=/nix/store/3x2ill45fc0x7dkbpkk9jcv0vwjz3gpw-newlib-vc4-elf/vc4-elf/include 22:37:58
@cleverca22:matrix.orgcleverca22 and your hint also led here, this was in the nix log for the final gcc, in the nixpkgs that worked 22:38:16
@cleverca22:matrix.orgcleverca22so, i need to use this first gcc to build newlib, then rebuild gcc with the above flag22:38:45
@cleverca22:matrix.orgcleverca22that should fix c++22:38:49
@trofi:matrix.orgtrofiyeaр22:51:47
@trofi:matrix.orgtrofi * yeah22:52:03
@cleverca22:matrix.orgcleverca22that also explains why it was doing a 2 stage build before22:52:41
22 Mar 2024
@mrene:matrix.orgmrene joined the room.00:44:18
@hmenke:matrix.orghmenke joined the room.08:02:31
@hmenke:matrix.orghmenke

I'm trying to build a static executable of difftastic, but it fails at the linking step. What gives? Any hints on how to fix errors like these?

$ env NIX_PATH=nixpkgs=channel:nixos-23.11 nix-build -A pkgsStatic.difftastic '<nixpkgs>'
[...]
  = note: /nix/store/g25zr527vm2wvap53b3fhaijnpdy9w21-x86_64-unknown-linux-musl-binutils-2.40/bin/x86_64-unknown-linux-musl-ld: /nix/store/bknb7nr3g96fd29sdr2rkwh9bl66vzbz-x86_64-unknown-linux-musl-gcc-12.3.0-lib/x86_64-unknown-linux-musl/lib/libstdc++.a(eh_personality.o): relocation R_X86_64_32S against `.rodata._ZL28read_encoded_value_with_basehmPKhPm' can not be used when making a PIE object; recompile with -fPIE
          /nix/store/g25zr527vm2wvap53b3fhaijnpdy9w21-x86_64-unknown-linux-musl-binutils-2.40/bin/x86_64-unknown-linux-musl-ld: failed to set dynamic section sizes: bad value
          collect2: error: ld returned 1 exit status
[...]
08:02:55
@hakmark:matrix.orghakmark joined the room.11:03:33
@abathur:matrix.orgabathur joined the room.18:43:03
23 Mar 2024
@ss:someonex.netSomeoneSerge (migrating synapse) changed their display name from SomeoneSerge (hash-versioned python modules when) to SomeoneSerge (migrating synapse).02:11:09
24 Mar 2024
@belak:matrix.orgbelak joined the room.18:24:53
25 Mar 2024
@tpw_rules:matrix.orgtpw_rulesthis is currently breaking cross-compiling a system: https://github.com/NixOS/nixpkgs/pull/29800100:17:51
@ships:matrix.orgships joined the room.03:36:28
26 Mar 2024
@noiobeforebedtime:winesj.comJack​ changed their profile picture.19:05:52
27 Mar 2024
@me:linj.techlinj joined the room.08:47:52

There are no newer messages yet.


Back to Room ListRoom Version: 6