php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18248 build problem after upgrade to GD2
Submitted: 2002-07-09 12:39 UTC Modified: 2002-07-11 21:58 UTC
From: nospam at 1111-internet dot com Assigned:
Status: Closed Package: GD related
PHP Version: 4.2.1 OS: FreeBSD 4.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nospam at 1111-internet dot com
New email:
PHP Version: OS:

 

 [2002-07-09 12:39 UTC] nospam at 1111-internet dot com
I am having a problem with the following php configuration after upgrading gd from version 1.8.3 to 2.0.1 (on FreeBSD 4.0 w/ PHP 4.2.1):

./configure \
    --prefix=/usr/local/php4 \
    --with-apxs=/usr/local/apache/bin/apxs \
    --with-mysql \
    --enable-track-vars \
    --with-gd=/usr/local \
    --with-zlib-dir=shared \
    --with-ttf \
    --with-jpeg-dir=shared \
    --with-png-dir=/usr/local \
    --with-tiff-dir=/usr/local \
    --with-mcrypt=/usr/local \
    --with-pdflib=/usr/local \
    --enable-ftp

Before the gd upgrade this compilation ran fine, but now the output stops at:

(...)
checking for mcrypt support... yes
checking for mcrypt_module_open in -lmcrypt... no
checking for init_mcrypt in -lmcrypt... no
configure: error: Sorry, I was not able to diagnose which libmcrypt version you have installed.

At first I took this as an mcrypt problem - which was counterintuitive since I'd never had such a problem before - but nonetheless I rebuilt mcrypt and tried again only to get the same error. Then I pulled --with-mcrypt out of the php configuration and got:

(...)
checking for the location of libpng... yes
checking for png_create_info_struct in -lpng... no
configure: error: libpng not found!

I've also never had a problem with the png library in the past... So I tried downgrading gd to the original version 1.8.3 and rebuilding php with the full configuration above - that worked. But it still leaves me without the newer gd features that I need...

A search through the bug database and research on the web did not give me a solution (other than trying --with-gd=php using the CVS version of php, which I'm very reluctant to do on a production server) - so I'm hoping the php experts here might be able to come up with one...

Thanks,
Chuck Hohn

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-09 14:27 UTC] nospam at 1111-internet dot com
I got some more clues from the tail of the config.log - which is included below. I had previously been having problems with the --with-jpeg-dir configure line when I recently upgraded from php 4.0.6 to 4.2.1 - whereby using --with-jpeg-dir=/usr/local started producing errors with multiple definitions of about 100 jpeg-related functions right at the end of the configure process, i.e.:

/usr/local/lib/libjpeg.a(jcapimin.o): In function `jpeg_CreateCompress':
jcapimin.o(.text+0x0): multiple definition of `jpeg_CreateCompress'
/usr/local/lib/libjpeg.a(jcapimin.o)(.text+0x0): first defined here
/usr/local/lib/libjpeg.a(jcapimin.o): In function `jpeg_destroy_compress':
jcapimin.o(.text+0x114): multiple definition of `jpeg_destroy_compress'
/usr/local/lib/libjpeg.a(jcapimin.o)(.text+0x114): first defined here
(...)

I figured that this was due to the fact that --with-jpeg-dir can apply to both gd and directly to the php configuration, so I changed the configuration to --with-jpeg-dir=shared, which made everything work ok - until the new mcrypt problems arose when I changed to gd 2.0.1. Reverting the configuration to --with-jpeg-dir=/usr/local with gd 2.0.1 gets me past the mcrypt problem but still runs into the multiple function definition problem which kills the build.

So I suspect that this whole thing might actually be a config issue with libjpeg...

Here's the aforementioned config.log tail:

(gd functions are tested and confirmed)
(...)
configure:34119: checking for mcrypt support
configure:34181: checking for mcrypt_module_open in -lmcrypt
configure:34200: gcc -o conftest -g -O2  -DMOD_SSL=208108 -DEAPI -DUSE_EXPAT 
    -L/usr/local/lib -lltdl
    -R/usr/local/lib -L/usr/local/lib conftest.c -lmcrypt  -lgd -lttf -lpng -lz -lz -lcrypt -lm  -lcrypt 1>&5
