Android Builds of OpenJDK Mobile project now available
Ali Ebrahimi
ali.ebrahimi1781 at gmail.com
Sat Feb 20 10:42:52 UTC 2016
Hi,
On Sat, Feb 20, 2016 at 12:19 AM, Bob Vandette <bob.vandette at oracle.com>
wrote:
>
> On Feb 19, 2016, at 3:34 PM, Ali Ebrahimi <ali.ebrahimi1781 at gmail.com>
> wrote:
>
> Hi,
>
> On Fri, Feb 19, 2016 at 5:00 PM, Bob Vandette <bob.vandette at oracle.com>
> wrote:
>
>> Your patch below may allow you to build the JDK but it won’t be able to
>> run on Android 4 devices
>> since the missing functions are not available in android-19 libc.a. This
>> is why we need to conditionally
>> remove these functions based on the platform version you want to target.
>>
> My patch builds with toolchain for platform 19, So if this functions
> (except one case) is missing in android-19 libc, so toolchain 19 should not
> build JDK. So you say this is NDK bug?
>
>
> Have you created an API level 19 emulator and tried running your binaries?
>
> I looked at the API level 19 libc.a and is has getpwuid but no getpwuid_r
> function.
>
> I believe the JDK shared libraries are being built ignoring missing
> symbols which would defer any
> build problems to runtime.
>
I confirm your correct, I get runtime error.
I gathered all missing api for platform-19: grep -Ril "MISSING FROM BIONIC"
./include
./include/unistd.h
./include/pthread.h
./include/getopt.h
./include/pwd.h
./include/grp.h
./include/stdio.h
./include/sys/fsuid.h
./include/sys/mount.h
./include/locale.h
./include/stdlib.h
./include/sgtty.h
./include/netdb.h
./include/nsswitch.h
The good news is that all of this APIs implemented in Android platform-21:
grep -Ril "MISSING FROM BIONIC" ./include
The problem with alternative implementations in current jdk repo is that
they have implemented as static and this conflicts with non-static API in
platform-21.
Another problem is that some of this implementations repeated in multi
places and better we package them in one place and just include them when
needed.
Android platform 19(BIONIC) Missing libc API
./include/unistd.h
#if 0 /* MISSING FROM BIONIC */
extern pid_t getsid(pid_t);
extern int execvpe(const char *, char * const *, char * const *);
extern int execlpe(const char *, const char *, ...);
extern int getfsuid(uid_t);
extern int setfsuid(uid_t);
extern int getlogin_r(char* name, size_t namesize);
extern int sethostname(const char *, size_t);
extern int getdomainname(char *, size_t);
extern int setdomainname(const char *, size_t);
#endif /* MISSING */
./include/pthread.h
#if 0 /* MISSING FROM BIONIC */
int pthread_mutex_timedlock(pthread_mutex_t *mutex, struct timespec* ts);
#endif /* MISSING */
./include/getopt.h
#if 0 /* MISSING FROM BIONIC */
int getsubopt(char **, char * const *, char **);
extern char *suboptarg; /* getsubopt(3) external variable */
#endif /* MISSING */
./include/grp.h
#if 0 /* MISSING FROM BIONIC */
#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XPG_VISIBLE
struct group *getgrent(void);
void setgrent(void);
void endgrent(void);
int getgrgid_r(gid_t, struct group *, char *,
size_t, struct group **);
int getgrnam_r(const char *, struct group *, char *,
size_t, struct group **);
#endif
#if __BSD_VISIBLE
void setgrfile(const char *);
int setgroupent(int);
char *group_from_gid(gid_t, int);
#endif
#endif /* MISSING */
./include/pwd.h
#if 0 /* MISSING FROM BIONIC */
int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);
int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);
struct passwd* getpwent(void);
int setpwent(void);
#endif /* MISSING */
./include/stdio.h
#if 0 /* MISSING FROM BIONIC */
char *ctermid(char *);
char *cuserid(char *);
#endif /* MISSING */
./include/locale.h
#if 1 /* MISSING FROM BIONIC - DEFINED TO MAKE libstdc++-v3 happy */
struct lconv { };
struct lconv *localeconv(void);
#endif /* MISSING */
./include/stdlib.h
#if 1 /* MISSING FROM BIONIC - ENABLED FOR STLPort and libstdc++-v3 */
/* make STLPort happy */
extern int mblen(const char *, size_t);
extern size_t mbstowcs(wchar_t *, const char *, size_t);
extern int mbtowc(wchar_t *, const char *, size_t);
/* Likewise, make libstdc++-v3 happy. */
extern int wctomb(char *, wchar_t);
extern size_t wcstombs(char *, const wchar_t *, size_t);
#endif /* MISSING */
#if 0 /* MISSING FROM BIONIC */
extern int on_exit(void (*)(int, void *), void *);
#endif /* MISSING */
./include/sgtty.h
#if 0 /* MISSING FROM BIONIC */
int gtty(int, struct sgttyb *);
int stty(int, struct sgttyb *);
#endif /* MISSING */
./include/netdb.h
#if 0 /* MISSING FROM BIONIC */
void endhostent(void);
void endnetent(void);
void endnetgrent(void);
void endprotoent(void);
void freehostent(struct hostent *);
int gethostbyaddr_r(const char *, int, int, struct hostent *, char *,
size_t, struct hostent **, int *);
int gethostbyname2_r(const char *, int, struct hostent *, char *, size_t,
struct hostent **, int *);
int gethostent_r(struct hostent *, char *, size_t, struct hostent **, int
*);
struct hostent *getipnodebyaddr(const void *, size_t, int, int *);
struct hostent *getipnodebyname(const char *, int, int, int *);
int getnetbyaddr_r(uint32_t, int, struct netent *, char *, size_t, struct
netent**, int *);
int getnetbyname_r(const char *, struct netent *, char *, size_t, struct
netent **, int *);
int getnetent_r(struct netent *, char *, size_t, struct netent **, int *);
int getnetgrent(char **, char **, char **);
int getprotobyname_r(const char *, struct protoent *, char *, size_t,
struct protoent **);
int getprotobynumber_r(int, struct protoent *, char *, size_t, struct
protoent **);
struct protoent *getprotoent(void);
int getprotoent_r(struct protoent *, char *, size_t, struct protoent **);
int innetgr(const char *, const char *, const char *, const char *);
void sethostent(int);
void setnetent(int);
void setprotoent(int);
struct netent *getnetent(void);
void setnetgrent(const char *);
#endif /* MISSING */
./include/nsswitch.h
#if 0 /* MISSING FROM BIONIC */
extern const ns_src __nsdefaultsrc[];
extern const ns_src __nsdefaultcompat[];
extern const ns_src __nsdefaultcompat_forceall[];
extern const ns_src __nsdefaultfiles[];
extern const ns_src __nsdefaultfiles_forceall[];
extern const ns_src __nsdefaultnis[];
extern const ns_src __nsdefaultnis_forceall[];
#endif /* MISSING */
./include/sys/fsuid.h
#if 0 /* MISSING FROM BIONIC */
extern const ns_src __nsdefaultsrc[];
extern const ns_src __nsdefaultcompat[];
extern const ns_src __nsdefaultcompat_forceall[];
extern const ns_src __nsdefaultfiles[];
extern const ns_src __nsdefaultfiles_forceall[];
extern const ns_src __nsdefaultnis[];
extern const ns_src __nsdefaultnis_forceall[];
#endif /* MISSING */
./include/sys/mount.h
#if 0 /* MISSING FROM BIONIC */
extern int pivot_root(const char *, const char *);
#endif /* MISSING */
--
Best Regards,
Ali Ebrahimi
-------------- next part --------------
Android platform 19(BIONIC) Missing libc API
./include/unistd.h
#if 0 /* MISSING FROM BIONIC */
extern pid_t getsid(pid_t);
extern int execvpe(const char *, char * const *, char * const *);
extern int execlpe(const char *, const char *, ...);
extern int getfsuid(uid_t);
extern int setfsuid(uid_t);
extern int getlogin_r(char* name, size_t namesize);
extern int sethostname(const char *, size_t);
extern int getdomainname(char *, size_t);
extern int setdomainname(const char *, size_t);
#endif /* MISSING */
./include/pthread.h
#if 0 /* MISSING FROM BIONIC */
int pthread_mutex_timedlock(pthread_mutex_t *mutex, struct timespec* ts);
#endif /* MISSING */
./include/getopt.h
#if 0 /* MISSING FROM BIONIC */
int getsubopt(char **, char * const *, char **);
extern char *suboptarg; /* getsubopt(3) external variable */
#endif /* MISSING */
./include/grp.h
#if 0 /* MISSING FROM BIONIC */
#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XPG_VISIBLE
struct group *getgrent(void);
void setgrent(void);
void endgrent(void);
int getgrgid_r(gid_t, struct group *, char *,
size_t, struct group **);
int getgrnam_r(const char *, struct group *, char *,
size_t, struct group **);
#endif
#if __BSD_VISIBLE
void setgrfile(const char *);
int setgroupent(int);
char *group_from_gid(gid_t, int);
#endif
#endif /* MISSING */
./include/pwd.h
#if 0 /* MISSING FROM BIONIC */
int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);
int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);
struct passwd* getpwent(void);
int setpwent(void);
#endif /* MISSING */
./include/stdio.h
#if 0 /* MISSING FROM BIONIC */
char *ctermid(char *);
char *cuserid(char *);
#endif /* MISSING */
./include/locale.h
#if 1 /* MISSING FROM BIONIC - DEFINED TO MAKE libstdc++-v3 happy */
struct lconv { };
struct lconv *localeconv(void);
#endif /* MISSING */
./include/stdlib.h
#if 1 /* MISSING FROM BIONIC - ENABLED FOR STLPort and libstdc++-v3 */
/* make STLPort happy */
extern int mblen(const char *, size_t);
extern size_t mbstowcs(wchar_t *, const char *, size_t);
extern int mbtowc(wchar_t *, const char *, size_t);
/* Likewise, make libstdc++-v3 happy. */
extern int wctomb(char *, wchar_t);
extern size_t wcstombs(char *, const wchar_t *, size_t);
#endif /* MISSING */
#if 0 /* MISSING FROM BIONIC */
extern int on_exit(void (*)(int, void *), void *);
#endif /* MISSING */
./include/sgtty.h
#if 0 /* MISSING FROM BIONIC */
int gtty(int, struct sgttyb *);
int stty(int, struct sgttyb *);
#endif /* MISSING */
./include/netdb.h
#if 0 /* MISSING FROM BIONIC */
void endhostent(void);
void endnetent(void);
void endnetgrent(void);
void endprotoent(void);
void freehostent(struct hostent *);
int gethostbyaddr_r(const char *, int, int, struct hostent *, char *, size_t, struct hostent **, int *);
int gethostbyname2_r(const char *, int, struct hostent *, char *, size_t, struct hostent **, int *);
int gethostent_r(struct hostent *, char *, size_t, struct hostent **, int *);
struct hostent *getipnodebyaddr(const void *, size_t, int, int *);
struct hostent *getipnodebyname(const char *, int, int, int *);
int getnetbyaddr_r(uint32_t, int, struct netent *, char *, size_t, struct netent**, int *);
int getnetbyname_r(const char *, struct netent *, char *, size_t, struct netent **, int *);
int getnetent_r(struct netent *, char *, size_t, struct netent **, int *);
int getnetgrent(char **, char **, char **);
int getprotobyname_r(const char *, struct protoent *, char *, size_t, struct protoent **);
int getprotobynumber_r(int, struct protoent *, char *, size_t, struct protoent **);
struct protoent *getprotoent(void);
int getprotoent_r(struct protoent *, char *, size_t, struct protoent **);
int innetgr(const char *, const char *, const char *, const char *);
void sethostent(int);
void setnetent(int);
void setprotoent(int);
struct netent *getnetent(void);
void setnetgrent(const char *);
#endif /* MISSING */
./include/nsswitch.h
#if 0 /* MISSING FROM BIONIC */
extern const ns_src __nsdefaultsrc[];
extern const ns_src __nsdefaultcompat[];
extern const ns_src __nsdefaultcompat_forceall[];
extern const ns_src __nsdefaultfiles[];
extern const ns_src __nsdefaultfiles_forceall[];
extern const ns_src __nsdefaultnis[];
extern const ns_src __nsdefaultnis_forceall[];
#endif /* MISSING */
./include/sys/fsuid.h
#if 0 /* MISSING FROM BIONIC */
extern const ns_src __nsdefaultsrc[];
extern const ns_src __nsdefaultcompat[];
extern const ns_src __nsdefaultcompat_forceall[];
extern const ns_src __nsdefaultfiles[];
extern const ns_src __nsdefaultfiles_forceall[];
extern const ns_src __nsdefaultnis[];
extern const ns_src __nsdefaultnis_forceall[];
#endif /* MISSING */
./include/sys/mount.h
#if 0 /* MISSING FROM BIONIC */
extern int pivot_root(const char *, const char *);
#endif /* MISSING */
More information about the mobile-dev
mailing list