php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36110 ./configure fails when checking for gd, gdImageCreate
Submitted: 2006-01-20 21:17 UTC Modified: 2006-01-20 22:58 UTC
From: ifette at gmail dot com Assigned:
Status: Closed Package: Compile Failure
PHP Version: 6CVS-2006-01-20 (CVS) OS: Linux 2.6.14-gentoo-r2 #2 SMP PR
Private report: No CVE-ID: None
 [2006-01-20 21:17 UTC] ifette at gmail dot com
Description:
------------
When trying to run ./configure, configure fails when checking for the presence of libgd.

checking for gdImageCreate in -lgd... no
configure: error: GD build test failed. Please check the config.log for details. (I only get this error when using --with-gd=/usr. If I use the built-in gd, it compiles).

The problem appears to be the code that the configure script is using: It tries to execute:
gcc -o conftest -g -O2  -Wl,-rpath, -L  conftest.c -lgd  -lcurl -lbz2 -lz -lresolv -lm -ldl -lnsl  -lm -licui18n -licuuc -licudata -lm -licuio -lxml2 -lz -lm -lssl -lcrypto -ldl -lcurl -lidn -lssl -lcrypto -ldl -lz -lxml2 -lz -lm -lgd 1>&5

The -L there is causing a huge  problem. The failure is 
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/../../../crt1.o: In function `_start':
init.c:(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status

If the -L is removed (or a path is added after -L), then everything compiles fine.

Reproduce code:
---------------
./configure --prefix=/nonportage/php --with-openssl --with-zlib --with-bz2
--with-gd=/usr --with-mcrypt --with-mysqli=/nonportage/mysql/bin/mysql_config
--with-apxs2=/usr/sbin/apxs2 --enable-mbstring --with-curl
--with-mysql=/nonportage/mysql

Expected result:
----------------
I expect it to complete configure :-)

Actual result:
--------------
configure:34794: checking for gdImageCreate in -lgd
configure:34813: gcc -o conftest -g -O2  -Wl,-rpath, -L  conftest.c -lgd  -lcurl -lbz2 -lz -lresolv -lm -ldl -lnsl  -lm -licui18n -licuuc -licudata -lm -licuio -lxml2 -lz -lm -lssl -lcrypto -ldl -lcurl -lidn -lssl -lcrypto -ldl -lz -lxml2 -lz -lm -lgd 1>&5
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/../../../crt1.o: In function `_start':
init.c:(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
configure: failed program was:
#line 34802 "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 gdImageCreate();

int main() {
gdImageCreate()
; return 0; }


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-20 22:35 UTC] sniper@php.net
It might have had, but seems like there's a tiny buglet in here after all. I'm working on a fix right now..

This would have worked fine if you had passed --with-gd what it's expecting: full path to gdlib-config.

 [2006-01-20 22:40 UTC] ifette at gmail dot com
Hmm... I seem to have failed to notice that this changed from 5 to 6 :-). One thing I always hated about the gnu build tools was having to dig around in ./configure --help for such things. I guess I'm not sure if this really qualifies as a bug, but it would be nice if there was at least a warning for users unaware of the change from 5->6.
 [2006-01-20 22:58 UTC] sniper@php.net
I added some sanity checks for the passed path.
This has changed since we require the latest GD library which comes with this nice script which makes it a lot easier to check what features are enabled in the installed library.

Fixed in CVS -> closed.

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Dec 20 12:00:02 2025 UTC