Hi,

I am the author of musl (www.etalabs.net/musl) and also follow busybox
development on and off. Recently one of my project's testers has been
experimenting with building a musl+busybox based mini-distro. I've
been working with him to resolve the build issues caused by things on
my end, but there are a few longstanding portability issues in busybox
that would be easy to fix and would make things a lot easier for us if
they could be fixed.

Chris's project, Sabotage Linux, contains a patch against busybox
1.18.4 that illustrates the issues he's encountered:

https://github.com/chneukirchen/sabotage/blob/master/KEEP/busybox.patch

Many of the chunks are not correct to apply to busybox. For example,
__musl__ is not defined by musl; it's a hack Chris added to his build
scripts to work around portability problems by special-casing. Some
issues, however, can be fixed right away without controversial
changes, I think, and I hope you'll consider them:

1. The fdprintf/dprintf chunk in platform.h. The standard POSIX 2008
name for this function is dprintf, and as far as I know, dprintf will
be available on most if not all platforms busybox supports. If there
are a few where it's not supported, could you instead #define fdprintf
dprintf by default, and only #undef it for those specific oddball
platforms?

2. The mkconfigs chunk. This problem has been floating around on the
bug tracker and mailing list for a while. "\?" is not valid in POSIX
BRE, and musl's regex implementation does not support it as an
extension. This issue prevents building busybox when grep is linked
against musl's regex.

3. The fdisk chunk. This code is conditional on large disk support, so
lseek is already the 64-bit version of the function. There's no need
to call lseek64 (which musl does not provide). Also the off64_t should
be corrected to off_t.

4. Several #include chunks. Some of these look like hacks, but others
look like cases where busybox is relying on header pollution (where
one header wrongly includes another) to get certain definitions,
rather than including the headers that are needed.

Finally, one thing that's not in the patch, but should be: Busybox's
"make config" and "make menuconfig" require a some POSIX interfaces to
be provided by the standard C headers, so on musl, HOSTCFLAGS
containing -D_POSIX_C_SOURCE=... or -D_XOPEN_SOURCE=... or
-D_GNU_SOURCE is needed to avoid compile-time errors that prevent
configuration. Adding -D_POSIX_C_SOURCE=200112L (or whatever version
you like) to the default host cflags would be more correct and would
avoid this issue.

Please let me know if there's any more information I can provide or if
you have alternate proposals for addressing any of these issues.


Rich
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to