• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3068
  • Last Modified:

Compiling GD with PHP

I grabbed the latest GD source and compiled it using

make; make install;

then I reconfigured PHP using this line

./configure --with-mysql=/usr/local/mysql --with-config-file-path=/www/conf --with-apache=../httpd -enable-track-vars --with-gd=/path/to/gd

followed by a make; make install. This worked ok and I got no errors. then I went to my apache directory and recompiled that to use the new php module, so I did

cd /path/to/apache
make

this is where I got the errors

/usr/local/etc/php/ext/gd/gd_ctx.c:61: undefined reference to `gdNewFileCtx'
modules/php4/libphp4.a(gd.o): In function `php_if_imagesetstyle':
/usr/local/etc/php/ext/gd/gd.c:552: undefined reference to `gdImageSetStyle'
modules/php4/libphp4.a(gd.o): In function `php_if_imagesettile':
/usr/local/etc/php/ext/gd/gd.c:916: undefined reference to `gdImageSetTile'
modules/php4/libphp4.a(gd.o): In function `php_if_imagesetbrush':
/usr/local/etc/php/ext/gd/gd.c:942: undefined reference to `gdImageSetBrush'
modules/php4/libphp4.a(gd.o): In function `php_if_imagecreate':
/usr/local/etc/php/ext/gd/gd.c:967: undefined reference to `gdImageCreate'
modules/php4/libphp4.a(gd.o): In function `_php_image_create_from_string':
/usr/local/etc/php/ext/gd/gd.c:1032: undefined reference to `gdNewDynamicCtx'
modules/php4/libphp4.a(gd.o): In function `php_if_imagecreatefromstring':
/usr/local/etc/php/ext/gd/gd.c:1074: undefined reference to `gdImageCreateFromJpegCtx'
/usr/local/etc/php/ext/gd/gd.c:1083: undefined reference to `gdImageCreateFromPngCtx'
/usr/local/etc/php/ext/gd/gd.c:1101: undefined reference to `gdImageCreateFromWBMPCtx'
modules/php4/libphp4.a(gd.o): In function `_php_image_create_from':
/usr/local/etc/php/ext/gd/gd.c:1181: undefined reference to `gdNewDynamicCtx'
modules/php4/libphp4.a(gd.o): In function `php_if_imagecreatefromjpeg':
/usr/local/etc/php/ext/gd/gd.c:1222: undefined reference to `gdImageCreateFromJpegCtx'
/usr/local/etc/php/ext/gd/gd.c:1222: undefined reference to `gdImageCreateFromJpeg'
modules/php4/libphp4.a(gd.o): In function `php_if_imagecreatefrompng':
/usr/local/etc/php/ext/gd/gd.c:1235: undefined reference to `gdImageCreateFromPngCtx'
/usr/local/etc/php/ext/gd/gd.c:1235: undefined reference to `gdImageCreateFromPng'
modules/php4/libphp4.a(gd.o): In function `php_if_imagecreatefromwbmp':
/usr/local/etc/php/ext/gd/gd.c:1278: undefined reference to `gdImageCreateFromWBMPCtx'
/usr/local/etc/php/ext/gd/gd.c:1278: undefined reference to `gdImageCreateFromWBMP'
modules/php4/libphp4.a(gd.o): In function `php_if_imagepng':
/usr/local/etc/php/ext/gd/gd.c:1419: undefined reference to `gdImagePngCtx'
modules/php4/libphp4.a(gd.o): In function `php_if_imagejpeg':
/usr/local/etc/php/ext/gd/gd.c:1437: undefined reference to `gdImageJpegCtx'
modules/php4/libphp4.a(gd.o): In function `php_if_imagewbmp':
/usr/local/etc/php/ext/gd/gd.c:1454: undefined reference to `gdImageWBMPCtx'
modules/php4/libphp4.a(gd.o): In function `php_if_imagecolorallocate':
/usr/local/etc/php/ext/gd/gd.c:1504: undefined reference to `gdImageColorAllocate'
modules/php4/libphp4.a(gd.o): In function `php_if_imagepalettecopy':
/usr/local/etc/php/ext/gd/gd.c:1525: undefined reference to `gdImagePaletteCopy'
modules/php4/libphp4.a(gd.o): In function `php_if_imagecolorat':
/usr/local/etc/php/ext/gd/gd.c:1552: undefined reference to `gdImageBoundsSafe'
modules/php4/libphp4.a(gd.o): In function `php_if_imagecolorclosest':
/usr/local/etc/php/ext/gd/gd.c:1584: undefined reference to `gdImageColorClosest'
modules/php4/libphp4.a(gd.o): In function `php_if_imagecolorclosesthwb':
/usr/local/etc/php/ext/gd/gd.c:1608: undefined reference to `gdImageColorClosestHWB'
modules/php4/libphp4.a(gd.o): In function `php_if_imagecolordeallocate':
/usr/local/etc/php/ext/gd/gd.c:1636: undefined reference to `gdImageColorDeallocate'
modules/php4/libphp4.a(gd.o): In function `php_if_imagecolorresolve':
/usr/local/etc/php/ext/gd/gd.c:1664: undefined reference to `gdImageColorResolve'
modules/php4/libphp4.a(gd.o): In function `php_if_imagecolorexact':
/usr/local/etc/php/ext/gd/gd.c:1687: undefined reference to `gdImageColorExact'
modules/php4/libphp4.a(gd.o): In function `php_if_imagesetpixel':
/usr/local/etc/php/ext/gd/gd.c:1809: undefined reference to `gdImageSetPixel'
modules/php4/libphp4.a(gd.o): In function `php_if_imageline':
/usr/local/etc/php/ext/gd/gd.c:1836: undefined reference to `gdImageLine'
modules/php4/libphp4.a(gd.o): In function `php_if_imagedashedline':
/usr/local/etc/php/ext/gd/gd.c:1862: undefined reference to `gdImageDashedLine'
modules/php4/libphp4.a(gd.o): In function `php_if_imagerectangle':
/usr/local/etc/php/ext/gd/gd.c:1889: undefined reference to `gdImageRectangle'
modules/php4/libphp4.a(gd.o): In function `php_if_imagefilledrectangle':
/usr/local/etc/php/ext/gd/gd.c:1916: undefined reference to `gdImageFilledRectangle'
modules/php4/libphp4.a(gd.o): In function `php_if_imagearc':
/usr/local/etc/php/ext/gd/gd.c:1951: undefined reference to `gdImageArc'
modules/php4/libphp4.a(gd.o): In function `php_if_imagefilltoborder':
/usr/local/etc/php/ext/gd/gd.c:1977: undefined reference to `gdImageFillToBorder'
modules/php4/libphp4.a(gd.o): In function `php_if_imagefill':
/usr/local/etc/php/ext/gd/gd.c:2002: undefined reference to `gdImageFill'
modules/php4/libphp4.a(gd.o): In function `php_if_imagecolortransparent':
/usr/local/etc/php/ext/gd/gd.c:2054: undefined reference to `gdImageColorTransparent'
modules/php4/libphp4.a(gd.o): In function `php_if_imageinterlace':
/usr/local/etc/php/ext/gd/gd.c:2089: undefined reference to `gdImageInterlace'
modules/php4/libphp4.a(gd.o): In function `php_imagepolygon':
/usr/local/etc/php/ext/gd/gd.c:2152: undefined reference to `gdImageFilledPolygon'
/usr/local/etc/php/ext/gd/gd.c:2154: undefined reference to `gdImagePolygon'
modules/php4/libphp4.a(gd.o): In function `php_find_gd_font':
/usr/local/etc/php/ext/gd/gd.c:2190: undefined reference to `gdFontSmall'
/usr/local/etc/php/ext/gd/gd.c:2193: undefined reference to `gdFontMediumBold'
/usr/local/etc/php/ext/gd/gd.c:2196: undefined reference to `gdFontLarge'
/usr/local/etc/php/ext/gd/gd.c:2205: undefined reference to `gdFontTiny'
/usr/local/etc/php/ext/gd/gd.c:2207: undefined reference to `gdFontGiant'
modules/php4/libphp4.a(gd.o): In function `php_gdimagecharup':
/usr/local/etc/php/ext/gd/gd.c:2269: undefined reference to `gdImageSetPixel'
modules/php4/libphp4.a(gd.o): In function `php_imagechar':
/usr/local/etc/php/ext/gd/gd.c:2323: undefined reference to `gdImageChar'
/usr/local/etc/php/ext/gd/gd.c:2330: undefined reference to `gdImageChar'
/usr/local/etc/php/ext/gd/gd.c:2338: undefined reference to `gdImageCharUp'
modules/php4/libphp4.a(gd.o): In function `php_if_imagecopy':
/usr/local/etc/php/ext/gd/gd.c:2414: undefined reference to `gdImageCopy'
modules/php4/libphp4.a(gd.o): In function `php_if_imagecopymerge':
/usr/local/etc/php/ext/gd/gd.c:2454: undefined reference to `gdImageCopyMerge'
modules/php4/libphp4.a(gd.o): In function `php_if_imagecopymergegray':
/usr/local/etc/php/ext/gd/gd.c:2498: undefined reference to `gdImageCopyMergeGray'
modules/php4/libphp4.a(gd.o): In function `php_if_imagecopyresized':
/usr/local/etc/php/ext/gd/gd.c:2545: undefined reference to `gdImageCopyResized'
modules/php4/libphp4.a(gd.o): In function `_php_image_bw_convert':
/usr/local/etc/php/ext/gd/gd.c:3253: undefined reference to `gdImageCreate'
/usr/local/etc/php/ext/gd/gd.c:3258: undefined reference to `gdImageColorAllocate'
/usr/local/etc/php/ext/gd/gd.c:3264: undefined reference to `gdImageColorAllocate'
/usr/local/etc/php/ext/gd/gd.c:3272: undefined reference to `gdImageGetPixel'
/usr/local/etc/php/ext/gd/gd.c:3280: undefined reference to `gdImageSetPixel'
modules/php4/libphp4.a(gd.o): In function `_php_image_convert':
/usr/local/etc/php/ext/gd/gd.c:3371: undefined reference to `gdImageCreateFromJpeg'
/usr/local/etc/php/ext/gd/gd.c:3382: undefined reference to `gdImageCreateFromPng'
/usr/local/etc/php/ext/gd/gd.c:3425: undefined reference to `gdImageCreate'
/usr/local/etc/php/ext/gd/gd.c:3431: undefined reference to `gdImageCopyResized'
/usr/local/etc/php/ext/gd/gd.c:3433: undefined reference to `gdImageDestroy'
/usr/local/etc/php/ext/gd/gd.c:3437: undefined reference to `gdImageCreate'
/usr/local/etc/php/ext/gd/gd.c:3442: undefined reference to `gdImageColorAllocate'
/usr/local/etc/php/ext/gd/gd.c:3448: undefined reference to `gdImageColorAllocate'
/usr/local/etc/php/ext/gd/gd.c:3458: undefined reference to `gdImageGetPixel'
/usr/local/etc/php/ext/gd/gd.c:3466: undefined reference to `gdImageSetPixel'
/usr/local/etc/php/ext/gd/gd.c:3470: undefined reference to `gdImageDestroy'
/usr/local/etc/php/ext/gd/gd.c:3472: undefined reference to `gdImageWBMP'
/usr/local/etc/php/ext/gd/gd.c:3477: undefined reference to `gdImageDestroy'
modules/php4/libphp4.a(gd.o): In function `php_free_gd_image':
/usr/local/etc/php/ext/gd/gd.c:236: undefined reference to `gdImageDestroy'
modules/php4/libphp4.a(gd.o): In function `_php_image_bw_convert':
/usr/local/etc/php/ext/gd/gd.c:3284: undefined reference to `gdImageWBMPCtx'
collect2: ld returned 1 exit status
make[2]: *** [target_static] Error 1
make[2]: Leaving directory `/usr/local/etc/apache_1.3.20/src'
make[1]: *** [build-std] Error 2
make[1]: Leaving directory `/usr/local/etc/apache_1.3.20'
make: *** [build] Error 2

I am using Red Hat Linux 7.1, Apache 1.3.20, PHP 4.0.6 and Mysql 3.23.39

Anyone got any ideas why I get these errors ?

Thanks
0
Gareth_Hastings
Asked:
Gareth_Hastings
1 Solution
 
a.marshCommented:
What version of the gd library are you using?

Ant
0
 
Gareth_HastingsAuthor Commented:
I'm using GD 1.8.4
0
 
cyniczCommented:
isn't there a stale gd.h somewhere on that system?
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
Gareth_HastingsAuthor Commented:
well I did a locate gd.h and got this

/home/downloads/php/gd-1.8.4/gd.h
/usr/include/gd.h
/usr/local/etc/php-4.0.6/ext/gd/php_gd.h
/usr/local/include/gd.h

so which do I want ? /home/downloads/php/gd-1.8.4/gd.h ? and should I just deleted all the others ?
0
 
cyniczCommented:
how did you install the version you compiled yourself?
0
 
Gareth_HastingsAuthor Commented:
err, I just did

make; make install
0
 
cyniczCommented:
you mean you didn't run ./configure? ... hm...
I guess that's not the case, and software is commonly installed in /usr/local/, so it's probably in there. but to make sure, do

./configure --help | grep prefix

in the gd source directory. that should tell you where it's installed. once you have the info, get rid of the other gd.h files (you can double check by reading the gd.h file, it might tell you what version it is), and then reconfigure php:
$ rm -f config.cache
$ ./configure --with-mysql=/usr/local/mysql --with-config-file-path=/www/conf --with-apache=../httpd -enable-track-vars --with-gd=/usr/local

BTW, I'm not familiar with Linux, but on FreeBSD the /usr/local/etc/ directory is used for configuration scripts, not software. read hier(7):
$ man 7 hier
0
 
Gareth_HastingsAuthor Commented:
GD 1.8.4 doesn't come with a configure script, the readme just says to run make and make install :/
0
 
cyniczCommented:
doesn't it say where it's installed? you can find out if you read the make file. but I guess it'll be in /usr/local. I suggest you just follow the instructions I gave you earlier.
0
 
larry718Commented:
try this linkie, i have set it up with no problems.

httpd://www.linuxguruz.org/z.php?id=32&h=php+mysql+apache
0
 
GanetCommented:
how about using php ver 4.3.0 and running

./configure --with-mysql=/usr/local/mysql --with-config-file-path=/www/conf --with-apache=../httpd -enable-track-vars --with-gd --with-zlib

then make and make install

then recompile apache and you shouldn't have a problem
0
 
LornaJaneCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
PAQ/No refund
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

LornaJane
EE Cleanup Volunteer
0
 
Computer101Commented:
PAQed - no points refunded (of 300)

Computer101
E-E Admin
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now