php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63138 dozens of implicit declarations in custom configure tests
Submitted: 2012-09-22 13:26 UTC Modified: -
Votes:8
Avg. Score:4.8 ± 0.4
Reproduced:8 of 8 (100.0%)
Same Version:1 (12.5%)
Same OS:6 (75.0%)
From: lullol at yopmail dot com Assigned:
Status: Open Package: Compile Failure
PHP Version: 5.4Git-2012-09-22 (Git) OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2012-09-22 13:26 UTC] 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.




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-09-22 22:47 UTC] lullol at yopmail dot com
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.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Oct 22 13:01:29 2019 UTC