/usr/local/lib/libgd.so: undefined reference to `jpeg_read_scanlines'
/usr/local/lib/libgd.so: undefined reference to `jpeg_simple_progression'
/usr/local/lib/libgd.so: undefined reference to `jpeg_set_defaults'
/usr/local/lib/libgd.so: undefined reference to `jpeg_start_decompress'
/usr/local/lib/libgd.so: undefined reference to `jpeg_destroy'
/usr/local/lib/libgd.so: undefined reference to `jpeg_write_marker'
/usr/local/lib/libgd.so: undefined reference to `jpeg_destroy_decompress'
/usr/local/lib/libgd.so: undefined reference to `jpeg_std_error'
/usr/local/lib/libgd.so: undefined reference to `jpeg_CreateDecompress'
/usr/local/lib/libgd.so: undefined reference to `jpeg_read_header'
/usr/local/lib/libgd.so: undefined reference to `jpeg_start_compress'
/usr/local/lib/libgd.so: undefined reference to `jpeg_destroy_compress'
/usr/local/lib/libgd.so: undefined reference to `jpeg_finish_decompress'
/usr/local/lib/libgd.so: undefined reference to `jpeg_resync_to_restart'
/usr/local/lib/libgd.so: undefined reference to `jpeg_CreateCompress'
/usr/local/lib/libgd.so: undefined reference to `jpeg_finish_compress'
/usr/local/lib/libgd.so: undefined reference to `jpeg_set_quality'
/usr/local/lib/libgd.so: undefined reference to `jpeg_write_scanlines'
configure: failed program was:
#line 34189 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char mcrypt_module_open();

int main() {
mcrypt_module_open()
; return 0; }
configure:34321: checking for init_mcrypt in -lmcrypt
configure:34340: gcc -o conftest -g -O2  -DMOD_SSL=208108 -DEAPI -DUSE_EXPAT 
      -L/usr/local/lib
      -R/usr/local/lib -L/usr/local/lib conftest.c -lmcrypt  -lgd -lttf -lpng -lz -lz -lcrypt -lm  -lcrypt 1>&5
/usr/local/lib/libgd.so: undefined reference to `jpeg_read_scanlines'
/usr/local/lib/libgd.so: undefined reference to `jpeg_simple_progression'
/usr/local/lib/libgd.so: undefined reference to `jpeg_set_defaults'
/usr/local/lib/libgd.so: undefined reference to `jpeg_start_decompress'
/usr/local/lib/libgd.so: undefined reference to `jpeg_destroy'
/usr/local/lib/libmcrypt.so: undefined reference to `lt_dlerror'
/usr/local/lib/libgd.so: undefined reference to `jpeg_write_marker'
/usr/local/lib/libgd.so: undefined reference to `jpeg_destroy_decompress'
/usr/local/lib/libgd.so: undefined reference to `jpeg_std_error'
/usr/local/lib/libgd.so: undefined reference to `jpeg_CreateDecompress'
/usr/local/lib/libmcrypt.so: undefined reference to `lt_dlclose'
/usr/local/lib/libgd.so: undefined reference to `jpeg_read_header'
/usr/local/lib/libgd.so: undefined reference to `jpeg_start_compress'
/usr/local/lib/libgd.so: undefined reference to `jpeg_destroy_compress'
/usr/local/lib/libgd.so: undefined reference to `jpeg_finish_decompress'
/usr/local/lib/libgd.so: undefined reference to `jpeg_resync_to_restart'
/usr/local/lib/libgd.so: undefined reference to `jpeg_CreateCompress'
/usr/local/lib/libmcrypt.so: undefined reference to `lt_dlexit'
/usr/local/lib/libgd.so: undefined reference to `jpeg_finish_compress'
/usr/local/lib/libmcrypt.so: undefined reference to `lt_dlsetsearchpath'
/usr/local/lib/libmcrypt.so: undefined reference to `lt_dlopenext'
/usr/local/lib/libmcrypt.so: undefined reference to `lt_dlsym'
/usr/local/lib/libgd.so: undefined reference to `jpeg_set_quality'
/usr/local/lib/libgd.so: undefined reference to `jpeg_write_scanlines'
/usr/local/lib/libmcrypt.so: undefined reference to `lt_dlinit'
configure: failed program was:
#line 34329 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char init_mcrypt();

int main() {
init_mcrypt()
; return 0; }
 [2002-07-09 18:49 UTC] sniper@php.net
Does this happen with this snapshot:

http://snaps.php.net/php4-latest.tar.gz

And when NOT using --with-gd=php

 [2002-07-10 18:40 UTC] nospam at 1111-internet dot com
I tried all of the following combinations (plus the other config options indicated in my original report) using snapshot "php4-200207091500" and got the following results - none of which solve my original problem:

--with-gd=/usr/local, --with-jpeg-dir: Result A
--with-gd=/usr/local, --with-jpeg-dir=/usr/local: Result A
--with-gd=/usr/local, --with-jpeg-dir=shared: Result A
--with-gd=/usr/local, no --with-jpeg-dir: Result C
--with-gd=php, --with-jpeg-dir: Result A
--with-gd=php, --with-jpeg-dir=/usr/local: Result A
--with-gd=php, --with-jpeg-dir=shared: Result A
--with-gd=php, no --with-jpeg-dir: Result D
no --with-gd, --with-jpeg-dir: Result B
no --with-gd, --with-jpeg-dir=/usr/local: Result B
no --with-gd, --with-jpeg-dir=shared: Result B
no --with-gd, no --with-jpeg-dir: Result B

Result A:
stops at
jpeg function multiple definitions

Result B:
stops at
ext/mysql/libmysql/my_tempnam.lo: In function `my_tempnam':
/usr/local/src/php_src/php4-200207091500/ext/mysql/libmysql/my_tempnam.c(.text+0x51): warning: tempnam() possibly used unsafely; consider using mkstemp()
(I think this build is successful and this message is a warning only - but this only arises when --with-gd is not included)

