Edit report at https://bugs.php.net/bug.php?id=63138&edit=1
ID: 63138
Comment by: lullol at yopmail dot com
Reported by: lullol at yopmail dot com
Summary: dozens of implicit declarations in custom configure
tests
Status: Open
Type: Bug
Package: Compile Failure
Operating System: Linux
PHP Version: 5.4Git-2012-09-22 (Git)
Block user comment: N
Private report: N
New Comment:
oops, _cv_have_broken_glibc_fopen_append doesn't belong to this group, it is
broken in its own special way, in that it is triggered whenever you don't use
glibc.
Previous Comments:
------------------------------------------------------------------------
[2012-09-22 13:26:28] lullol at yopmail dot com
Description:
------------
basically all custom (i.e. written by php coders rather than autoconf authors)
configure checks use exit() but fail to include <stdlib.h> which defines this
function.
they use strcmp without including <string.h>
etc etc
so if your distro toolchain has -Werror-implicit-function-declaration baked in
(which is basically a very sane feature to use, because it will prevent broken
code generation on platforms where sizeof(int) != sizeof(void*), like amd64),
all these tests will fail, and either cause total build failure, cause
duplicated code to get pulled in, or build without some optional packages which
are misdetected as not existing.
examples include: (using the cache variable names of those tests)
_cv_have_broken_glibc_fopen_append
ac_cv_what_readdir_r
ac_cv_crypt_blowfish
ac_cv_crypt_md5
ac_cv_crypt_SHA256
ac_cv_crypt_SHA512
ac_cv_crypt_des
ac_cv_crypt_ext_des
ac_cv_pwrite
ac_cv_pread
the broken "what readdir_r" check will cause "old readdir_r" support code get
compiled, which fails to build because it is using an invalid prototype for
POSIX readdir_r.
to find all such issues automatically, it is recommended to use "CC=gcc -Werror-
implicit-function-declaration" ./configure, then grep config.log for "error:
implicit declaration"
additionally, musl libc should be used for this instead of glibc, because the
latter has numerous namespace issues. for example on glibc, including <stdio.h>
will automatically cause <stdlib.h> to get pulled in, thus hiding the issue
with
exit().
another approach is to manually go through all the custom tests, analyse which
functions are used and add the headers that define it according to the POSIX or
C spec.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63138&edit=1