|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9512 Apache fails linking due to incorrect PHP lib ordering
Submitted: 2001-03-01 14:49 UTC Modified: 2001-06-07 03:40 UTC
From: sitz at onastick dot net Assigned:
Status: Closed Package: GD related
PHP Version: 4.0.4pl1 OS: Solaris 2.6
Private report: No CVE-ID: None
 [2001-03-01 14:49 UTC] sitz at onastick dot net
PHP is configured thusly:

./configure \
  --enable-versioning \
  --with-apache=../apache_1.3.19 \
  --with-config-file-path=/etc \
  --with-ftp \
  --with-gd=/shared \
  --with-tiff-dir=/shared/lib \
  --with-jpeg-dir \
  --with-mysql=/local \
  --with-xml \
  --with-zlib=/shared \
  --with-pdflib=/shared/lib \
  --enable-safe-mode \
  --enable-track-vars \
  --enable-force-cgi-redirect \
  --enable-memory-limit \
  --enable-sysvsem \
  --enable-sysvshm \
  --with-gdbm=/shared \
  --with-db2=/shared \

PHP compiles and installs successfully.

Apache is configured thusly:

./configure \
--prefix=/shared/apache \
--exec-prefix=/shared/apache \
--bindir=/shared/apache/bin \
--sbindir=/shared/apache/sbin \
--mandir=/shared/apache/man \
--sysconfdir=/shared/apache/conf \
--logfiledir=/shared/apache/logs \
--runtimedir=/shared/apache/logs \
--libexecdir=/shared/apache/libexec \
--localstatedir=/shared/apache/logs \
--activate-module=src/modules/perl/libperl.a \
--activate-module=src/modules/php4/libphp4.a \
--enable-module=access \
--disable-module=actions \
--enable-module=alias \
--enable-module=asis \
--enable-module=auth \
--enable-module=auth_anon \
--enable-module=auth_db \
--enable-module=auth_dbm \
--enable-module=autoindex \
--enable-module=cern_meta \
--enable-module=cgi \
--enable-module=dir \
--enable-module=env \
--enable-module=expires \
--enable-module=headers \
--disable-module=imap \
--enable-module=include \
--disable-module=info \
--enable-module=log_config \
--enable-module=mime \
--disable-module=mime_magic \
--disable-module=mmap_static \
--enable-module=negotiation \
--enable-module=rewrite \
--enable-module=setenvif \
--disable-module=so \
--enable-module=speling \
--enable-module=status \
--disable-module=userdir \
--enable-module=unique_id \
--enable-module=usertrack \
--enable-suexec \
--suexec-caller=apache \
--suexec-docroot=/htdocs \
--suexec-logfile=/logs/suexec_log \
--suexec-safepath=/bin:/usr/bin:/usr/local/bin \
--suexec-uidmin=1000 \

When compiing apache, the following error appears:

Undefined                       first referenced
 symbol                             in file
png_set_strip_16                    /shared/lib/libgd.a(gd_png.o)
png_set_read_fn                     /shared/lib/libgd.a(gd_png.o)
png_create_write_struct             /shared/lib/libgd.a(gd_png.o)
png_create_read_struct              /shared/lib/libgd.a(gd_png.o)
png_set_tRNS                        /shared/lib/libgd.a(gd_png.o)
png_write_end                       /shared/lib/libgd.a(gd_png.o)
png_get_PLTE                        /shared/lib/libgd.a(gd_png.o)
png_read_end                        /shared/lib/libgd.a(gd_png.o)
png_set_packing                     /shared/lib/libgd.a(gd_png.o)
png_read_info                       /shared/lib/libgd.a(gd_png.o)
png_write_image                     /shared/lib/libgd.a(gd_png.o)
png_destroy_write_struct            /shared/lib/libgd.a(gd_png.o)
png_check_sig                       /shared/lib/libgd.a(gd_png.o)
png_set_dither                      /shared/lib/libgd.a(gd_png.o)
png_get_IHDR                        /shared/lib/libgd.a(gd_png.o)
png_get_rowbytes                    /shared/lib/libgd.a(gd_png.o)
png_set_strip_alpha                 /shared/lib/libgd.a(gd_png.o)
png_read_update_info                /shared/lib/libgd.a(gd_png.o)
png_create_info_struct              /shared/lib/libgd.a(gd_png.o)
png_set_IHDR                        /shared/lib/libgd.a(gd_png.o)
png_write_info                      /shared/lib/libgd.a(gd_png.o)
png_set_write_fn                    /shared/lib/libgd.a(gd_png.o)
png_get_io_ptr                      /shared/lib/libgd.a(gd_png.o)
png_read_image                      /shared/lib/libgd.a(gd_png.o)
png_destroy_read_struct             /shared/lib/libgd.a(gd_png.o)
png_get_error_ptr                   /shared/lib/libgd.a(gd_png.o)
png_set_sig_bytes                   /shared/lib/libgd.a(gd_png.o)
png_get_valid                       /shared/lib/libgd.a(gd_png.o)
png_get_tRNS                        /shared/lib/libgd.a(gd_png.o)
png_set_PLTE                        /shared/lib/libgd.a(gd_png.o)
ld: fatal: Symbol referencing errors. No output written to httpd

The problem lies in the order of the libs passed to the linker. This is a partial snippet of what is passed:

-lmodphp4  -lpam  -ldl -lz -lmysqlclient -lpng -lz -lgd -ljpeg

The solaris linker (/usr/ccs/bin/ld) needs -lpng to be to the right of -lgd in order to complete the linking. If I change the above to:

-lmodphp4  -lpam  -ldl -lz -lmysqlclient -lgz -lpng -lz -ljpeg

Linking succeeds with no issues.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-16 20:50 UTC]
Does this happen with latest CVS snapshot from ??


 [2001-03-17 00:16 UTC] sitz at onastick dot net
Yep. Same error, same place. Same fix required to link (except I typoed my damn fix in the previous message and justnow noticed. This is what I get for filing bug reports when I'm half asleep. :\  )


-lmodphp4  -lpam  -ldl -lz -lmysqlclient -lpng -lz -lgd -ljpeg

needs to be chang to this:

-lmodphp4  -lpam  -ldl -lz -lmysqlclient -lgd -lpng -lz -ljpeg

...or something similar.

 [2001-06-03 07:04 UTC]
This should be fixed in PHP 4.0.6. Please try the latest
release candidate from here:


 [2001-06-07 03:40 UTC] sitz at onastick dot net
Confirmed on this end. Thanks.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 14 18:01:30 2024 UTC