php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80585 Compile error - iconv dose not support errno
Submitted: 2021-01-04 15:06 UTC Modified: 2024-07-21 22:57 UTC
Votes:21
Avg. Score:3.9 ± 1.3
Reproduced:20 of 21 (95.2%)
Same Version:11 (55.0%)
Same OS:7 (35.0%)
From: tomas at rybarik dot com Assigned: cmb (profile)
Status: No Feedback Package: *Compile Issues
PHP Version: 8.0.0 OS: OracleLinux 7
Private report: No CVE-ID: None
 [2021-01-04 15:06 UTC] tomas at rybarik dot com
Description:
------------
I'm unable to compile PHP 8.0.0 with enabled iconv.
This is output from configure command:
checking for iconv support... yes
checking for iconv... yes
checking if iconv is glibc's... yes
checking if iconv supports errno... no
configure: error: iconv does not support errno

I tried compile PHP 7.4.13 with the same version of iconv (1.16), there everything is OK.
checking for iconv support... yes
checking for iconv... yes
checking if iconv is glibc's... yes
checking if iconv supports errno... yes
checking if iconv supports //IGNORE... no



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-01-05 10:28 UTC] cmb@php.net
As of PHP 8.0.0, iconv implementation which do not support errno
(i.e. non POSIX conforming implementations) are no longer
supported.  Either you glic iconv does not support errno, or that
support is wrongly detected.

Consider to install and use libiconv.
 [2021-01-18 08:49 UTC] shimozawa dot hiroki at misou dot co dot jp
I am also getting the same error.
Will it be fixed in the next version?

Reproduction procedure.

~~~
# cat /etc/redhat-release 
CentOS Linux release 7.3.1611 (Core) 

# cd /usr/local/src/
# wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz
# tar zxvf ./libiconv-1.16.tar.gz
# cd libiconv-1.16
# ./configure --prefix=/usr
# make & make install

# iconv --version
iconv (GNU libiconv 1.16)
Copyright (C) 2000-2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
...


# cd /usr/local/src/php-8.0.1
# ./configure \
... \
... \
--with-iconv

...
...
checking for iconv support... yes
checking for iconv... yes
checking if iconv is glibc's... yes
checking if iconv supports errno... no
configure: error: iconv does not support errno
 [2021-03-09 22:47 UTC] guillaume-php at outters dot eu
Tomas, could you please tell us what error is logged in the config.log?

As suggested by cmg, this is a problem of detection; but in my case (FreeBSD 10.2, with "hand"-compiled GNU iconv 1.16 without pkgconfig), the detection program had no problem, rather it was its compile env that lacked a -liconv.

So this could be circumvented by running an:
  export LDFLAGS="$LDFLAGS -liconv"
before the configure.

I _think_ that, like you, I had no problem compiling a PHP 7 in the same environment (so this detect failure would be a configure regression); but I cannot be certain.
 [2021-11-08 12:40 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-11-08 12:40 UTC] cmb@php.net
It has been a deliberate change to no longer support iconv(3)
implementations which do not set errno as of PHP 8.0.0[1], because
the fallback code was flawed, and such iconv(3) implementations
are not POSIX conformant anyway.  Anyhow, this change will not be
reverted.

It is possible, though, that the detection of errno support is
flawed, or that something else with our configure scripts is not
quite right in this regard.  However, without further information
(such as the respective part of config.log), we can't do anything
about this.

[1] <https://www.php.net/manual/en/migration80.incompatible.php#migration80.incompatible.iconv>
 [2021-11-21 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2022-02-06 10:30 UTC] omcoei at hi2 dot in
In PHP 8.1.2 ext iconv on Debian 11:

