On 05/02/2013 03:57 PM, Bernd Petrovitsch wrote:
> Hi!
>
> On Don, 2013-05-02 at 14:47 +0200, Lambrecht Jürgen wrote:
> [...]
>> I am struggling to get the busybox dhcp server cross-compiled (ARM) for
>> the embedded RTOS eCos.
>> I took the latest code from git.
>> I have this error:
>> dhcpd.c:328:10: error: ‘optind’ undeclared (first use in this function)
>>
>> I found out that 'optind' is declared in /usr/include/getopt.h.
>> This is given by the toolchain.
> Hmm, /usr/include/getopt.h is from the C library of the host system/the
> local installation.
> The cross-toolchain/build-system should have it's own set of header
> files, libraries, etc. and must not use the one from the host system.
yes of course; I was not clear about that.
>
>> 'int optind' is defined in your toolchain libraries.
> And where are the header files for these?
> There is no guarantee that the types, there sizes and padding is the
> same for the host and the target system.
> OK, "optind" maybe defined everywhere identically but in the general
> case?
>
>> This is OK for a linux (cross-)compilation, but not for an eCos one.
> Even there it should be totally separated.
Indeed, again I was not clear. Declaration in header files and
definition in c file or library come together of course.
>
>> Is it correct that busybox only works (and compiles) for a system with a
>> shell?
> What has the getopt() library function - which is the only one which
> uses "optind" - to do with a shell?
Busybox code is full of lines like this:
argv += optind;
What I mean with a shell is that that 'argv' are (or contains or points
to ..) the arguments of a program one can call in a shell (like ash, sh,
bash).
So because of the shell, one has to pass arguments to a program via
argc/argv, and there that optind is used.
When I think of it, my question is probably stupid, because BusyBox
"provides replacements for most of the utilities you usually find in GNU
fileutils, shellutils, etc."
The utilities are meant to be called from a shell, not from another c
program (as a function).
Anyhow, I still think it was a good idea to use the busybox code to have
a dhcp server in ecos.
Kind regards,
Jürgen
>
> Bernd
--
Jürgen Lambrecht
R&D Associate
Mobile: +32 499 644 531
Tel: +32 (0)51 303045 Fax: +32 (0)51 310670
http://www.televic-rail.com
Televic Rail NV - Leo Bekaertlaan 1 - 8870 Izegem - Belgium
Company number 0825.539.581 - RPR Kortrijk
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox