Toon posts:

[PHP] PHP 4.2.3 + GD 2.0.4

Pagina: 1
Acties:

Verwijderd

Topicstarter
[OS: Linux RedHat 8.0]

Na 3 dagen ploeteren en zweten heb ik eindelijk m'n apache kunnen compileren, maar nu m'n php nog... ownee... een fout. :( |:( :'(

Dat scenario is helaas alom bekend ;), maar zelden is het de fout van de makers van de source. >:)

Het doel was om PHP 4.0.2 te compileren met GD 2.0.4, dus heb ik braaf bij http://www.boutell.com/gd de laatste GD gedownload. O-)

Toen GD (met freetype 2.1.2) gecompileer en geïnstalleerd. :Y)

De volgende klus was PHP.
Die heb ik vervolgens geconfigureerd met ./configure
met o.a. de parameter: --with-gd

Dit ging helaas elke keer fout.
De reden: een fout in de source van PHP!!!
Hoe is het mogelijk!!

GD 2.0.4 heeft namelijk iets nieuws, waar PHP niet van op de hoogte was:
GD tot/met 2.0.3 had:
C:
1
2
3
4
5
6
7
8
9
10
11
typedef struct gdIOCtx {
        int        (*getC)(struct gdIOCtx*);
        int        (*getBuf)(struct gdIOCtx*, void*, int);
        void       (*putC)(struct gdIOCtx*, int);
        int        (*putBuf)(struct gdIOCtx*, const void*, int);

        int        (*seek)(struct gdIOCtx*, const int);
        long       (*tell)(struct gdIOCtx*);

        void       (*free)(struct gdIOCtx*);
} gdIOCtx;

Maar wat heeft GD 2.0.4 helaas (of niet):
C:
1
2
3
4
5
6
7
8
9
10
11
typedef struct gdIOCtx {
        int        (*getC)(struct gdIOCtx*);
        int        (*getBuf)(struct gdIOCtx*, void*, int);
        void       (*putC)(struct gdIOCtx*, int);
        int        (*putBuf)(struct gdIOCtx*, const void*, int);

        int        (*seek)(struct gdIOCtx*, const int);
        long       (*tell)(struct gdIOCtx*);

        void       (*gd_free)(struct gdIOCtx*);
} gdIOCtx;
Je ziet het, free heet hier gd_free.

Om dit te corrigeren zou je de source van GD kunnen veranderen (niet zo slim)
Handiger is echter een paar regeltjes bij PHP aan te passen:

Verander in de bestanden /ext/gd/gd.c regel 1014, 1017 en 1208
C:
1
io_ctx->free
in
C:
1
io_ctx->gd_free

en bij /ext/gd/gd_ctx.c regel 70 en 98
C:
1
ctx->free
in
C:
1
ctx->gd_free

en de rest zou je zelf moeten kunnen. :)

Dat was het, veel plezier ermee. ;)

  • LuCarD
  • Registratie: Januari 2000
  • Niet online

LuCarD

Certified BUFH

Netjs..

Nou alleen nog even aan melden bij

http://bugs.php.net

Programmer - an organism that turns coffee into software.


Verwijderd

:-) heheheh ik leef met je mee.... we hadden de zelfde situatie...

moet je eens kijken bij whats new, wat daar in staat...
What's new in version 2.0.4?
The following contributions from John Ellson:
Various test programs now compile in the absence of PNG support
gdIOCtx correctly calls gdFree rather than free
Various cleanups to pass -Wall without warnings
Support for Adobe-style Type 1 fonts (.pfa and .pfb files) via freetype
gdImageColorResolve and gdImageColorResolveAlpha will not attempt to resolve a color request to the transparent color index (for palette-based images)
Improved font search path support
Antialiased freetype text on palette images works properly when more than one image is created in a single program lifetime with different color indexes
Better threshold for two-color "mono" images
Memory leak fixes
Text rotation fix
More extensive default font path
fontwheeltest and fontsizetest test programs for freetype
And the following additional fixes:
configure now correctly detects and provides support for the Xpm library and its dependencies (Len Makin)