|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17269 compile problem with GD & JPEG support
Submitted: 2002-05-16 07:04 UTC Modified: 2002-05-17 01:25 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: jaco at welnet dot nl Assigned:
Status: Closed Package: GD related
PHP Version: 4.2.1 OS: FreeBSD 4.3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
13 - 8 = ?
Subscribe to this entry?

 [2002-05-16 07:04 UTC] jaco at welnet dot nl
when compiling PHP with GD & JPEG support i get a lot of errors with libjpeg.a moaning about 'multiple definitions' and 'first defined here' stuff.

system config:
FreeBSD 4.3
Apache 2.0.36
PHP 4.2.1

GD 1.8.4 (compiled ok with support for png, jpeg, freetype)
Jpeg 6B
Libpng 1.2.2
Gdbm 1.8.0
Pdflib 4.0.2
Freetype 2.1.0

./configure \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-config-file-path=/etc \
--enable-shared \
--enable-track-vars \
--enable-ftp \
--with-gdbm=/usr/local \
--with-gd=/usr/local/graph/gd \
--with-jpeg-dir=/usr/local/graph/jpeg \
--enable-gd-native-ttf \
--with-png-dir=/usr/local/graph/png \
--with-freetype-dir=/usr/local/graph/freetype2 \
--with-mysql=/usr/local \
--with-zlib-dir=/usr/local/graph/zlib \
--with-zlib \
--with-pdflib=/usr/local/graph/pdflib \
--with-tsrm-pth \

configure goes OK. all the functions are supported and no errors are given.

When i do a gmake i get this error:

/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

It goes on for about 50 of these jpeg_<functions>.
you can look at the complete error here:

The STRANGE thing is that if i leave apache2 support out (--with-apxs2) and compile it as a CGI-BINARY, i do not get errors and it compiles fine ?

thing i've tried:
-tried GD2.0.1 and gd 1.8.3 instead of gd 1.8.4

-did a system search for old jpeg/png/GD libraries. deleted them all and did a clean install for these packages 

-install the packages in standard directorys (/usr/lib and /usr/include etc), doesn't work either.

-tried php 4.1.0, php 4.2.0 and php 4.2.1

-searching bug database for similiar problem :)

-been busy googling for 4 days, yet to find no fix for this problem, only people that have the same problem and didnt
get an answer too.

THE thing that i don't understand is that if i leave apache support out and compile it as a cgi binary it gives no compile errors.



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-16 11:06 UTC]
First of all, thanks for this very extensive report... if only all reports where like this :)

I think the problem might be that libjpeg.a is a static library which is compiled in in both gd and libpdf, you might try a shared variant and see if this fixes it.

 [2002-05-16 13:09 UTC] jaco at welnet dot nl
just tried it: d57107# ./configure --enable-shared
checking if libtool supports shared libraries... no
checking whether to build shared libraries... no
checking whether to build static libraries... yes

libtool version 1.4.2.tar.gz 

for some reason jpeg won't compile as a shared library. tried to edit Makefile and change ./libtool to /usr/local/bin/libtool, but that doesn't make a difference, they are the same version.

can i change Makefile to build a shared library while configure says it can't?

and ideas?
 [2002-05-16 13:21 UTC] msopacua at idg dot nl
In the libtool script, check whether file_magic_cmd in the
freebsd* case statement lists '/usr/bin/file -L' instead of plain /usr/bin/file and change accordingly (it should be '/usr/bin/file -L').

Then try to recompile with shared support.
 [2002-05-16 19:20 UTC] jaco at welnet dot nl
Finally got it running! well, it's not a problem with PHP, but as Derick mentioned a shared library problem.

The issue with not building shared libraries happens with jpeg-6b and gdbm 1.8.0

I wasn't able to find the stuff mentioned in libtool, ltconfig or so i started a search on my own for a solution.

The problem is related to the version of ltconfig and, jpeg6b and gdbm are using. With this version, compiling shared libraries fails on FreeBSD 4.3(x?)

d57107# ./ltconfig --version
ltconfig (GNU libtool) 1.2

Forcing shared libraries in Makefile doesn't work either, 

It messes up the gcc -shared command jpeg is using and it fails to build the compile line in a good order (something with 'gcc -o ./libs' where ./libs should be an output file and not a directory?)

anyway the solution is to do a cp /usr/local/share/libtool/ltconfig ltconfig
and a 
cp /usr/local/share/libtool/

it 'updates' the old ltconfig, jpeg and gdbm are using too this version:
d57107# /usr/local/share/libtool/ltconfig --version
ltconfig (GNU libtool) 1.3.4-freebsd-ports (1.385.2.196 1999/12/07 21:47:57)

when you've done this and run confure/gmake, jpeg and gdbm are reporting some errors during compilation: 
'test: no: unexpected operator'

you can safely (?) ignore these, it does work.

and this is my new configure line, as you can see i added some packages:
./configure \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-config-file-path=/etc \
--enable-shared \
--enable-track-vars \
--enable-ftp \
--with-gdbm \
--with-gd \
--enable-gd-native-ttf \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-mysql=/usr/local \
--with-zlib-dir \
--with-zlib \
--with-pdflib \
--with-tsrm-pth \
--with-openssl \
--with-zip \
--with-snmp \
--with-tsrm-pth \

only have to rebuild php to update zlib to 1.1.4:

ZLib Support enabled 
Compiled Version 1.1.4 
Linked Version 1.1.3 

/me is very happy it works now :)

thank you all for the support!
 [2002-05-17 01:25 UTC]
Ok, closing then.

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Aug 18 20:05:44 2022 UTC