Closed sarnold closed 5 years ago
I also made a patch for the first issue, but for whatever reason it's not enough for this build setup, or else I'm not applying it correctly, or who knows? Note that method of patching works in some repos, but again, who knows?
Also note that the generic form of makedev is defined if HAVE_SYS_SYSMACROS_H is correctly enabled (I did try defining it directly the same as HAVE_CONFIG_H below but that didn't help.
I spent an adventurous and completely unproductive day troubleshooting this and then I ran out of customer time and have to punt upstream.
$ cat e2fsprogs-fix-sysmacros-and-configure.patch
diff --git a/configure b/configure
index 31ec8d3..1848cb8 100755
--- a/configure
+++ b/configure
@@ -11427,10 +11427,10 @@ if test "$USE_INCLUDED_LIBINTL" = "yes" ; then
fi
if test $cross_compiling = no; then
- BUILD_CFLAGS="$CFLAGS $CPPFLAGS"
+ BUILD_CFLAGS="$CFLAGS $CPPFLAGS $INCLUDES -DHAVE_CONFIG_H"
BUILD_LDFLAGS="$LDFLAGS"
else
- BUILD_CFLAGS=
+ BUILD_CFLAGS="$INCLUDES"
BUILD_LDFLAGS=
fi
diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
index 80662b1..ac37275 100644
--- a/debugfs/debugfs.c
+++ b/debugfs/debugfs.c
@@ -26,6 +26,9 @@ extern char *optarg;
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
+#ifdef HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h>
+#endif
#include "debugfs.h"
#include "uuid/uuid.h"
diff --git a/lib/blkid/devname.c b/lib/blkid/devname.c
index b151354..3c4173b 100644
--- a/lib/blkid/devname.c
+++ b/lib/blkid/devname.c
@@ -35,6 +35,9 @@
#if HAVE_SYS_MKDEV_H
#include <sys/mkdev.h>
#endif
+#ifdef HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h>
+#endif
#include <time.h>
#include "blkidP.h"
diff --git a/lib/blkid/devno.c b/lib/blkid/devno.c
index c9f5c92..91c9207 100644
--- a/lib/blkid/devno.c
+++ b/lib/blkid/devno.c
@@ -30,6 +30,9 @@
#if HAVE_SYS_MKDEV_H
#include <sys/mkdev.h>
#endif
+#ifdef HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h>
+#endif
#include "blkidP.h"
diff --git a/lib/ext2fs/ismounted.c b/lib/ext2fs/ismounted.c
index db80c46..247b9ff 100644
--- a/lib/ext2fs/ismounted.c
+++ b/lib/ext2fs/ismounted.c
@@ -37,6 +37,9 @@
#endif /* HAVE_GETMNTINFO */
#include <string.h>
#include <sys/stat.h>
+#ifdef HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h>
+#endif
#include "ext2_fs.h"
#include "ext2fs.h"
Turns out it was the above glibc issue and I was too dumb to patch the Android.mk to make it work. I also hacked the env script PATH but there might be a better way for that too... Anyway, I appended the second part to this:
export PATH=$ANDROID_BUILD_PATHS$PATH:$ANDROID_HOST_OUT/bin
and applied this patch to make it work:
From edbb41c1eca55325ef7484f4679f8b0a3123f62c Mon Sep 17 00:00:00 2001
From: Steve Arnold <nerdboy@gentoo.org>
Date: Tue, 10 Oct 2017 21:18:03 -0700
Subject: [PATCH] external/e2fsprogs: fix build with newer/patched glibc
Change-Id: I6baa8a9fd1c9559310bfa2a63731f882135f89af
Signed-off-by: Steve Arnold <nerdboy@gentoo.org>
---
debugfs/debugfs.c | 3 +++
lib/blkid/Android.mk | 3 ++-
lib/blkid/devname.c | 4 ++++
lib/blkid/devno.c | 3 +++
lib/ext2fs/ismounted.c | 3 +++
5 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
index 80662b1..ac37275 100644
--- a/debugfs/debugfs.c
+++ b/debugfs/debugfs.c
@@ -26,6 +26,9 @@ extern char *optarg;
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
+#ifdef HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h>
+#endif
#include "debugfs.h"
#include "uuid/uuid.h"
diff --git a/lib/blkid/Android.mk b/lib/blkid/Android.mk
index 6131f3e..7d697fe 100644
--- a/lib/blkid/Android.mk
+++ b/lib/blkid/Android.mk
@@ -53,7 +53,8 @@ libext2_blkid_cflags_linux := \
-DHAVE_LINUX_FD_H \
-DHAVE_SYS_PRCTL_H \
-DHAVE_LSEEK64 \
- -DHAVE_LSEEK64_PROTOTYPE
+ -DHAVE_LSEEK64_PROTOTYPE \
+ -DHAVE_SYS_SYSMACROS_H
include $(CLEAR_VARS)
diff --git a/lib/blkid/devname.c b/lib/blkid/devname.c
index b151354..97a2f4f 100644
--- a/lib/blkid/devname.c
+++ b/lib/blkid/devname.c
@@ -35,8 +35,12 @@
#if HAVE_SYS_MKDEV_H
#include <sys/mkdev.h>
#endif
+#ifdef HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h>
+#endif
#include <time.h>
+
#include "blkidP.h"
/*
diff --git a/lib/blkid/devno.c b/lib/blkid/devno.c
index c9f5c92..91c9207 100644
--- a/lib/blkid/devno.c
+++ b/lib/blkid/devno.c
@@ -30,6 +30,9 @@
#if HAVE_SYS_MKDEV_H
#include <sys/mkdev.h>
#endif
+#ifdef HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h>
+#endif
#include "blkidP.h"
diff --git a/lib/ext2fs/ismounted.c b/lib/ext2fs/ismounted.c
index db80c46..247b9ff 100644
--- a/lib/ext2fs/ismounted.c
+++ b/lib/ext2fs/ismounted.c
@@ -37,6 +37,9 @@
#endif /* HAVE_GETMNTINFO */
#include <string.h>
#include <sys/stat.h>
+#ifdef HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h>
+#endif
#include "ext2_fs.h"
#include "ext2fs.h"
--
2.14.1
Sorry about the really long wait, but I'll leave this here for posterity.
The build instructions for the Fairphone 2, Oneplus One, and Nexus 5 have been compiled and uploaded to https://docs.ubports.com/en/latest/porting/ubp-5.1.html. Please note that building on Ubuntu 16.04 is the only supported way.
Steps to reproduce
Expected behavior:
Follow the steps and "make -jN" works.
Actual behavior
Sometimes it doesn't, this time e2fsprogs fails with:
/home/sarnold/android/ubports/out/host/linux-x86/obj32/SHARED_LIBRARIES/libext2_blkid_host_intermediates/devname.o: In function
evms_probe_all': /home/sarnold/android/ubports/external/e2fsprogs/lib/blkid/devname.c:386: undefined reference to
makedev' /home/sarnold/android/ubports/out/host/linux-x86/obj32/SHARED_LIBRARIES/libext2_blkid_host_intermediates/devname.o: In functionlvm_get_devno': /home/sarnold/android/ubports/external/e2fsprogs/lib/blkid/devname.c:294: undefined reference to
makedev' /home/sarnold/android/ubports/out/host/linux-x86/obj32/SHARED_LIBRARIES/libext2_blkid_host_intermediates/devname.o: In functionprobe_all': /home/sarnold/android/ubports/external/e2fsprogs/lib/blkid/devname.c:438: undefined reference to
makedev' collect2: error: ld returned 1 exit status make: [build/core/host_shared_library_internal.mk:44: /home/sarnold/android/ubports/out/host/linux-x86/obj32/lib/libext2_blkid_host.so] Error 1 make: Waiting for unfinished jobs....And with parallel make, sometimes it gets far enough to fail with a different error, which is just "command not found". The error comes from mkuserimg.sh and it's looking for the command "make_ext4fs", both of which are in an internal bin directory created during the build, so I assume that path should be known from "env-setup" or whatever android magic is supposed to find it (note that it was working fine until my sync 2 days ago).
Logfiles and additional information
I would have filed these on the repo they come from (as long as I can figure that out) but those repos do not have Issues enabled, and the answer person in #ubports told me to put it here. This is slightly custom build for a 3.10 kernel, and the repos are here: https://github.com/VCTLabs and this is my local manifest:
(external) build environment: