[BUG] xfsprogs-4.7.0: issues cross-compiling for musl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



To get xfsprogs to cross-compile for musl some hacks were needed.

1) d_namlen isn't available with musl

2) crc32selftest doesn't make sense in case of cross-compilation, the
same can be said if building for a different host with the native
toolchain. So maybe an --disable-crc32selftest configure option could
be used here.

3) The CFLAGS passed to BUILD_CC weren't understood by the native
compiler. Set BUILD_CFLAGS to CFLAGS if not cross-compiling or let it
blank anyway?

4) sys/ustat.h is missing in musl.

I can send patches for the seperate points once it's clear how you want
them handled.

Cheers
Ralph
---
 io/readdir.c    | 2 +-
 libxfs/Makefile | 8 ++++----
 libxfs/linux.c  | 3 ++-
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/io/readdir.c b/io/readdir.c
index 151b72e..d88ba89 100644
--- a/io/readdir.c
+++ b/io/readdir.c
@@ -106,7 +106,7 @@ read_directory(
 #ifdef _DIRENT_HAVE_D_RECLEN
 		*total += dirent->d_reclen;
 #else
-		*total += dirent->d_namlen + sizeof(*dirent);
+		*total += strlen(dirent->d_name) + sizeof(*dirent);
 #endif
 		count++;
 
diff --git a/libxfs/Makefile b/libxfs/Makefile
index ca1a5ee..0dc2088 100644
--- a/libxfs/Makefile
+++ b/libxfs/Makefile
@@ -105,13 +105,13 @@ LTLIBS = $(LIBPTHREAD) $(LIBRT)
 # don't try linking xfs_repair with a debug libxfs.
 DEBUG = -DNDEBUG
 
-LDIRT = gen_crc32table crc32table.h crc32selftest
+LDIRT = gen_crc32table crc32table.h
 
-default: crc32selftest ltdepend $(LTLIBRARY)
+default: ltdepend $(LTLIBRARY)
 
 crc32table.h: gen_crc32table.c
 	@echo "    [CC]     gen_crc32table"
-	$(Q) $(BUILD_CC) $(CFLAGS) -o gen_crc32table $<
+	$(Q) $(BUILD_CC) $(BUILD_CFLAGS) -o gen_crc32table $<
 	@echo "    [GENERATE] $@"
 	$(Q) ./gen_crc32table > crc32table.h
 
@@ -122,7 +122,7 @@ crc32table.h: gen_crc32table.c
 # disk.
 crc32selftest: gen_crc32table.c crc32table.h crc32.c
 	@echo "    [TEST]    CRC32"
-	$(Q) $(BUILD_CC) $(CFLAGS) -D CRC32_SELFTEST=1 crc32.c -o $@
+	$(Q) $(BUILD_CC) $(BUILD_CFLAGS) -D CRC32_SELFTEST=1 crc32.c -o $@
 	$(Q) ./$@
 
 # set up include/xfs header directory
diff --git a/libxfs/linux.c b/libxfs/linux.c
index c9f2baf..c510886 100644
--- a/libxfs/linux.c
+++ b/libxfs/linux.c
@@ -20,7 +20,6 @@
 #include <mntent.h>
 #include <sys/stat.h>
 #undef ustat
-#include <sys/ustat.h>
 #include <sys/mount.h>
 #include <sys/ioctl.h>
 #include <sys/sysinfo.h>
@@ -51,6 +50,7 @@ static int max_block_alignment;
 int
 platform_check_ismounted(char *name, char *block, struct stat64 *s, int verbose)
 {
+#if 0
 	/* Pad ust; pre-2.6.28 linux copies out too much in 32bit compat mode */
 	struct ustat	ust[2];
 	struct stat64	st;
@@ -70,6 +70,7 @@ platform_check_ismounted(char *name, char *block, struct stat64 *s, int verbose)
 				progname, name);
 		return 1;
 	}
+#endif
 	return 0;
 }
 
-- 
2.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux