Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Boutell's gd

Status
Not open for further replies.

sirugo

Programmer
Aug 1, 2000
162
SE
Hello!<br><br>I'm a newbie running 3.3, trying to install Boutell's gd application to generate jpegs and pngs on the fly.<br>It requires the jpeg-6b, zlib and the pnglib.<br>I've got them all installed.<br>I also installed gd successfully. The gddemo runs great and produces a png on the fly.<br>BUT!<br><br>Now I want to add the feature in one of my own apps. So I take Boutell's example, copy it into an empty file and try to compile it:<br>gcc -I. gdso-ch.c -o gdso -L. -L/usr/local/lib -L/usr/lib -lm -lgd -lpng -lz<br><br>but it generates the following error msg:<br>/var/tmp/ccp385941.o(.text+0x3d6b): undefined reference to `gdImageJpeg'<br><br>What am I doing wrong and do I really need all that above to compile it? Boutell's webpage tells me exactly the following:<br>&quot;gd lets you create PNG or JPEG images on the fly. To use gd in your program, include the file gd.h, and link with the libgd.a library produced by &quot;make libgd.a&quot;, under<br>Unix. Under other operating systems you will add gd.c to your own project.&quot;<br>(see <A HREF=" TARGET="_new"> in advance<br>I
 
Add -ljpeg to your libs.<br><br>If you look in the Makefile, you will see that the line<br><br>LIBS=-lm -lgd -lpng -lz<br><br>is the default, which doesn't include jpeg support; to enable more options, the commented line<br><br>#LIBS=-lm -lgd -lpng -lz -ljpeg -lttf -lXpm<br><br>contains all the options, including -ljpeg, which is for jpeg support.
 
Thanks!<br><br>That's what I was thinking about to try next.<br>Thanks for confirming my thoughts!<br><br>I'll be back if it won't work.<br><br>I
 
Sorry to say that it did not work!<br><br>I installed jpeg-6b (which was required) to /usr/local/lib and added -ljpeg to the commandline:<br><br>gcc -I. gdso-ch.c -o gdso -L. -L/usr/local/lib -L/usr/lib -lm -lgd -lpng -lz -ljpeg<br><br>Got the very same message.<br>To me it seems that the gd-library is not OK.<br>
 
I am not a C or C++ developer. I was able to install gd-1.8.3 on my system, and compile it with PHP, but it took a lot of futzing around. I know you have different needs, but for what it's worth, here is what I did; maybe something in here will help you:<br><br>My platform was FreeBSD3.4, and later 4.0<br><br>1. Assume X-windows, libpng, mysql, gmake and automake are already installed.<br><br>2. Install libjpeg (from <A HREF="ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz" TARGET="_new">ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz</A> )<br>a) ./configure --enable-shared<br>b) gmake, gmake install<br><br><br>3. Install Freetype 1.3.1 (from <A HREF=" TARGET="_new"> ./configure --enable-shared --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib<br>b) gmake, gmake install<br>c) if freetype creates a freetype/ directory inside /usr/local/lib, copy all contents into /usr/local/lib<br><br><br>4. Install zlib 1.1.3 (from <A HREF=" TARGET="_new"> (as I understand, gd requires zlib, and PHP4 will only work with zlib version &gt;= 1.0.9)<br>a) ./configure --shared<br>b) gmake, gmake install<br><br><br>5. Install gd-1.8.3 (from <A HREF=" TARGET="_new"> edit Makefile for correct include and lib dirs, and uncomment the lines that<br>enable all options, while commenting out the default lines<br>b) edit gd.c; remove 1st three lines (if - endif for malloc.h)<br>c) edit gdcache.h and ...php-src/ext/gd/gdcache.h (if exists) and replace<br>&lt;malloc.h&gt; with &lt;stdlib.h&gt;<br>d) copy /usr/X11R6/include/X11 to /usr/X11R6/include/X11/X11 (gd looks<br>recursively inside X11 to X11/*)<br>e) gmake, gmake install<br><br><br>6. Install apache-1.3.12<br>a) ./configure --prefix=/usr/local/apache --enable-module=all<br>--enable-shared=max<br>b) gmake, gmake install<br><br><br>7. Install PHP 4.0.1pl2<br>a) ./configure --prefix=/usr/local/php4 --with-mysql<br>--with-apxs=/usr/local/apache/bin/apxs --enable-track-vars --with-gd=/usr/local/ --with-jpeg-dir=/usr/local --with-xpm-dir=/usr/X11R6 --with-zlib-dir=shared<br>b) gmake, gmake install<br>c) sometimes I have found you need to reboot the system completely instead of just restart httpd<br><br><br><br>
 
Thanks for the energy you put into that reply, rycamor<br><br>OK, right now I'm trying to follow your steps exactly. It works fine although
 
Well... it wasn't a lot of energy. When I *finally* managed to get it right, I documented all my steps. (never want to have to think that one through again ;-)
 
Ooops. The last important part of my message got lost!<br><br>...although make install doesn't work!<br>It gives me:<br>make: don't know how to make install. Stop<br><br>As far as I know it worked some days ago. Not sure, though.<br>Why?
 
What more:<br><br>I managed to gmake install the truetype-lib and the<br>Now I suddenly get the following message when I start emacs:<br><br>/usr/libexec/ld-elf.so.1: Shared object libXaw.so.6 not found<br><br>Ummm...what has happened now?
 
It should be at /usr/X11R6/lib/libXaw.so.6<br><br>Try entering 'locate libXaw'<br><br>and see what comes up.<br><br>I think libXaw refers to a graphics card library in X-windows. I really don's see how FreeType could have affected it, but...<br><br>If it's not there, I would say reinstall X-windows. Don't really know what else to say.<br><br>Anyone else know more about this than me?<br><br>(Remember, my platform was 3.4, and using 'gmake'. I haven't tried it on 3.3 with 'make')
 
OK. I didn't do anything.<br>When I got back to the server a few hours later emacs worked fine. I'm the only one who does things there so it probably solved its own problem.<br>Now I can continue follow your instructions.
 
After some back and forthing between makefiles and directories I finally made it!<br><br>The fatal mistake I made was to forget uncommenting the line that said that the jpeg stuff was already installed.<br>And a few other tiny stupid things.<br><br>Thanks, rycamor! Your documentation helped a lot!<br>I can sleep well now, if there's any time for it now that I can play with gd for a while...<br><br>I
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top