php / php/php-src

configure does not detect GNU libiconv correctly

Abierto
#12,213 15 comentarios 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Bug Category: Build System Status: Needs Triage
Lenguaje dominante
C
Estrellas
40.4k
Forks
8.1k
Merge medio
2 d 13 h
PR fusionados (30 d)
96

Descripción

Description

The following code:

I am running configure for compiling php 8.2.8 and, when checking if libiconv is available, I get this error message:

checking for mhash support... no
checking size of long... (cached) 8
checking if we're at 64-bit platform... yes
checking for iconv support... yes
checking for iconv... yes
checking if iconv is glibc's... no
checking if using GNU libiconv... no
checking if iconv is Konstantin Chuguev's... no
checking if using IBM iconv... no
checking if iconv supports errno... no
configure: error: iconv does not support errno

The final error message, about errno, is not really correct, since it is derived from all iconv preceeding lines failing. It seems that my iconv is not glibc, nor GNU, nor Chuguev, nor IBM. But my iconv installation is the GNU one, as shown here:

~ $ iconv --version
iconv (GNU libiconv 1.17)
Copyright (C) 2000-2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Bruno Haible.

So, since no iconv is detected, the linker does not add -liconv parameter, and the next conftest, the one about errno, fails because of link error:

configure:44279: checking if iconv supports errno
configure:44309: cc -o conftest  -I/data/data/com.termux/files/home/.termux-build/php/host-build/ext/date/lib -I/data/data/com.termux/files/home/.termux-build/php/src/ext/date/lib -g -O2 -fvisibility=hidden  -D_GNU_SOURCE   conftes
t.c -lrt -lm  >&5
ld.lld: error: undefined symbol: libiconv_open
>>> referenced by conftest.c:230
>>>               /data/data/com.termux/files/usr/tmp/conftest-a89be2.o:(main)

ld.lld: error: undefined symbol: libiconv_close
>>> referenced by conftest.c:238
>>>               /data/data/com.termux/files/usr/tmp/conftest-a89be2.o:(main)
clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
configure:44309: $? = 1
configure: program exited with status 1
configure: failed program was:
[...]
| #define HAVE_UTIMES 1
| #define HAVE_STRNDUP 1
| #define SIZEOF_LONG 8
| #define HAVE_ICONV 1
| /* 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:44317: result: no

Please note that there are no issues when looking for the iconv.h include file.

If I call the compiler manually, with same parameters plus -liconv then build and link are fine.

Resulted in this output:

checking for mhash support... no
checking size of long... (cached) 8
checking if we're at 64-bit platform... yes
checking for iconv support... yes
checking for iconv... yes
checking if iconv is glibc's... no
checking if using GNU libiconv... no
checking if iconv is Konstantin Chuguev's... no
checking if using IBM iconv... no
checking if iconv supports errno... no
configure: error: iconv does not support errno

But I expected this output instead:

Well, I suppose that GNU libiconv test should not fail, at very lest.

checking for mhash support... no
checking size of long... (cached) 8
checking if we're at 64-bit platform... yes
checking for iconv support... yes
checking for iconv... yes
checking if iconv is glibc's... no
checking if using GNU libiconv... yes
checking if iconv is Konstantin Chuguev's... no
checking if using IBM iconv... no
checking if iconv supports errno... no
PHP Version

8.2.8

Operating System

termux 0.118.0

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con las comprobaciones de detección de iconv de configure descritas en el issue y compara la prueba de GNU libiconv con el comando de enlace de conftest mostrado. Reproduce el fallo de Termux y, después, verifica que GNU libiconv se reconoce y que se incluyen las opciones del enlazador necesarias sin hacer que falle la comprobación de errno.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
c
Área
build-system
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.