Hi,

the existence of the file configs/cygwin_defconfig suggests that there was some upstream support for busybox builds on Cygwin in the ancient past.

This does no longer work OOTB since this commit to Cygwin's "newlib" from 2014:
https://cygwin.com/git/?p=newlib-cygwin.git;a=commit;h=32c96dd

which added these functions to stdlib.h:

  char * itoa(int value, char * str, int base);
  char * utoa(unsigned value, char * str, int base);

These are non-standard and unavailable on Linux and *BSD, but also provided by some other C runtimes (IBM C, MSVC, QNX, ...). MSVC documentation says that these are part of POSIX which is not the case.

There is obviously a conflict with the libbb functions:

  char *utoa(unsigned n);
  char *itoa(int n);

In my current Cygwin port of busybox-1.36.1 which will appear in Cygwin distro soon I use this ugly but effective hack in libbb.h:

+#ifdef __CYGWIN__
+/* Avoid conflict with these non-standard functions from <stdlib.h>:
+ * char * itoa(int value, char * str, int base);
+ * char * utoa(unsigned value, char * str, int base);
+ */
+# include <stdlib.h>
+# define itoa bb_itoa
+# define utoa bb_utoa
+#endif

Would you accept to rename itoa/utoa to bb_itoa/bb_utoa instead?

If there is any interest in the patches for Cygwin, I could eventually rebase these to master and provide a patch series.

The current diffstat:

$ git diff --stat 1_36_1
 configs/cygwin_defconfig        | 897 +++++++++++++++++++-----------
 coreutils/date.c                |   8 +-
 coreutils/du.c                  |   4 +
 coreutils/ls.c                  |   3 +
 coreutils/stat.c                |   2 +-
 include/libbb.h                 |  24 +-
 include/platform.h              |  17 +-
 libbb/udp_io.c                  |   5 +
 networking/hostname.c           |   6 +
 networking/ip_icmp_missing.h    | 162 ++++++
 networking/ping.c               |   9 +-
 networking/traceroute.c         |  26 +-
 procps/top.c                    |   2 +-
 shell/ash.c                     |  17 +
 util-linux/fdisk.c              |  16 +-

Working applets:

$ ./busybox --list | wc -l
245


--
Regards,
Christian

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to