Closed ghost closed 3 years ago
this is a issue since android-ndk r22 : https://github.com/android/ndk/issues/1409, please using android-ndk r21
I will take a look at that.
Between r21d and r22, the upstream Clang driver changed its default from -fcommon to -fno-common
Can you try adding -fcommon
flag somewhere in the CFLAGS? If it really is about that, which I doubt.
But from I can tell the function from libsh appears in bionic libc for android 21(5.0).
-fcommon
added in CFLAGS, yet same error.
That's because the libc.a static bionic library, contains the same symbol strchrnul.
The way to respond to something like this can be:
1.Unpack the static library archive(it is made with ar) and contains .o files put in it blindly. Remove the offending .o file, and let libsh use said symbol, the static library(ar archive) modification needs to be local. And then we make sure it finds our new static libc first before one found in ndk. Because such change isn't done to a shared library and the change will be statically linked there are no side effects to this, bash expects the function not to be part of libc and so it staticslly links it is self against libsh I bet.
2.Remove the function from libsh, it is just a single file, but it would take a whole lot more time, there might be side effects if the bionic libc implementation has a different behavior.
remove --enable-static-link
, using shared library, don't use static library.
Yeah the armv7 build didn't went through for ndk22 and ndk21
ndk22 and 21 didn't find a couple of libc wrappers to setgrent getgrent endgrent; and it also has an undefined reference to mblen;
At least from my end how can I ignore builds of architectures which fail to compile?
I want to have it packaged up etc. primarily for armv8
case $TARGET_OS_ARCH in
armv7a)
;;
aarch64)
;;
i686)
;;
x86_64)
;;
esac
case $TARGET_OS_ARCH in armv7a) ;; aarch64) ;; i686) ;; x86_64) ;; esac
Fair I should have thought of that
Well the issue is closed for me, but you will probably want the armv7a running
android-ndk r21 is highly recommended. because it is used in my Github Actions CI.
.c
#include <sys/types.h>
#include <grp.h>
struct group* getgrent(void) {
return NULL;
}
void setgrent(void) {
return;
}
void endgrent(void) {
return;
}
.h
struct group* getgrent(void);
void setgrent(void);
void endgrent(void);
mblen: https://github.com/awong-dev/ndk/blob/master/sources/android/support/src/musl-multibyte/mblen.c
it fails for me with ndk 21 as well actually idk what made it jump from aarch64 build to armv7 build, thought the arrch64 build went through
<kubast2> Hey, how crucial is setgrent, getgrent and endgrent for bash? Say the target system doesn't have /etc/group, can I make a thin wrapper that will just return the error condition?
<kubast2> I will just verify
<kubast2> setgrent(3) getgrent(3) endgrent(3) is usually part of libc; but I have this specific embedded application with some alternative libc; which comes without those functions;
<earnestly> Appears to use it directly for group name completions, and only there
They are introduced in android-26
.
/tmp/tmp.yDkXKIKWcs test.tar.gz