From 3603d3012fc9030594d20f04f76c5e1bab5d7a0d Mon Sep 17 00:00:00 2001 From: Nick Spinale Date: Wed, 2 Aug 2023 19:24:27 +0100 Subject: [PATCH] nix: Add notes to C test --- hacking/nix/rust-utils/build-sysroot.nix | 6 ++++++ hacking/nix/scope/world/instances/c.nix | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/hacking/nix/rust-utils/build-sysroot.nix b/hacking/nix/rust-utils/build-sysroot.nix index 6cc4b0898..167cadb73 100644 --- a/hacking/nix/rust-utils/build-sysroot.nix +++ b/hacking/nix/rust-utils/build-sysroot.nix @@ -85,3 +85,9 @@ runCommand "sysroot" { mkdir -p $d mv target/${rustTargetInfo.name}/${if release then "release" else "debug"}/deps/* $d '' + +# TODO +# rel=lib/rustlib/${buildPlatform.config}/bin +# d=$out/$rel +# mkdir -p $d +# ln -s ${rustToolchain}/$rel/* $d diff --git a/hacking/nix/scope/world/instances/c.nix b/hacking/nix/scope/world/instances/c.nix index cdf562a6b..23d8f0da3 100644 --- a/hacking/nix/scope/world/instances/c.nix +++ b/hacking/nix/scope/world/instances/c.nix @@ -28,7 +28,9 @@ mkInstance { nativeBuildInputs = super.nativeBuildInputs ++ [ cmake ]; + # NIX_DEBUG = 2; }); + # extraCargoFlags = [ "--verbose" ]; modifyConfig = old: lib.recursiveUpdate old { target.${defaultRustTargetInfo.name} = { rustflags = (old.target.${defaultRustTargetInfo.name}.rustflags or []) ++ [ @@ -36,10 +38,21 @@ mkInstance { "-C" "link-arg=-L${libcDir}/lib" # TODO + # NOTE: won't work because cross gcc always uses hard-coded --with-ld + # "-C" "linker-flavor=gcc" # "-C" "link-arg=-nostartfiles" # "-C" "default-linker-libraries=on" + # "-Z" "gcc-ld=lld" + # (or) + # "-Z" "unstable-options" + # "-C" "link-self-contained=+linker" + # (or) + # "-Z" "unstable-options" + # "-C" "linker-flavor=gnu-lld-cc" + + # "-Z" "verbose" ]; }; };