[Nix-dev] cross toolchain howto request

Lluís Batlle i Rossell viric at viric.name
Sat Mar 9 11:56:05 CET 2013


On Tue, Mar 05, 2013 at 03:03:53PM +0400, Sergey Mironov wrote:
> 2013/3/5 Sergey Mironov <ierton at gmail.com>:
> > $ nix-env -i -A i386_toolchain.gcc
> > installing `gcc-wrapper-4.6.3-static-i386-unknown-elf'
> > ... <installing the cross-compiler>
> >
> > $ nix-env -i -A i386_toolchain.binutils
> > installing `binutils-2.21.1a-i386-unknown-elf'
> > ... installing binutils
> >
> > Now everything is all-right. User can use i386-unknown-elf-gcc and
> > other tools. But what if I want to install armv5tel_toolchain?
> >
> > $ nix-env -i -A armv5tel_toolchain.gcc
> > replacing old `gcc-wrapper-4.6.3-static-i386-unknown-elf'
> > installing `gcc-wrapper-4.6.3-static-armv5tel-unknown-elf'
> >
> > That is bad: I don't want to replace i386, I want to keep it but
> > install armv5tel as well. Looks like Nixos treats both toolchains as
> > one package, but why is that? I know that gccCrossStageStatic actually
> > calls gcc-cross-wrapper, but it changes the name argument.. Any ideas?
> 
> Heh, I have an idea :) Probably, Nix-env treats all cross compilers as
> versions of single gcc package. So it can't see any difference between
> gcc upgrade and installing another cross-toolchain. So it basically
> 'helps' me to upgrade my compiler instead of installing arm version
> together with i386. Nix-env has -P flag which can be used to
> workaround problem I've reported. Still, IMO it is bad and nix should
> treat every cross-gcc as independent package.

I think that nix-env considers strings like "name-versionnumbers-extra", and the
'extra' part (after version numbers) is ignored. We'd need to put the extra
strings of "static-armv5tel-..." *before* the gcc version number. An easy way is
to put them even BEFORE the "gcc-wrapper" string:
newname = "static-armv5tel-unknown-elf-{oldname}"

What do you think?

I personally never had toolchains in my environment. I always use the
'pkgs.myEnv' approach, because I also gather some cross-built packages together
into my dev environment.


More information about the nix-dev mailing list