php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56898 incorrect inclusion/detection of PHP iconv extension header files
Submitted: 2006-03-18 11:00 UTC Modified: 2006-03-19 05:31 UTC
From: zaa at zaa dot pp dot ru Assigned: mike (profile)
Status: Closed Package: pecl_http (PECL)
PHP Version: 5.1.1 OS: FreeBSD 6.1
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: zaa at zaa dot pp dot ru
New email:
PHP Version: OS:

 

 [2006-03-18 11:00 UTC] zaa at zaa dot pp dot ru
Description:
------------
Extension fails to compile on FreeBSD 6.1 system.
Most probably due to the fact that it does not run PHP_SETUP_ICONV macro in config.m4

% php -v
PHP 5.1.2 (cli) (built: Feb 11 2006 00:24:20)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
% uname -mrs
FreeBSD 6.1-PRERELEASE i386
% phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20050922
Zend Extension Api No:   220051025
% ./configure --enable-http --with-iconv=/usr/local --with-iconv-dir=/usr/local --with-php-config=/usr/local/bin/php-config --with-http-curl-requests=/usr/local --with-http-magic-mime=
/usr/local --with-http-zlib-compression --prefix=/usr/local
checking for egrep... grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking whether gcc and cc understand -c and -o together... yes
checking if compiler supports -R... yes
checking build system type... i386-unknown-freebsd6.1
checking host system type... i386-unknown-freebsd6.1
checking target system type... i386-unknown-freebsd6.1
checking for PHP prefix... /usr/local
checking for PHP includes... -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext
checking for PHP extension directory... /usr/local/lib/php/20050922
checking for PHP installed headers prefix... /usr/local/include/php
checking for re2c... no
configure: WARNING: You will need re2c 0.9.11 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking whether to enable extended HTTP support... yes, shared
checking whether to enable cURL HTTP request support... /usr/local
checking whether to enable zlib encodings support... yes
checking whether to enable response content type guessing... /usr/local
checking for egrep... (cached) grep -E
checking for a sed that does not truncate output... (cached) /usr/bin/sed
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking for unistd.h... (cached) yes
checking for zlib.h... found in /usr
checking for zlib version >= 1.2.0.4... 1.2.2
checking for curl/curl.h... found in /usr/local
checking for curl-config... found: /usr/local/bin/curl-config
checking for curl version >= 7.12.3... 7.15.1
checking for SSL support in libcurl... yes
checking for SSL library used... openssl
checking openssl/crypto.h usability... yes
checking openssl/crypto.h presence... yes
checking for openssl/crypto.h... yes
checking for curl_multi_strerror in -lcurl... yes
checking for curl_easy_strerror in -lcurl... yes
checking for curl_easy_reset in -lcurl... yes
checking for magic.h... found in /usr
checking for ext/hash support... disabled
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognise dependent libraries... pass_all
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking the maximum length of command line arguments... 196608
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if gcc static flag  works... yes
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... yes
checking dynamic linker characteristics... freebsd6.1 ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by g++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC
checking if g++ PIC flag -fPIC works... yes
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... freebsd6.1 ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
configure: creating ./config.status
config.status: creating config.h

%make 

[skipped]

/usr/local/bin/bash /u/zaa/dev/pecl_http-0.25.0/libtool --mode=compile gcc  -I. -I/u/zaa/dev/pecl_http-0.25.0 -DPHP_ATOM_INC -I/u/zaa/dev/pecl_http-0.25.0/include -I/u/zaa/dev/pecl_h
ttp-0.25.0/main -I/u/zaa/dev/pecl_http-0.25.0 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/
php/ext -I/usr/local/include  -DHAVE_CONFIG_H  -g -O2   -c /u/zaa/dev/pecl_http-0.25.0/http_querystring_object.c -o http_querystring_object.lo
 gcc -I. -I/u/zaa/dev/pecl_http-0.25.0 -DPHP_ATOM_INC -I/u/zaa/dev/pecl_http-0.25.0/include -I/u/zaa/dev/pecl_http-0.25.0/main -I/u/zaa/dev/pecl_http-0.25.0 -I/usr/local/include/php
-I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /u/zaa/dev/pecl_
http-0.25.0/http_querystring_object.c  -fPIC -DPIC -o .libs/http_querystring_object.o
In file included from /u/zaa/dev/pecl_http-0.25.0/http_querystring_object.c:25:
/usr/local/include/php/ext/iconv/php_iconv.h:36:38: ext/iconv/php_have_iconv.h: No such file or directory
/usr/local/include/php/ext/iconv/php_iconv.h:37:41: ext/iconv/php_have_libiconv.h: No such file or directory
/usr/local/include/php/ext/iconv/php_iconv.h:38:44: ext/iconv/php_have_glibc_iconv.h: No such file or directory
/usr/local/include/php/ext/iconv/php_iconv.h:39:42: ext/iconv/php_have_bsd_iconv.h: No such file or directory
/usr/local/include/php/ext/iconv/php_iconv.h:40:48: ext/iconv/php_iconv_supports_errno.h: No such file or directory
/usr/local/include/php/ext/iconv/php_iconv.h:41:42: ext/iconv/php_php_iconv_impl.h: No such file or directory
/usr/local/include/php/ext/iconv/php_iconv.h:42:44: ext/iconv/php_php_iconv_h_path.h: No such file or directory
*** Error code 1

