Discussion:
[Toybox] compiling toybox
stephen Turner
2014-06-09 20:42:03 UTC
Permalink
I was compiling toybox using musl and received some errors that i believe
are related to the code of toybox? I'm not sure if this is something you
want to address right now but just in case it is here is the output i
receive. please let me know if there is anything you need/want outside of
this error output.

scripts/make.sh
Make generated/config.h from .config.
Extract configuration information from toys/*.c files...
Generate headers from toys/*/*.c...
generated/newtoys.h generated/flags.h generated/globals.h generated/help.h
Library probe...
Compile toybox...
In file included from lib/help.c:8:0:
./generated/help.h:415:22: warning: missing terminating " character
#define help_killall "usage: killall [-l] [-iqv] [-SIGNAL|-s SIGNAL]
PROCESS_NAME...\n\nSend a signal (default: TERM) to all processes with the
given n
^
In file included from ./toys.h:8:0,
from lib/help.c:3:
lib/help.c:12:32: error: expected ',' or ';' before 'help_dmesg'
#define NEWTOY(name,opt,flags) help_##name "\0"
^
./generated/config.h:6:24: note: in definition of macro 'USE_DMESG'
#define USE_DMESG(...) __VA_ARGS__
^
./generated/newtoys.h:36:11: note: in expansion of macro 'NEWTOY'
USE_DMESG(NEWTOY(dmesg, "s#n#c", TOYFLAG_BIN))
^
In file included from lib/help.c:15:0:
./generated/newtoys.h:76:1: error: missing terminating " character
USE_KILLALL(NEWTOY(killall, "?s:lqvi", TOYFLAG_USR|TOYFLAG_BIN))
^
toys/other/acpi.c: In function 'acpi_callback':
toys/other/acpi.c:59:28: error: 'FLAG_b' undeclared (first use in this
function)
if ((toys.optflags & FLAG_b) || (!toys.optflags)) {
^
toys/other/acpi.c:59:28: note: each undeclared identifier is reported only
once for each function it appears in
toys/other/acpi.c:69:52: error: 'TT' undeclared (first use in this function)
if (cap >= 0) printf("Battery %d: %d%%\n", TT.bat++, cap);
^
toys/other/acpi.c:71:32: error: 'FLAG_a' undeclared (first use in this
function)
} else if (toys.optflags & FLAG_a) {
^
Makefile:8: recipe for target 'toybox' failed
make: *** [toybox] Error 1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20140609/ee43fc52/attachment.htm>
Isaac Dunham
2014-06-10 00:15:20 UTC
Permalink
Post by stephen Turner
I was compiling toybox using musl and received some errors that i believe
are related to the code of toybox? I'm not sure if this is something you
want to address right now but just in case it is here is the output i
receive. please let me know if there is anything you need/want outside of
this error output.
versions of $CC and bash/sh at a minimum; which sed.
I presume you're using hg tip?

I'm using the git mirror with gcc 3.4/4.2 and rather old musl
(1.0.0-git-10-g2b74315), and current master gives me no such problem.

But before you go trying to debug it, make sure you have an unmodified
current scripts/ directory, and check toys/lsb/killall.c.
Post by stephen Turner
scripts/make.sh
Make generated/config.h from .config.
Extract configuration information from toys/*.c files...
Generate headers from toys/*/*.c...
generated/newtoys.h generated/flags.h generated/globals.h generated/help.h
Library probe...
Compile toybox...
./generated/help.h:415:22: warning: missing terminating " character
#define help_killall "usage: killall [-l] [-iqv] [-SIGNAL|-s SIGNAL]
PROCESS_NAME...\n\nSend a signal (default: TERM) to all processes with the
given n
^
HTH, Isaac
stephen Turner
2014-06-10 00:35:35 UTC
Permalink
Im using a current arch linux which I will get you the versions for
tomorrow when I have access to the system again. I had problems compiling
it with glibc so I decided to try a musl cross compile. Grabbed the current
stable 1.1.4? I will double check that, and compiled and installed. After
which I use the musl-gcc wrapper. Are you using the wrapper or the -I
commands to redirect to the musl libraries?

Thanks,
Stephen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20140609/d569ae1c/attachment.htm>
Rob Landley
2014-06-10 02:49:18 UTC
Permalink
Post by stephen Turner
Im using a current arch linux which I will get you the versions for
tomorrow when I have access to the system again. I had problems
compiling it with glibc so I decided to try a musl cross compile.
Grabbed the current stable 1.1.4? I will double check that, and compiled
and installed. After which I use the musl-gcc wrapper. Are you using
the wrapper or the -I commands to redirect to the musl libraries?
What command line are you using to build?

I've built against musl here, but I have to do so with CFLAGS=--static
since musl isn't installed on the host, thus none of the binaries it
builds will run otherwise.

So I basically do:

make clean
CROSS_COMPILE=musl- PATH=/your/musl/toolchain/bin:$PATH \
CFLAGS=--static make defconfig all

Rob
Isaac Dunham
2014-06-10 05:27:12 UTC
Permalink
Post by stephen Turner
Im using a current arch linux which I will get you the versions for
tomorrow when I have access to the system again. I had problems compiling
OK, GCC 4.8.?/4.9, latest bash, latest GNU sed, etc...

The problem would seem to be that somehow, some of the help messages got
truncated.
And I'm not sure what's causing this, though a malfunction in
config2help.c seems likely; since it doesn't happen here, it's not
specifically the result of how toybox is written.
So _please_ check whether scripts/ matches upstream.
Post by stephen Turner
it with glibc so I decided to try a musl cross compile. Grabbed the current
stable 1.1.4? I will double check that, and compiled and installed. After
which I use the musl-gcc wrapper. Are you using the wrapper or the -I
commands to redirect to the musl libraries?
Currently, I'm using a native musl system.
I used to build with
make CC=/path/to/musl-gcc CFLAGS="-Os -static"
or sometimes:
make HOSTCC=/path/to/musl-gcc CC=/path/to/musl-gcc CFLAGS="-Os -static"
(which needs ncurses if you want menuconfig).

HTH,
Isaac Dunham

Rob Landley
2014-06-10 02:43:26 UTC
Permalink
Post by stephen Turner
I was compiling toybox using musl and received some errors that i
believe are related to the code of toybox? I'm not sure if this is
something you want to address right now but just in case it is here is
the output i receive. please let me know if there is anything you
need/want outside of this error output.
Huh. Well it's new to me...
Post by stephen Turner
scripts/make.sh
Make generated/config.h from .config.
Extract configuration information from toys/*.c files...
Generate headers from toys/*/*.c...
generated/newtoys.h generated/flags.h generated/globals.h generated/help.h
Library probe...
Compile toybox...
./generated/help.h:415:22: warning: missing terminating " character
#define help_killall "usage: killall [-l] [-iqv] [-SIGNAL|-s SIGNAL]
PROCESS_NAME...\n\nSend a signal (default: TERM) to all processes with
the given n
Are you compiling a release version, or current source control snapshot?

I had recent problems with arch linux's build environment being outright
insane. (For example, it exposes a different set of libraries for static
and for dynamic linking.) But I can try to help track this down.

Could you post the output of:

V=1 make

(In current code, help.h is generated by scripts/config2help.c, I want
to see how it's being called...)

Could you also attach generated/help.h and generated/flags.h from your
build?

Thanks,

Rob
Loading...