Skip to content

Instantly share code, notes, and snippets.

@expipiplus1

expipiplus1/- Secret

Created July 5, 2017 18:51
Show Gist options
  • Save expipiplus1/cf5fb6f1e6beb55d570e892516585636 to your computer and use it in GitHub Desktop.
Save expipiplus1/cf5fb6f1e6beb55d570e892516585636 to your computer and use it in GitHub Desktop.
these derivations will be built:
/nix/store/78rr58d98r169klc8s0z5jqznv6d5w4x-hello.drv
building path(s) ‘/nix/store/xni68x865kn6i2pqx3zdlcq0q7f8g2dr-hello’
unpacking sources
unpacking source archive /nix/store/9ljssglw74jabzzsqsl3lim4d5jgh4ya-empty
source root is empty
/nix/store/iwa35vp5b9rg5jlpxplivl2dhy5spxza-set-source-date-epoch-to-latest.sh: line 12: [: : integer expression expected
patching sources
configuring
no configure script, doing nothing
building
[1 of 1] Compiling Main ( Main.hs, Main.o )
Linking Main ...
/nix/store/f1jlykqf0fga6z21innh4x11cdi1hr6h-arm-unknown-linux-gnueabihf-binutils-2.28/bin/arm-unknown-linux-gnueabihf-ld.gold: fatal error: /nix/store/5k51ci1wj0sfshi6xz8myz2mi6w6c9gg-arm-unknown-linux-gnueabihf-ghc-8.1.20170106/lib/arm-unknown-linux-gnueabihf-ghc-8.1.20170106/ghc-prim-0.5.0.0/libHSghc-prim-0.5.0.0.a(CString.o): unsupported ELF machine number 0
collect2: error: ld returned 1 exit status
`arm-unknown-linux-gnueabihf-cc' failed in phase `Linker'. (Exit code: 1)
builder for ‘/nix/store/78rr58d98r169klc8s0z5jqznv6d5w4x-hello.drv’ failed with exit code 1
error: build of ‘/nix/store/78rr58d98r169klc8s0z5jqznv6d5w4x-hello.drv’ failed
let
crossSystem = pkgs.lib.systems.examples.armv7l-hf-multiplatform;
# crossSystem = {
# config = "arm-linux-gnueabihf";
# platform = platform;
# libc = "glibc";
# arch = "arm";
# float = "hard";
# fpu = "vfp";
# withTLS = true;
# gcc = platform.gcc;
# openssl.system = "linux-generic32";
# };
crossPkgs = import /home/jophish/src/nixpkgs { inherit crossSystem; };
pkgs = import /home/jophish/src/nixpkgs {};
ghc = crossPkgs.buildPackages.haskell.compiler.ghcHEAD;
hello = { stdenv }:
stdenv.mkDerivation {
name = "hello";
src = ./empty;
buildPhase = ''
cat <<EOF > hello.c
#include <stdio.h>
int main(int argc, char const* argv[]){
puts("hello, world!");
return 0;
}
EOF
$CC -s hello.c -o hello -v
'';
installPhase = ''
mkdir -p $out
cp hello $out/
'';
};
helloHaskell = { stdenvNoCC, ghcCross }:
stdenvNoCC.mkDerivation {
name = "hello";
src = ./empty;
buildPhase = ''
cat <<EOF > Main.hs
module Main where
main = putStrLn "Hello, ARM!"
EOF
${ghcCross}/bin/arm-unknown-linux-gnueabihf-ghc Main.hs \
# -optl-s \
# -optl-static-libgcc
'';
installPhase = ''
mkdir -p $out
mv Main $out/
'';
};
in {
hh = crossPkgs.callPackage helloHaskell { ghcCross = ghc; };
# nc = crossPkgs.netcat;
# g = crossPkgs.buildPackages.gcc.cc;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment