gd library 2.0.1 in MacOsX 10.1.1 with PHP4.0.6

rib

Registered
Has anyone had any success in making gdLibrary2.0.1 for MacOSX10.1.1?

Believe me, I have tried, but nothing works..

Once successfull built I am going to make PHP4.0.6 with gd2.0.1 support. I need it for a site with some gd2.0.1 specific features.

GD2.0.1 builds as a shared library, 'make gdlib.a' makes the static one, right?

Thanks in advance for any help!
 
Shouldn't be too different from the instructions at stepwise:
<b>
http://www.stepwise.com/Articles/Workbench/2001-06-12.01.html
</b>

you have the required libraries?

apparently , you have to tell the makefile that you are using cc not gcc.

looks like what you want is the static library. or you have to severely customize the makefile to get it to understand how to make one on this platform.

anyway you will compile it into php

and your configuration of apache....

good luck... lots of info on google.
 
I managed to compile it nice late this night. I removed all references to freetype library in the Makefile and, ofcourse, changed gcc to cc with '-flat_namespace -undefined suppress' where appropriate. PHP later compiled nice as well and everything seems to work fine now.
 
Could you please post instructions on how you did that? I have compiled PHP w/ gd 1.8.6, but I am trying to redo the compile using gd 2.0.1. For some reason, PHP is still compiling with the old 1.8.6 library. Any ideas on what I am doing wrong? Every thing seems to compile and run fine, but the gd 2.0.1 functions are giving me errors ("you need gd 2.0.1, stupid" it tell me).
 
it is probably in /usr/local/lib...

maybe the new one has a different name....
libgd-2 ???

check the make file for where it installs the library... under which name...

also, you can
type at the command-line

>%locate libgd.a

/usr/local/lib/libgd.a
/usr/X11R6/lib/libgd.a

I think I moved a copy to the XFree to make something else happy...or???
check the dates for each one...

you may also need to verify that any needed include files have been updated accordingly, and are in the proper location...
 
It is installed in /usr/local/lib, and the mod date is when I installed gd 2.0.1. There is a libgd.a and a libgd.so and a few more simailar to that.

The prob is that somehow PHP still thinks that it is compiling with gd 1.8.6. I do have a copy of that on my desktop, but I don't know how the installer is finding that. One thing that is odd is that PHP claims not to be able to find the lib when I tell it to use the path /usr/local/lib, I have to only use the path /usr/local.

EDIT: Is there a diffrence between configuring with --with-gd-dir=/usr/local and --with-gd=/usr/local?
 
when you use that (with the appropriate directive from the configure file...)

./configure --help

you should be referring to the root of the installation where

libgd.a is in the lib/ directory and

the <b> associated headers </b> are in the include/ directory under that point.

the compiler looks at the headers and the c code of php will use the headers you have... if however, the headers do not match the actual compiled library file which they refer to you will get exactly the problem...

again... in bold this time <b> check your gd make files for where the headers are copied to when you say "make install"</b> (that would be in the "install" section of the make file)
or in this line...

#Location where .h files should be installed by "make install".
INSTALL_INCLUDE=/usr/local/include
they should be in the /usr/local/include directory

however, it seems that once php is installed, they are not...


here is my php configuration which uses libraries compiled by fink and some which I did myself
<code>
'./configure' '--prefix=/usr' '--sysconfdir=/etc' '--localstatedir=/var' '--mandir=/usr/share/man' '--enable-mbstr-enc-trans' '--enable-mbstring' '--with-jpeg=/sw' '--with-xml' '--with-apxs=/usr/sbin/apxs' '--with-mysql=/usr/local/mysql' '--with-gd=/sw' '--enable-gd-native-ttf' '--with-png=/sw' '--with-zlib' '--with-freetype-dir=/usr/X11R6' '--enable-trans-sid' '--with-readline=/sw' '--with-gettext=/sw/bin' '--enable-ftp' '--with-gdbm=/sw' '--with-pgsql=/usr/local/pgsql'
</code>

php additionally reports

gd
GD Support enabled
GD Version 1.6.2 or higher
FreeType Support enabled
FreeType Linkage with freetype
WBMP Support enabled



anyway, see if you can find a version or a date in those header files...

in gd.h
#define GD2_VERS 1
#define GD2_ID "gd2"
#define GD2_FMT_RAW 1
#define GD2_FMT_COMPRESSED 2

which is from 1.8.4 I guess..

also, maybe you do not need to make a
libgd.so file
sorry this was all a couple of months ago and I just quickly compiled it all again after 10.1 install.

save your config.status at the very minimum
 
In my gd makefile, it says: "ld -shared -o libgd.so.${VERSION} ${LIBOBJS}" But when I compile it, it gives me an error message that says that it don't do "-shared" so in order to compile it w/o an error I removed the -shared flag. Is that it? What is the gd makefile seposed to look like?

