Last active
November 22, 2018 14:29
-
-
Save guibou/75fb1a138220b779fdadc8db0d0ad019 to your computer and use it in GitHub Desktop.
`foo` builds with `gcc-arm-embedded` but `bar` does not, with `pkgsCross.arm-embedded`.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
nixos1809 = import (fetchTarball channel:nixos-18.09) {}; | |
file = nixos1809.writeTextFile { | |
name = "file.c"; | |
text = '' | |
#include <math.h> | |
int _exit(int i){}; | |
int main() | |
{ | |
float v = log(0.f); | |
return 0; | |
} | |
''; | |
}; | |
cmd = ''arm-none-eabi-gcc -mfloat-abi=hard ${file} -o file -lm -o $out''; | |
overlay = self : super : { | |
/* | |
# I Tried to override newlibCross with hardware floating point, but without success | |
newlibCross = super.newlibCross.overrideAttrs (old : { | |
configureFlags = old.configureFlags ++ ["--enable-newlib-hw-fp"]; | |
}); | |
*/ | |
}; | |
in | |
{ | |
# That one will work | |
foo = with nixos1809; | |
runCommand "foo" { | |
allowSubstitutes = false; | |
buildInputs = [gcc-arm-embedded]; | |
} | |
cmd; | |
# That one fails with | |
# error: /build/ccgJg8Xr.o uses VFP register arguments... | |
bar = with import (fetchTarball channel:nixpkgs-unstable) {overlays = [overlay];}; | |
runCommand "bar" { | |
buildInputs = [pkgsCross.arm-embedded.buildPackages.gcc]; | |
} | |
cmd; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment