[Toybox] [TOYBOX][RFC] building toybox on a Yocto enviroment

José Bollo jobol at nonadev.net
Wed Feb 3 01:30:52 PST 2016


I had the issue a long time ago and it seemed that it came from cross
compiling environment.

It was not properly set.

I submitted the patch below to Rob (original version was 0.6.0 not
checked since).
In the hope that it helps
Best Regards
José Bollo















+From 4244b26dbc05a0fe81c51ac199d8f2726cdd28ff Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jos=C3=A9=20Bollo?= <jose.bollo at iot.bzh>
+Date: Fri, 9 Oct 2015 10:55:40 +0200
+Subject: [PATCH 4/4] cross compiling improvement
+
+Change-Id: I9b431119889284616c401fd397ccdd03229df991
+---
+ Makefile        | 2 +-
+ lib/lsm.h       | 4 ++--
+ scripts/make.sh | 4 ++--
+ 3 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 1ea6929..3a9622e 100644
+--- a/Makefile
++++ b/Makefile
+@@ -31,7 +31,7 @@ bloatcheck: toybox_old toybox_unstripped
+ 
+ generated/instlist: toybox_stuff
+ 	NOBUILD=1 scripts/make.sh
+-	$(HOSTCC) -I . scripts/install.c -o generated/instlist
++	$(HOSTCC) -DONHOST -I . scripts/install.c -o generated/instlist
+ 
+ install_flat: generated/instlist
+ 	scripts/install.sh --symlink --force
+diff --git a/lib/lsm.h b/lib/lsm.h
+index d7e7de9..0996843 100644
+--- a/lib/lsm.h
++++ b/lib/lsm.h
+@@ -3,7 +3,7 @@
+  * Copyright 2015 Rob Landley <rob at landley.net>
+  */
+ 
+-#if CFG_TOYBOX_SELINUX
++#if CFG_TOYBOX_SELINUX && !defined(ONHOST)
+ #include <selinux/selinux.h>
+ #else
+ #define is_selinux_enabled() 0
+@@ -17,7 +17,7 @@
+ #define fsetfilecon(...) (-1)
+ #endif
+ 
+-#if CFG_TOYBOX_SMACK
++#if CFG_TOYBOX_SMACK && !defined(ONHOST)
+ #include <sys/smack.h>
+ #include <sys/xattr.h>
+ #include <linux/xattr.h>
+diff --git a/scripts/make.sh b/scripts/make.sh
+index 7ebe148..29a3d6b 100755
+--- a/scripts/make.sh
++++ b/scripts/make.sh
+@@ -136,7 +136,7 @@ sed -n \
+ 
+ if [ generated/mkflags -ot scripts/mkflags.c ]
+ then
+-  do_loudly $HOSTCC scripts/mkflags.c -o generated/mkflags || exit 1
++  do_loudly $HOSTCC -DONHOST scripts/mkflags.c -o generated/mkflags ||
exit 1
+ fi
+ 
+ echo -n "generated/flags.h "
+@@ -212,7 +212,7 @@ fi
+ echo "generated/help.h"
+ if [ generated/config2help -ot scripts/config2help.c ]
+ then
+-  do_loudly $HOSTCC scripts/config2help.c -I . lib/xwrap.c lib/llist.c
\
++  do_loudly $HOSTCC -DONHOST scripts/config2help.c -I . lib/xwrap.c
lib/llist.c \
+     lib/lib.c lib/portability.c -o generated/config2help || exit 1
+ fi
+ generated/config2help Config.in $KCONFIG_CONFIG > generated/help.h ||
exit 1
+-- 
+2.1.4
+




















Le mercredi 03 février 2016 à 01:51 +0000, Joya Cruz, Alejandro a
écrit :
> I have been trying to build toybox with different LSM enviroments
> unsing yocto as building tool.
> the more persistant error that I got is bellow:
> 
> |DEBUG: Executing shell function do_compile
> |NOTE: make -j 8 -e MAKEFLAGS= toybox_unstripped
> |scripts/make.sh
> |Generate headers from toys/*/*.c...
> |Make generated/config.h from .config.
> |generated/flags.h generated/help.h
> |Compile toybox.....
> |NOTE: make -j 8 -e MAKEFLAGS= generated/instlist
> |NOBUILD=1 scripts/make.sh
> |Generate headers from toys/*/*.c...
> |Make generated/config.h from .config.
> |generated/flags.h generated/help.h
> |cc -I . scripts/install.c -o generated/instlist
> |In file included from ./toys.h:71:0,
> |                 from scripts/install.c:6:
> |./lib/lsm.h:23:23: fatal error: sys/smack.h: No such file or directory
> | #include <sys/smack.h>
> |                       ^
> |compilation terminated.
> |make: *** [generated/instlist] Error 1
> |WARNING: exit code 1 from a shell command.
> 
> until now the solution that i have found is this.
> any suggestion if this should be part of toybox or how could i
> workaround this issue?
> 
> I'm using the CFLAGS to provide the temporal environment with the
> libraries.
> 
> > Date: Tue, 2 Feb 2016 17:47:50 -0800
> > Subject: [PATCH] toybox_build: add Missing CFLAGS
> > 
> > add CFLAGS to multiple builds to forward libraries location in Yocto.
> > 
> > Signed-off-by: Alejandro Joya <alejandro.joya.cruz at intel.com>
> > ---
> >  Makefile | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/Makefile b/Makefile
> > index 5422efe..2dca3ae 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -37,7 +37,7 @@ bloatcheck: toybox_old toybox_unstripped
> > 
> >  generated/instlist: toybox_stuff
> >         NOBUILD=1 scripts/make.sh
> > -       $(HOSTCC) -I . scripts/install.c -o generated/instlist
> > +       $(HOSTCC) -I . $(CFLAGS) scripts/install.c -o
> > generated/instlist
> > 
> >  install_flat: generated/instlist
> >         scripts/install.sh --symlink --force
> > -- 
> > 1.9.1
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net



 1454491852.0


More information about the Toybox mailing list