And, jimr, every thing is as you say, except

#define GD2_VERS 1
#define GD2_ID "gd2"
#define GD2_FMT_RAW 1
#define GD2_FMT_COMPRESSED 2

actually says:
#define GD2_VERS 2
#define GD2_ID "gd2"
#define GD2_FMT_RAW 1
#define GD2_FMT_COMPRESSED 2

in my file :)

EDIT: Changed sentence for clarity.
 
Originally posted by mailseth


actually says:
#define GD2_VERS 2
#define GD2_ID "gd2"
#define GD2_FMT_RAW 1
#define GD2_FMT_COMPRESSED 2

in my file :)

EDIT: Changed sentence for clarity.

better check out stepwise.... but scott only has instructions for 1.86

there is not a configuration fi

le...

so a few unknwns are bound to crop up.

your headers appear to be correct for version 2.

so then where are you "hiding" the old libgd.a?


adjust these things in the make file...

your mileage might vary if you do not have all these libraries to support fonts and etc...

COMPILER=cc

optimally....

CFLAGS=-O -DHAVE_LIBXPM -DHAVE_LIBPNG -DHAVE_LIBJPEG \-DHAVE_LIBFREETYPE
LIBS=-lgd -lpng -ljpeg -lz -lfreetype

INCLUDEDIRS=-I. -I$(PREFIX)/include/freetype2 -I/usr/X11R6/include/X11 -I$(PREFIX)/include

LIBDIRS=-L. -L$(PREFIX)/lib -L/usr/X11R6/lib
INSTALL_LIB=/usr/local/lib
INSTALL_INCLUDE=/usr/local/include
INSTALL_BIN=/usr/local/bin

top of gdcache.h

find something about malloc.h
/* header */
/*********************************************************/

#ifndef __APPLE__
#include <malloc.h>
#endif



also look for a flag CPPFLAGS

add = -fno-common or

you might be able to

setenv CPPFLAGS = -fno-common
make
assure that you have
/usr/local/bin
/usr/local/includes
/usr/local/lib

make install if all of the above is OK.

when you are finished

ranlib /usr/local/libgd.a

then you can start with php.




-----------

some of this information obtained from fink distribution

if you do not have the xfree86 and the Freetype libs omit libs and paths to includes as necessary. and appropriate list of -DHAVE flags....



must have jpeg, png maybe gif and zlib as minimums
 
PHP is still giving me an error message:

Fatal error: imagecreatetruecolor(): requires GD 2.0 or later

I have gd 1.8.6 working from the instructions on stepwise a while ago.