Stop in /usr/home/zaa/dev/pecl_http-0.25.0.

% ls -l /usr/local/include/php/ext/iconv/
total 6
-r--r--r--  1 root  wheel   319 Feb 11 00:43 config.h
-r--r--r--  1 root  wheel  3568 Feb 11 00:43 php_iconv.h
% cat /usr/local/include/php/ext/iconv/config.h
#define COMPILE_DL_ICONV 1
#define HAVE_DLFCN_H 1
#define HAVE_ICONV 1
#define HAVE_INTTYPES_H 1
#define HAVE_LIBICONV 1
#define HAVE_MEMORY_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRINGS_H 1
#define HAVE_STRING_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_UNISTD_H 1

php_iconv.h has the following lines:

#ifdef PHP_ATOM_INC
#include "ext/iconv/php_have_iconv.h"
#include "ext/iconv/php_have_libiconv.h"
#include "ext/iconv/php_have_glibc_iconv.h"
#include "ext/iconv/php_have_bsd_iconv.h"
#include "ext/iconv/php_iconv_supports_errno.h"
#include "ext/iconv/php_php_iconv_impl.h"
#include "ext/iconv/php_php_iconv_h_path.h"
#endif

As far as I understod the php_have_*, etc files are created by PHP_SETUP_ICONV macro, but it is not called by the extension (as, for example, ext/xmlrpc does), thus the files do not get created and are not included during compilation.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-18 12:11 UTC] mike@php.net
You said "most probably".  Does putting PHP_SETUP_ICONV into config.m4 fix the issue for you?

I'm a bit surprised that you specify iconv configure flags when building the http extension as it uses ext/iconv and not directly libiconv or libc.

Did you build PHP from source yourself?  I have those iconv headers in PHPs include directory:

mike@honeybadger:~$ ls /usr/local/include/php/ext/iconv/
php_have_bsd_iconv.h    php_have_libiconv.h         php_php_iconv_h_path.h
php_have_glibc_iconv.h  php_iconv.h                 php_php_iconv_impl.h
php_have_iconv.h        php_iconv_supports_errno.h


Thanks
 [2006-03-18 13:38 UTC] zaa at zaa dot pp dot ru
>I'm a bit surprised that you specify iconv configure flags when building
> the http extension as it uses ext/iconv and not directly libiconv or
libc.

You may ignore --with-iconv options, I've added them just for test

>Did you build PHP from source yourself?
> I have those iconv headers in
PHPs include directory:

mike@honeybadger:~$ ls /usr/local/include/php/ext/iconv/
php_have_bsd_iconv.h    php_have_libiconv.h        
php_php_iconv_h_path.h
php_have_glibc_iconv.h  php_iconv.h                
php_php_iconv_impl.h
php_have_iconv.h        php_iconv_supports_errno.h

Iconv extension has been installed from FreeBSD ports system  (/usr/ports/converters/php5-iconv/). I tried to build PHP from source on my own, performed further investigation and found out that those 
php_have_* files are created in ext/iconv and copied into include/php/ext/iconv/ folder only if iconv extension is installed as part of PHP build process (when you compile php and configure PHP with "--with-iconv" arg). But when you install the extension after php is installed using

tar xvfz php-5.1.2.tar.bz2
cd <php-src>/ext/iconv
phpize
./configure
make install

method, then the files are not created and do not get copied into
 include/php/ext/iconv/ folder.
So I am not sure if this a PHP engine bug or not (that in case of phpize/configure/make install php_have_* files are not copied into include/php/ext/iconv).
Do you have any suggestions regarding this matter?
 [2006-03-18 14:49 UTC] mike@php.net
Thanks for the investigation.

Does installing pecl/http work if you put that PHP_SETUP_ICONV thingy into pecl/http's config.m4?
 [2006-03-18 15:09 UTC] zaa at zaa dot pp dot ru
I've just tried to add the following lines

  PHP_SETUP_ICONV(DUMMY, [], [
    AC_MSG_ERROR([iconv not found, in order to build pecl_http you need the iconv library])
  ])

below

if test "$PHP_HTTP" != "no"; then

and that fixed the issue with compilation for me. However, I am not sure if this is a correct way to resolve the issue.
 [2006-03-18 18:07 UTC] mike@php.net
Could you please also try if the following would work:

In the file http_querystring_object.c put

#undef PHP_ATOM_INC

below the line with

#ifdef HAVE_ICONV

so that the regarding section looks like

#ifdef HAVE_ICONV
#	undef PHP_ATOM_INC
#	include "ext/standard/url.h"
#	include "ext/iconv/php_iconv.h"
#endif

Thank you very much.
 [2006-03-18 19:30 UTC] zaa at zaa dot pp dot ru
Yes, this also resolves the issue.
Thank you.
 [2006-03-19 05:31 UTC] mike@php.net
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 04 22:01:27 2024 UTC