Closed gotroyb127 closed 3 years ago
Could you give me more information about your setup? I just cloned a fresh copy of oksh on my Android phone running Termux. The reallocarray check returned no and everything built just fine.
By the way, if you run ./configure && make
then your final binary will be named oksh
, not ksh
.
Could you try again with a fresh clone of oksh?
I have tried it on 2 Xiaomi phones running MIUI 11 using the last version of Termux (from F-Droid).
(Yes, the binary is actually oksh, previously ran configure
with --enable-ksh
)
But I get the following output:
I feel sorry for not knowing what else information to provide. Thank you for your time and effort.
I get the same warning. But then I get a linker error undefined reference to `reallocarray'. Which is what I would expect. It is possible that you have a header/libc mismatch, where your headers don't have reallocarray but your libc does. Could you grep your libc for reallocarray?
Sorry for taking so long (the headers are in "$PREFIX"/inlclude
but it didn't cross my mind to look there from the beginning)
It seems that reallocarray is defined in malloc.h
which is inlcuded by stdlib.h
but requires that the macro __ANDROID_API__
is >= 29
And, indeed, the linker does not output any error.
Excellent. Getting closer. The correct __ANDROID_API__ value for your machine should automagically be set by your compiler or by your environment. It's definitely not something that should be set by an application. So we should figure out where and to what its value is being set.
You could run cc -dM -E - </dev/null
and see if your compiler knows about the value. If it does, it'll tell you what it is.
Well,
cc -dm -E - < /dev/null
does not define __ANDROID_API__
From files under "$PREFIX"/inlcude
(recursive search through find (https://github.com/gotroyb127/dotfiles/blob/master/bin/grepf))I get:
$ grepf '#define .*__ANDROID_API__'
./android/api-level.h:#define __ANDROID_API__ 24
I also found this (https://github.com/termux/termux-packages/issues/2469) open issue on termux.
OK. I think maybe then we should blanket disable reallocarray detection on Android. It's not reliable. I'll make that change in a bit.
Sorry this took so long for such an easy fix. We are going to guarantee failure on the reallocarray check when on Android so we unconditionally use the version in this repo.
Hi,
I was trying to get this shell running inside Termux on Android but
./configure && make && ./ksh
kept giving me a segmentation fault.After using
gdb
, it turned out thatreallocarray
isn't available though./configure
says it is. So I recompiled it after I had removed the#define HAVE_REALLOCARRAY
frompconfig.h
and the shell now runs with no problem.And it seems to me that you may want to know, so here I am reporting it.
Actually the main problem is that compiling this
returns 0, while generating only a warning:
warning: implicit declaration of function 'reallocarray' is invalid in C99 [-Wimplicit-function-decleration]