configure:4776: checking if iconv supports errno
configure:4805: cc -o conftest -I/usr/local/php8/include/php -I/usr/local/php8/include/php/main -I/usr/local/php8/include/php/TSRM -I/usr/local/php8/include/php/Zend -I/usr/local/php8/include/php/ext -I/usr/local/php8/include/php/ext/date/lib -I/usr/local/include -O3 -march=native   -Wl,-rpath,/usr/local/lib -L/usr/local/lib -liconv   -liconv conftest.c  >&5
/usr/bin/ld: /tmp/ccrQZSHA.o: in function `main':
conftest.c:(.text.startup+0x13): undefined reference to `libiconv_open'
/usr/bin/ld: conftest.c:(.text.startup+0x34): undefined reference to `libiconv_close'
collect2: error: ld returned 1 exit status
configure:4805: $? = 1
configure: program exited with status 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define HAVE_LIBICONV 1
| #define ICONV_ALIASED_LIBICONV 1
| #define HAVE_ICONV 1
| #define HAVE_GLIBC_ICONV 1
| #define PHP_ICONV_IMPL "glibc"
| /* end confdefs.h.  */
| 
| #include <iconv.h>
| #include <errno.h>
| 
| int main() {
|   iconv_t cd;
|   cd = iconv_open( "*blahblah*", "*blahblahblah*" );
|   if (cd == (iconv_t)(-1)) {
|     if (errno == EINVAL) {
|       return 0;
|   } else {
|       return 1;
|     }
|   }
|   iconv_close( cd );
|   return 2;
| }
| 
configure:4812: result: no
configure:4814: error: iconv does not support errno
 [2022-02-06 10:33 UTC] omcoei at hi2 dot in
Above was reproduced with GNU libiconv 1.16. 
PHP apparently does not happy with the iconv 2.31 which comes from the package manager.
 [2023-11-28 20:59 UTC] barney_cordoba at yahoo dot com
This error occurs in both FreeBSD 13.2-RELEASE and FreeBSD 14.0-RELEASE with the 8.3.0 dist. I've confirmed that the iconv lib sets errno

I have 1.17 loaded.

libiconv-1.17                  Character set conversion library

#include <stdio.h>
#include <iconv.h>
#include <errno.h>

int main(void) {
  iconv_t cd;

errno=0;
  cd = iconv_open( "*blahblah*", "*blahblahblah*" );
printf("errno:%d\n",errno);
}

#iconvtest
errno: 22
 [2024-03-29 20:36 UTC] lasse dot torngren at nebulosa dot se
0

I have trouble compiling php 8.2.16 and php 8.3.4 on Mac OS Ventura 13.6.6. The configure script does not recognize the GNU libiconv installed with Homebrew in /usr/local/opt/libiconv. I succeeded to compile and install php 8.2.14 as a CGI module on Mac OS Ventura 13.6.3 about two months ago. At the time the DIR for libiconv was accepted via with-iconv=DIR, even though the default had changed to include iconv. Now this parameter is not recognized any more, and neither seems to be the case for my environmental variables where I point to the important locations. So I get the result ”configure: error: iconv does not support errno” (which might be applicable to the Iconv v 1.11 shipped with the system). The installation of the GNU libiconv is ignored completely.
 [2024-04-19 19:15 UTC] bernhard dot schussek at webmozarts dot com
I ran into the same issue as my previous commenter on Mac OS Ventura today and managed to fix it. First, you can find the *actual* issue using:

$ grep -B 300 'iconv does not support errno' ~/.phpbrew/build/php-8.1.X/config.log

In my case, that was:

dyld[94019]: Library not loaded: @loader_path/../../../../opt/icu4c/lib/libicui18n.73.dylib
  Referenced from: <A564C714-959A-3F57-9FA4-8D4253388333> /usr/local/Cellar/libxml2/2.11.5/lib/libxml2.2.dylib

The reason was that my Homebrew formula libxml2 was not up to date, while the icu4c formula was already newer. The solution was as simple as:

$ brew upgrade libxml2
 [2024-07-21 22:57 UTC] cmb@php.net
If there are still issues compiling ext/iconv with any of the actively supported PHP versions[1], please file a bug report at <https://github.com/php/php-src/issues>.

[1] <https://www.php.net/supported-versions>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 08:01:28 2024 UTC