php / php/php-src

configure does not detect GNU libiconv correctly

Ouverte
#12,213 15 commentaires 1 réaction 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Bug Category: Build System Status: Needs Triage
Langage dominant
C
Étoiles
40.4k
Forks
8.1k
Merge moyen
2 j 13 h
PR mergées (30 j)
96

Description

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

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par les vérifications de détection de configure pour iconv décrites dans l’issue et comparez le test de GNU libiconv avec la commande de lien conftest montrée. Reproduisez l’échec dans Termux, puis vérifiez que GNU libiconv est reconnu et que les indicateurs du linker requis sont inclus sans provoquer l’échec de la vérification de errno.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
c
Domaine
build-system
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.