I followed your suggestions (I don't need freetype tho)

At the bottom of the makefile it says:
libgd.so.${VERSION}: ${LIBOBJS}
-rm -f libgd.so.${VERSION} 2>/dev/null
ld -shared -o libgd.so.${VERSION} ${LIBOBJS}
sh ./install-item 644 libgd.so.${VERSION} \
$(INSTALL_LIB)/libgd.so.${VERSION}
-rm $(INSTALL_LIB)/libgd.so.${MAJOR_VERSION} 2>/dev/null
ln -s $(INSTALL_LIB)/libgd.so.${VERSION} \
$(INSTALL_LIB)/libgd.so.${MAJOR_VERSION}
-rm $(INSTALL_LIB)/libgd.so 2>/dev/null
ln -s $(INSTALL_LIB)/libgd.so.${VERSION} \
$(INSTALL_LIB)/libgd.so

I have changed the third line so it says:
ld -flat_namespace -undefined suppress -o libgd.so.${VERSION} ${LIBOBJS}

because it sounds like the -flat_namespace -undefined suppress flags are good things to have, and the -shared flag gives me an error message.

Another thing that I noticed was that in the messages after doing make install on gd, is that libgd.so is mentioned, but I cannot find a mention of libgd.a anywhere in the output message.

Another interesting development: I ran the cat command on the libgd.a file, and there was a bunch of jibberish. But, within the jibberish there was a list of all of the fxns of gd, and all of the gd 2.0 fxns are not listed in the file.

But libgd.a has the correct mod time, so go figure :-\
 
Originally posted by mailseth
PHP is still giving me an error message:

Fatal error: imagecreatetruecolor(): requires GD 2.0 or later



At the bottom of the makefile it says:
libgd.so.${VERSION}: ${LIBOBJS}
-rm -f libgd.so.${VERSION} 2>/dev/null
ld -shared -o libgd.so.${VERSION} ${LIBOBJS}
sh ./install-item 644 libgd.so.${VERSION} \
$(INSTALL_LIB)/libgd.so.${VERSION}
-rm $(INSTALL_LIB)/libgd.so.${MAJOR_VERSION} 2>/dev/null
ln -s $(INSTALL_LIB)/libgd.so.${VERSION} \
$(INSTALL_LIB)/libgd.so.${MAJOR_VERSION}
-rm $(INSTALL_LIB)/libgd.so 2>/dev/null
ln -s $(INSTALL_LIB)/libgd.so.${VERSION} \
$(INSTALL_LIB)/libgd.so

I have changed the third line so it says:
ld -flat_namespace -undefined suppress -o libgd.so.${VERSION} ${LIBOBJS}

because it sounds like the -flat_namespace -undefined suppress flags are good things to have, and the -shared flag gives me an error message.


Another interesting development: I ran the cat command on the libgd.a file, and there was a bunch of jibberish. But, within the jibberish there was a list of all of the fxns of gd, and all of the gd 2.0 fxns are not listed in the file.

But libgd.a has the correct mod time, so go figure :-\

the -flat_namespace
will keep you from getting an error
while "trying to construct a shared library, but you need -bundle and possibly a few other flags and change the name to .dylib before it would be useful.

I have not actually compiled the 2.0

version,

but it sounds like it takes a serious read of the make file with understanding of all of the flags.

I don't have time to run the compiles at this moment. but it seems desirable to get the truecolor images.

the 1.8.x is only 256

instead of cat you can use strings,
but I didn't necessarily find anything I was looking for in libgd.a

mc gives a very pretty format of all of the included objects with offsets.

libgd.a should be made by default.
then that and other dynamic stuff should be wrapped together to make a .so on other systems.

if gd is compiling, and you end up with a library, then the problem is with php, or possibly some requirement not net by the gd library which you have compiled.

it will take me more than a few days to have the time to actually compile.

you might try a search on google.

sorry, but without actually looking at the configuration, I can't help in this case.

have a read through the php docs for some additional clues.
 
Because gd 2.0 and above installs as a shared library, it is necessary to install the library properly before running gd-based programs.


from the online manual at
http://www.boutell.com/gd/manual2.0.1.html#buildgd

this seems to indicate that you will have to figure out the details about creating shared libraries for OSX.

not difficult just you have to figure out what the flags should be.

I suggest you go to the darwin site and download something like zlib to see what the apple guys did.

BTW it is Beta...so be advised you are living on the edge. and there is one more note...


gd is not a paint program. If you are looking for a paint program, you are looking in the wrong place. If you are not a programmer, you are looking in the wrong place, unless you are installing a required library in order to run an application.
add to that ...it seems to be default configured to almost work in linux...

that makefile requires extensive editing as I recall.
also, you could see if php knows how to load dynamically from a .so versus a .dylib
 
I got it to work finally. I ended up going back to stepwise and redoing everything there. (except gd 1.8.6) Then I installed gd with the flags that you suggested (I also had to redo runlib on libgd.a).

I believe the trick is that the PHP ./configure has to read:
checking whether to enable FTP support... yes
checking whether to include GD support... yes
checking whether to enable truetype string function in gd... no
checking for the location of libjpeg... yes
checking for jpeg_read_header in -ljpeg... (cached) yes
checking for the location of libpng... yes
checking for png_info_init in -lpng... yes
checking for the location of libXpm... no
If configure fails try --with-xpm-dir=<DIR>
checking for freetype(2)... no
If configure fails try --with-freetype-dir=<DIR>
checking whether to include include FreeType 1.x support... no
checking whether to include T1lib support... no
checking for gdImageString16 in -lgd... (cached) yes
checking for gdImagePaletteCopy in -lgd... (cached) yes
checking for gdImageCreateFromPng in -lgd... (cached) no
checking for gdImageCreateFromGif in -lgd... (cached) no
checking for gdImageWBMP in -lgd... (cached) yes
checking for gdImageCreateFromJpeg in -lgd... (cached) yes
checking for gdImageCreateFromXpm in -lgd... (cached) yes
checking for gdImageCreateTrueColor in -lgd... (cached) yes
checking for gdImageSetTile in -lgd... (cached) yes
checking for gdImageSetBrush in -lgd... (cached) yes
checking for gdImageStringFTEx in -lgd... (cached) no
checking for gdImageColorClosestHWB in -lgd... (cached) yes
checking for gdImageColorResolve in -lgd... (cached) yes
checking for gdImageGifCtx in -lgd... (cached) no

somwhere in there. Anyway , thx very much for all of the help, it is working now. If you want to see what I have done head to http://144.92.33.99/search and search for a plant. All of the resulting thumbnails were generated by the script :D. You are searching from a script generated MySQL database of approx 10,000 images (3 collections and there may be duplicates between them)
 
your resulting make file from gd 201 and the config.status from php

can you drop that by private message or send me a link where I can pick it up.
 
Back
Top