Result C:
stops at
checking for mcrypt support... yes
checking for mcrypt_module_open in -lmcrypt... no
checking for init_mcrypt in -lmcrypt... no
configure: error: Sorry, I was not able to diagnose which libmcrypt version you have installed.
gmake: *** No targets specified and no makefile found.  Stop.

Result D:
stops at
ext/mysql/libmysql/my_tempnam.lo: In function `my_tempnam':
/usr/local/src/php_src/php4-200207091500/ext/mysql/libmysql/my_tempnam.c(.text+0x51): warning: tempnam() possibly used unsafely; consider using mkstemp()
ext/gd/gd.lo: In function `php_imagettftext_common':
/usr/local/src/php_src/php4-200207091500/ext/gd/gd.c(.text+0x9413): undefined reference to `gdttf'
gmake: *** [sapi/cli/php] Error 1
 [2002-07-10 21:39 UTC] sniper@php.net
First of all, these configure options: --with-zlib-dir and --with-jpeg-dir don't accept anything else but a path.
'shared' is not useful with these.

Second, did you clean up your system of all the
remains of the old GD before installing new version?

Then try with ONLY the GD related configure options.
(without mcrypt, pdflib, ftp)

 [2002-07-11 17:46 UTC] nospam at 1111-internet dot com
I think between your suggestions and some more sleuthing on my end I may have resolved this problem...

I had both an old libjpeg.a and a newer libjpeg.so in /usr/local/lib - the php config was favoring libjpeg.a which I think caused the problem with multiple definitions of jpeg functions as I cited earlier. Getting rid of the libjpeg.a and essentially forcing php to honor the inherently shared libjpeg.so allowed the build and install with my full desired configuration to go through successfully. I've yet to test the new gd functions, but I'm encouraged that they will work fine.

I might suggest that you change the build process to give precedence to lib<whatever>.so over lib<whatever>.a if both exist, rather than the other way around. I'd imagine it would save a lot of people a lot of headaches.

Otherwise feel free to close this bug.

Thanks much!

Chuck
 [2002-07-11 21:58 UTC] sniper@php.net
The precedence actually _is_ to use .so before .a, IIRC.

Anyway, having different versions of same library (be it static/shared) in libpath is always a headache which is almost impossible to detect. And sysadmins should be aware
of this too..



 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Sep 24 10:03:36 2021 UTC