[Toybox] [PATCH] Add cross compile info to README

sashank reddy preetamsashankreddy at gmail.com
Sun Oct 4 12:39:20 PDT 2015


Hi Rob,

There is an issue with the cc part. I installed stock ubuntu desktop 14.04
and the arm tool chains with the apt-get install.
However, the tools don't have anything that ends with cc and when that is
combined with the arm-none-gnueabi- cc gives an error.
That's the reason I updated the README. I don't mind adding more sections
on installing the toolchains.

Usually ARCH is used for platform specific config to be pulled out. I like
the idea of compiling the sources for all platforms without worrying
about specific platform codes. However CROSS_COMPILE and CC are not going
to be always intuitive. They need to be explicitly specified.

I would also like to point to you that in my experience as an embedded
developer, I had to hand hold new developers as many dint know the
trivial stuff of exporting variables or searching through the environment.
Nonetheless they were good coders of algorithms. So even though
some things are taken as granted by those already in this field, one must
add sufficient documentation to make sure that anyone reading it
should be able to make full compilation and understand the basic structure
quickly.

Please let me know if you would like me to update the README further with a
few more sections and I would be glad to post a patch. I look
forward to using toybox in the next version of our product. As a starter I
intend to roll out an arm distribution for beaglebone based on toybox
instead of the existing distribution from TI based on busybox. But my
immediate priority is to get the latest kernel to work with the board.

Thank you,
Preetam

On 4 October 2015 at 06:45, Rob Landley <rob at landley.net> wrote:

> I tried to use the email interface to let this message through (you
> aren't subscribed to the list so it goes to moderation) and accidentally
> discarded it instead. (Oops. Sorry.)
>
> So here's the whole message quoted:
>
> On 10/03/2015 02:40 PM, toybox-owner at lists.landley.net wrote:
> > Subject: [PATCH] Add cross compile info to README
> > From: Preetam S Reddy <preetamsashankreddy at gmail.com>
> > Date: 10/03/2015 02:40 PM
> >
> > To: toybox at lists.landley.net
> > CC: Preetam S Reddy <preetamsashankreddy at gmail.com>
> >
> >
> > Add a section for cross compiling on ubuntu. It makes it easy for
> > newbies to quickly get on with the compilation for arm. Also,
> > add some character drawing for section headings.
>
> We cross compile the same way the Linux kernel does, and the "building
> toybox" section has a cross compile example...
>
> > Signed-off-by: Preetam S Reddy <preetamsashankreddy at gmail.com>
> > ---
> >  README | 44 ++++++++++++++++++++++++++++++++++++--------
> >  1 file changed, 36 insertions(+), 8 deletions(-)
> >
> > diff --git a/README b/README
> > index 9ff7368..80450a6 100644
> > --- a/README
> > +++ b/README
> ...
> > @@ -40,7 +43,27 @@ For more about cross compiling, see:
> >    http://landley.net/writing/docs/cross-compiling.html
> >    http://landley.net/aboriginal/architectures.html
> >
> > ---- Using toybox
> > +====================================
> > +# CROSS COMPILING in UBUNTU for ARM
> > +====================================
> > +
> > +You will need the following environment to cross compiling for arm:
> > +     $ export ARCH=arm
> > +     $ export CC=gcc
> > +     $ export CROSS_COMPILE=arm-____-____-
> > +
> > +You can use the compiler of your choice which can be:
> > +
> > +arm-linux-androideabi-
> > +arm-linux-gnueabi-
> > +arm-linux-gnueabihf-
> > +arm-none-eabi-
> > +
> > +Depending on tour installation, use one of the above for CROSS_COMPILE.
> > +
> > +=============
> > +# Using toybox:
> > +=============
>
> That's the new section. It's specific to a single distribution, and you
> didn't actually say how to install the toolchains. (Apparently ubuntu
> comes with some, you can "apt-get install gcc-arm-linux-androideabi" if
> you know to do that.)
>
> 1) Toybox doesn't use $ARCH.
>
> 2) $CC defaults to "cc", as in if you don't set it the "make" command
> will set it to that default value:
>
>   http://www.gnu.org/software/make/manual/make.html#Implicit-Variables
>
> Because back in SUSv2 (I.E. posix-1997) "cc" was the posix name for the
> compiler:
>
>   http://pubs.opengroup.org/onlinepubs/7908799/xcu/cc.html
>
> In SUSv3 (posix-2001) that switched to "c99", which is what's currently
> still there (no "c11", as of yet nobody cares):
>
>   http://pubs.opengroup.org/onlinepubs/009695399/utilities/c99.html
>
> Which means that in _theory_ posix-2008/2013 specifies $(CC) to default
> to "c99" to but it still defaults to the older "cc" anyway:
>
>   http://pubs.opengroup.org/onlinepubs/7908799/xcu/cc.html
>
> But "gcc" is not a name standardized by anybody. If you're using llvm
> (which android does), you're not going to say "gcc". Ubuntu provides a
> "cc" symlink at /usr/bin/cc.
>
> 3) The CROSS_COMPILE variable is demonstrated in the "building toybox"
> section, and has been since the very first version:
>
>
> https://github.com/landley/toybox/commit/09e8bde9f292e537c35387435b5bea9024cf28e8
>
> I'm all for making the README clearer, but could you explain what part's
> confusing you a bit more? (Would it be good to link to
> http://landley.net/writing/docs/cross-compiling.html maybe?
>
> Hmmm... I suppose it's confusing that:
>
>   make CROSS_COMPILE=blah-
>
> Doesn't work. Because I'm not exporting the make variables. Which is
> easy enough to do _except_  that $(CC) has a default value "cc", meaning
> if I export it from the makefile the one in configure never gets used.
> (That's why I hadn't done it before, but it's probably ok...?)
>
> Thanks,
>
> Rob
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20151004/86544a40/attachment-0003.htm>


More information about the Toybox mailing list