php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29362 _libiconv_version' undeclared
Submitted: 2004-07-24 01:50 UTC Modified: 2004-08-09 01:00 UTC
Votes:6
Avg. Score:4.0 ± 1.4
Reproduced:6 of 6 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: webmaster at path dot org Assigned:
Status: No Feedback Package: Compile Failure
PHP Version: 5.0.0 OS: RedHat Linux Enterprise 3
Private report: No CVE-ID: None
 [2004-07-24 01:50 UTC] webmaster at path dot org
Description:
------------
"`_libiconv_version' undeclared" prevents compile (gcc version 3.2.3 20030502)



Reproduce code:
---------------
libiconv-1.9.2
./configure --prefix=/usr/local/

libxml2-2.6.5
./configure --prefix=/usr/local/ --with-zlib=/usr/local/ --with-iconv=/usr/local/

libxslt-1.1.2
./configure --prefix=/usr/local/ --with-libxml-prefix=/usr/local/  --with-libxml-include-prefix=/usr/local/lib/ --with-libxml-libs-prefix=/usr/local/lib/

php-5.0.0
./configure --prefix=/usr/local --with-apxs2=/usr/sbin/apxs  --with-ming=/usr/local --with-gd --with-png-dir=usr/local --enable-gd-native-ttf --with-xml --with-libxml-dir=/usr/local --with-expat-dir=/usr/local/lib --with-dom=/usr/local --enable-ftp --with-mysql=/usr/local --enable-shared=yes --enable-static=yes --with-xsl=/usr/local --enable-track-vars --enable-sockets --enable-wddx --with-xmlrpc --with-zlib-dir=/usr/local/include --with-iconv-dir=/usr/local/ --with-mssql=/usr/local/freetds --enable-msdblib

Expected result:
----------------
Compilation

Actual result:
--------------
Does not compile. Generates following error:

/home/webadmin/php-5.0.0/ext/iconv/iconv.c: In function `zm_startup_miconv':
/home/webadmin/php-5.0.0/ext/iconv/iconv.c:191: `_libiconv_version' undeclared (first use in this function)
/home/webadmin/php-5.0.0/ext/iconv/iconv.c:191: (Each undeclared identifier is reported only once
/home/webadmin/php-5.0.0/ext/iconv/iconv.c:191: for each function it appears in.)
make: *** [ext/iconv/iconv.lo] Error 1


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-29 11:09 UTC] tony2001@php.net
Please, check that your /usr/local/include/iconv.h is not broken.
This variable is defined there and should exist in all versions of libiconv since 2000-12-01.
 [2004-08-09 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2004-08-24 17:23 UTC] adamolszewski at op dot pl
Propably one of the most lame way to fix this but it works (almost perfectly). I copied iconv.h from /usr/local/include/iconv.h to /usr/include/iconv.h These two versions were different on my machine. After switching, compilation went almost OK - there were some warnings, but PHP compiled and iconv works OK.
 [2004-08-29 04:30 UTC] sembiance at cosmicrealms dot com
I too got this bug, with PHP 4.3.8

I fixed it though.
The problem was I had --with-iconv --with-iconv-dir=/usr/local
in my configure line.

I dropped the first --with-iconv and kept just --with-iconv-dir=/usr/local

Did a configure, make and this time no errors.
 [2004-10-16 07:11 UTC] zac at zacbowling dot com
I got the same issue, but I was able to fix it by moving my iconv.h header like previously stated. I'm using a modified version of Debian "Woody" and PHP 5.0.2 with updated libraries similar to bug report. 

libiconv-1.9.2, libxml2-2.6.7, and libxslt-1.1.2. 

Zac Bowling
 [2005-12-09 18:56 UTC] ksvee at usit dot uio dot no
Used a few hours trying to debug this in my build of PHP-5.1.1. The problem seems to exist when having installed libiconv on a linux-box that also support iconv in its glibc (such as RedHat Enterprise WS 3.x). 

If you have libiconv installed under /usr/local, try giving configure "--with-iconv=/usr/local" for it to link against that version (assuming iconv.h is found under /usr/local/include).

The configure script checks for iconv-support around line 44061, but the "--with-iconv-dir" doesn't get checked before somewhere around line 95498, and is only used for XMLRPC-EPI, not to compile ext/iconv/iconv.c.

For the binaries to link correctly (we use non-standard paths for our builds), you might have to specify the proper CPPFLAGS and LDFLAGS as well, e.g:

  CPPFLAGS="-I/path/to/include" \
  LDFLAGS="-L/path/to/lib -Wl,-rpath,/path/to/lib"

(or '-R' instead of '-Wl,-rpath' depending on arch).

Kenneth Svee
 [2017-11-30 01:24 UTC] peterkokot at gmail dot com
Hello, bumping this bug. This is still present in current PHP versions >= 7.0 

The _libiconv_version variable is not defined in the GNU libiconv header file but it's only declared there. This is a built header on Linux systems of GNU Libiconv 1.15, for example:


#define _LIBICONV_VERSION 0x010F    /* version number: (major<<8) + minor */
extern  int _libiconv_version; /* Likewise */


Note, that _libiconv_version variable is set as a DLL one for Windows systems. For example, file gnu-libiconv-1.15/include/iconv.h.in:

#define _LIBICONV_VERSION 0x010F    /* version number: (major<<8) + minor */
extern @DLL_VARIABLE@ int _libiconv_version; /* Likewise */


So, therefore the warning and error. Checking this out if it can be fixed simply and in some reasonable time.
 [2018-02-11 17:19 UTC] broly at mac dot com
hey peter, 

i think i have a solution. i ran into this problem on my machine and it seemed that the issue was the path of the header file wasn't being encoded by configure correctly.

adding  PHP_ICONV_PREFIX=<PATH OF ICONV-DIR> as an argument to configure fixed the issue (the problem is that without this variable, the php_php_iconv_h or whatever the file is named (in ext/iconv) does not encode the path properly.

adding this variable should solve the issue (in addition to the --iconv-dir) should work

hope this helps!
 [2018-06-28 23:20 UTC] peterkokot at gmail dot com
I'm just confirming that this works ok. When GNU Libiconv library is used (there is no iconv.h from the glibc present), the configure step is done with:

./configure --with-iconv=/path/to/gnu-libiconv

and the GNU libiconv version works correctly. Such error might happen more due to the conflicts of Glibc iconv and the gnu libiconv headers present. Maybe the check should be better done for some systems but I think it's not PHP's fault here.

In case someone will have same issue.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC