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: 2021-08-29 04:39 UTC
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: cmb (profile)
Status: Closed Package: Compile Failure
PHP Version: 5.4Git-2012-09-22 (Git) OS: Linux
Private report: No CVE-ID: None
 [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.
 [2021-08-19 14:55 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-08-19 14:55 UTC] cmb@php.net
It seems to me that has been fixed in the meantime, or are there
still some issues to resolve?
 [2021-08-29 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2021-08-29 04:39 UTC] requinix@php.net
-Status: No Feedback +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 08:01:28 2024 UTC