Closed timstrom closed 2 months ago
Thanks for the clear report!
iconv.h
is meant to be included with the ndk-sysroot
package, and should now be fixed in https://github.com/termux-play-store/termux-packages/commit/4b91078ea8486367568143b7e434c90b60a4428e - update to the latest 26d-1
version of ndk-sysroot
with pkg up
.
Let me know how it works! Note that iconv is currently provided by the system libc (in the Google Play build of Termux, which targets newer Android versions), so no external libraries are necessary.
libiconv.so
as a no-op library, and perhaps remove the GNU libiconv package?Thank you for the quick response.
There seems to be something 'wrong' with the system iconv.h from ndk-sysroot.
I am trying to compile the statistic program R (R-4.4.1.tar.gz).
This works on F-Droid Termux, when I use the following command to configure the Makefile:
CC=clang CXX=clang++ FC=flang-new LD=lld ./configure --with-x=no --enable-R-shlib --prefix=$PREFIX/local/R-4.4.1
If I use the same command on play-store Termux, the configure script stops with the following error:
checking for iconv.h... yes checking for iconv... yes checking whether iconv accepts "UTF-8", "latin1", "ASCII" and "UCS-*"... no configure: error: a suitable iconv is essential
The configure script and make run successfully when I install the libiconv package from F-Droid Termux locally:
dpkg -i -force-overwrite libiconv_1.17_aarch64.deb
@timstrom Thanks a lot for the detailed steps - will look into this shortly!
Indeed, the iconv functionality provided by the bionic libc is quite limited: https://android.googlesource.com/platform/bionic.git/+/refs/heads/main/libc/bionic/iconv.cpp, only
if (__match_encoding(s, "utf8")) {
*encoding = UTF_8;
} else if (__match_encoding(s, "ascii") || __match_encoding(s, "usascii")) {
*encoding = US_ASCII;
} else if (__match_encoding(s, "utf16le")) {
*encoding = UTF_16_LE;
} else if (__match_encoding(s, "utf16be")) {
*encoding = UTF_16_BE;
} else if (__match_encoding(s, "utf32le")) {
*encoding = UTF_32_LE;
} else if (__match_encoding(s, "utf32be")) {
*encoding = UTF_32_BE;
} else if (__match_encoding(s, "wchart")) {
*encoding = WCHAR_T;
} else {
return false;
}
While the test program run by R:s configure is:
int main (void) {
iconv_t cd;
cd = iconv_open("latin1","UTF-8");
if(cd == (iconv_t)(-1)) {printf("latin1 UTF-8\n"); exit(1); }
iconv_close(cd);
cd = iconv_open("UTF-8","latin1");
if(cd == (iconv_t)(-1)) exit(1);
iconv_close(cd);
cd = iconv_open("","latin1");
if(cd == (iconv_t)(-1)) exit(1);
iconv_close(cd);
cd = iconv_open("","UTF-8");
if(cd == (iconv_t)(-1)) exit(1);
iconv_close(cd);
cd = iconv_open("latin1", "");
if(cd == (iconv_t)(-1)) exit(1);
iconv_close(cd);
cd = iconv_open("UTF-8","");
if(cd == (iconv_t)(-1)) exit(1);
iconv_close(cd);
cd = iconv_open("ASCII","");
if(cd == (iconv_t)(-1)) exit(1);
iconv_close(cd);
cd = iconv_open("UCS-2LE","");
if(cd == (iconv_t)(-1)) exit(1);
iconv_close(cd);
cd = iconv_open("", "UCS-2LE");
if(cd == (iconv_t)(-1)) exit(1);
iconv_close(cd);
cd = iconv_open("UCS-2BE","");
if(cd == (iconv_t)(-1)) exit(1);
iconv_close(cd);
cd = iconv_open("", "UCS-2BE");
if(cd == (iconv_t)(-1)) exit(1);
iconv_close(cd);
cd = iconv_open("UCS-4LE","");
if(cd == (iconv_t)(-1)) exit(1);
iconv_close(cd);
cd = iconv_open("", "UCS-4LE");
if(cd == (iconv_t)(-1)) exit(1);
iconv_close(cd);
cd = iconv_open("UCS-4BE","");
if(cd == (iconv_t)(-1)) exit(1);
iconv_close(cd);
cd = iconv_open("", "UCS-4BE");
if(cd == (iconv_t)(-1)) exit(1);
iconv_close(cd);
exit(0);
}
Will most likely go back to letting the more fully featured GNU libiconv package provide iconv, instead of the more limited built-in bionic functionality.
Thanks. Would make it easier to compile the R package.
@timstrom https://github.com/termux-play-store/termux-packages/commit/8e8d2b7c2bdab62616192cec184edd16e1dec1a8 changes back so that iconv.h
is provided by the libiconv
package - if you run pkg up
, does it work better?
iconv.h of the libiconv package works for the configuration of the Makefile.
But Since June 20 it is not longer possible to compile (make) the R-packages. I get errors like
sh: /data/data/com.termux/files/usr/bin/make: Permission denied sh: /data/data/com.termux/files/usr/bin/make: Permission denied
May be, it is caused by the upgrades of termux.exec or termux-tools on June 20.
Some libraries can be compiled, others not.
Make finishes with the following error message:
`begin installing recommended package MASS
Since June 20 it is not longer possible to compile (make) the R-packages. I get errors like sh: /data/data/com.termux/files/usr/bin/make: Permission denied sh: /data/data/com.termux/files/usr/bin/make: Permission denied May be, it is caused by the upgrades of termux.exec or termux-tools on June 20.
@timstrom Thanks a lot! I think the just released version 1.4 of termux-exec
fixes the issue you've seen here, when you have the time please run pkg up
to update and check how it works!
It works. Thank you.
Thanks for following up!
Problem description
iconv.h is missing.
That may be caused by the following command
TERMUX_PKG_RM_AFTER_INSTALL="include/iconv.h"
in termux-packages/packages/libiconv/build.sh
iconv.h seems not to be provided by other packages.
What steps will reproduce the bug?
apt install libiconv
What is the expected behavior?
No response
System information