When cross-compiling busybox for Linux from OpenBSD, I get following errors:
$ CROSS_COMPILE=i586-openadk-linux- HOSTCC=gcc gmake V=1 rm -f .kernelrelease echo 1.18.0.git > .kernelrelease /home/wbx/busybox/scripts/gen_build_files.sh /home/wbx/busybox /home/wbx/busybox GEN include/usage.h gmake -f scripts/Makefile.build obj=scripts/basic mkdir -p .tmp_versions rm -f .tmp_versions/* gmake -f scripts/Makefile.build obj=applets gcc -Wp,-MD,applets/.usage.d -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -Iinclude -Iinclude -o applets/usage applets/usage.c applets/usage_compressed include/usage_compressed.h applets gcc -Wp,-MD,applets/.applet_tables.d -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -o applets/applet_tables applets/applet_tables.c In file included from include/libbb.h:13, from include/busybox.h:10, from applets/applet_tables.c:16: include/platform.h:165:23: byteswap.h: No such file or directory include/platform.h:166:21: endian.h: No such file or directory include/platform.h:179:3: #error "Can't determine endianness" In file included from include/busybox.h:10, from applets/applet_tables.c:16: include/libbb.h:44:20: mntent.h: No such file or directory include/libbb.h:47:24: sys/statfs.h: No such file or directory In file included from include/busybox.h:10, from applets/applet_tables.c:16: include/libbb.h:489: error: field `sin' has incomplete type include/libbb.h:491: error: field `sin6' has incomplete type include/libbb.h:500: error: field `sin' has incomplete type include/libbb.h:502: error: field `sin6' has incomplete type In file included from include/busybox.h:10, from applets/applet_tables.c:16: include/libbb.h:1087: warning: `struct mntent' declared inside parameter list gmake[1]: *** [applets/applet_tables] Error 1 gmake: *** [applets_dir] Error 2 $ The following patch solves these compile problems on the host. Signed-off-by: Waldemar Brodkorb <w...@openadk.org> --- Hi Denys, thanks for your feedback. Here is a resubmission with only fixes cross-compilation on OpenBSD. Above is the error message I got without this patch. Some BSD specific stuff could be combined when including <sys/param.h> and by using BSD as symbol to check. thanks in advance for any comments Waldemar --- include/platform.h | 18 ++++++++++++++++-- scripts/gen_build_files.sh | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/include/platform.h b/include/platform.h index 0dadf42..a55b984 100644 --- a/include/platform.h +++ b/include/platform.h @@ -161,7 +161,7 @@ # define bswap_32 __bswap32 # define bswap_16 __bswap16 # define __BIG_ENDIAN__ (_BYTE_ORDER == _BIG_ENDIAN) -#elif !defined __APPLE__ +#elif !defined __APPLE__ && !defined __OpenBSD__ # include <byteswap.h> # include <endian.h> #endif @@ -172,9 +172,15 @@ #elif defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN # define BB_BIG_ENDIAN 1 # define BB_LITTLE_ENDIAN 0 +#elif defined(_BYTE_ORDER) && _BYTE_ORDER == _BIG_ENDIAN +# define BB_BIG_ENDIAN 1 +# define BB_LITTLE_ENDIAN 0 #elif (defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN) || defined(__386__) # define BB_BIG_ENDIAN 0 # define BB_LITTLE_ENDIAN 1 +#elif defined(_BYTE_ORDER) && _BYTE_ORDER == _LITTLE_ENDIAN +# define BB_BIG_ENDIAN 0 +# define BB_LITTLE_ENDIAN 1 #else # error "Can't determine endianness" #endif @@ -230,7 +236,7 @@ typedef uint32_t bb__aliased_uint32_t FIX_ALIASING; /* ---- Compiler dependent settings ------------------------- */ #if (defined __digital__ && defined __unix__) \ - || defined __APPLE__ || defined __FreeBSD__ + || defined __APPLE__ || defined __FreeBSD__ || defined __OpenBSD__ # undef HAVE_MNTENT_H # undef HAVE_SYS_STATFS_H #else @@ -238,6 +244,14 @@ typedef uint32_t bb__aliased_uint32_t FIX_ALIASING; # define HAVE_SYS_STATFS_H 1 #endif +/* ---- Networking ------------------------------------------ */ + +#if defined __OpenBSD__ +#include <netinet/in.h> +#include <arpa/inet.h> +#endif + + /*----- Kernel versioning ------------------------------------*/ #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) diff --git a/scripts/gen_build_files.sh b/scripts/gen_build_files.sh index 18c172d..09a95b5 100755 --- a/scripts/gen_build_files.sh +++ b/scripts/gen_build_files.sh @@ -48,7 +48,7 @@ if test x"$new" != x"$old"; then fi # (Re)generate */Kbuild and */Config.in -{ cd -- "$srctree" && find -type d; } | while read -r d; do +{ cd -- "$srctree" && find . -type d; } | while read -r d; do d="${d#./}" src="$srctree/$d/Kbuild.src" -- 1.6.5.7 _______________________________________________ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox