ImageMagick e l’errore “FreeType package is complete… no — some components failed test” su FreeBSD

Recentemente ho avuto un problema alquanto fastidioso con alcune community che gestisco, entrambe usano vBulletin come piattaforma e il problema riguardava il file image.php che generava un errore critico nel database, con tanto di invio di email per la segnalazione…

All’inizio non sapevo cosa provocasse l’errore, sapevo solo che ricevevo continuamente queste segnalazioni tramite email, inoltre il giorno prima di questo problema il server si era misteriosamente riavviato da solo, la prima cosa che ho pensato riguardava un eventuale corruzione delle tabelle dei database, ma anche dopo averle riparate tutte il problema è rimasto, l’unica soluzione era di debuggare il codice di vBulletin, ma prima una rapida ricerca su Google aveva evidenziato che il problema non era solo mio, ma anche altri lamentavano lo stesso identico problema.

vBulletin vs ImageMagick

Per prima cosa analizziamo il problema, l’accesso al file image.php genera un errore, apparentemente legato al database nelle tabelle delle lingue, il file sembra funzionare se vengono passati i dati corretti, ma senza parametri o con un banale errore (come un amp; scritto o interpretato male) sono sufficienti a scatenare l’errore:

[plain]Database error in vBulletin 4.2.2:

Invalid SQL:

SELECT text, languageid, special
FROM phrase AS phrase
LEFT JOIN phrasetype USING (fieldname)
WHERE phrase.fieldname = ”
AND varname = ” AND languageid IN (-1, 0, 0);

MySQL Error :
Error Number :
Request Date : Sunday, February 2nd 2014 @ 04:05:32 AM
Error Date : Sunday, February 2nd 2014 @ 04:05:32 AM
Script : http://www.softairmania.it/image.php
Referrer :
IP Address : 87.10.110.72
Username :
Classname : vB_Database
MySQL Version :[/plain]

Dopo un rapido debug del file image.php e della classe class_image.php trovo il vero problema:

[sourcecode language=”plain”]
convert: delegate library support not built-in `/sito/images/regimage/fonts/edmunds.ttf’ (Freetype) @ warning/annotate.c/RenderFreetype/1529.
convert: Postscript delegate failed `/tmp/magick-15808R9xphxZ96dby’: No such file or directory @ error/ps.c/ReadPSImage/833.
convert: delegate library support not built-in `/sito/images/regimage/fonts/edmunds.ttf’ (Freetype) @ warning/annotate.c/RenderFreetype/1529.
convert: Postscript delegate failed `/tmp/magick-158089kJ8BdFeM29T’: No such file or directory @ error/ps.c/ReadPSImage/833.[/sourcecode]

In pratica ImageMagick mi sta avvertendo che non ha un supporto, molto probabilmente quello riguardante la gestione dei TrueType Font, il FreeType, per prima cosa verifico che sia vero:

[bash]# convert -list configure

Path: /usr/local/lib/ImageMagick-6.8.0/config/configure.xml

Name Value
——————————————————————————-
CC cc -std=gnu99 -std=gnu99
CFLAGS -I/usr/local/include/lqr-1 -I/usr/local/include/glib-2.0 -I/usr/local/include -O2 -pipe -I/usr/local/include/freetype2 -fno-strict-aliasing -Wall
CODER_PATH /usr/local/lib/ImageMagick-6.8.0/modules-Q16/coders
CONFIGURE ./configure ‘–enable-shared’ ‘–without-dps’ ‘–without-lcms’ ‘–disable-hdri’ ‘–with-perl=/usr/local/bin/perl5.14.4’ ‘–without-threads’ ‘–disable-openmp’ ‘–with-modules’ ‘–without-openexr’ ‘–without-djvu’ ‘–without-gslib’ ‘–with-lqr’ ‘–with-fftw’ ‘–with-fpx’ ‘–without-gvc’ ‘–with-freetype’ ‘–with-webp’ ‘–with-fontconfig’ ‘–with-wmf=yes’ ‘–with-rsvg’ ‘–with-xml’ ‘–without-pango’ ‘–with-x’ ‘–x-libraries=/usr/local/lib’ ‘–x-includes=/usr/local/include’ ‘–prefix=/usr/local’ ‘–mandir=/usr/local/man’ ‘–infodir=/usr/local/info/’ ‘–build=amd64-portbld-freebsd9.1’ ‘build_alias=amd64-portbld-freebsd9.1’ ‘CC=cc’ ‘CFLAGS=-O2 -pipe -I/usr/local/include/freetype2 -fno-strict-aliasing’ ‘LDFLAGS= -L/usr/local/lib’ ‘CPPFLAGS=-I/usr/local/include’ ‘CPP=cpp’ ‘CXX=c++’ ‘CXXFLAGS=-O2 -pipe -I/usr/local/include/freetype2 -fno-strict-aliasing’ ‘PKG_CONFIG=pkgconf’ ‘FONTCONFIG_CFLAGS=-I/usr/local/include’ ‘FONTCONFIG_LIBS=-L/usr/local/lib’ ‘RSVG_CFLAGS=-I/usr/local/include/librsvg-2.0’ ‘RSVG_LIBS=-L/usr/local/lib’
CONFIGURE_PATH /usr/local/etc/ImageMagick/
COPYRIGHT Copyright (C) 1999-2012 ImageMagick Studio LLC
CPPFLAGS -I/usr/local/include/ImageMagick
CXX c++
CXXFLAGS -O2 -pipe -I/usr/local/include/freetype2 -fno-strict-aliasing
DEFS -DHAVE_CONFIG_H
DELEGATES bzlib fftw fpx fontconfig jbig jpeg jng jp2 lcms2 lqr png rsvg tiff x11 xml wmf zlib
DISTCHECK_CONFIG_FLAGS ‘CC=cc’ ‘CFLAGS=-O2 -pipe -I/usr/local/include/freetype2 -fno-strict-aliasing’ ‘CPPFLAGS=-I/usr/local/include’ ‘CXX=c++’ ‘LDFLAGS= -L/usr/local/lib’ –disable-deprecated –with-quantum-depth=16 –with-umem=no –with-autotrace=no –with-dps=no –with-djvu=no –with-gslib=no –with-fontpath= –with-gvc=no –with-lcms=no –with-openexr=no –with-pango=no –with-perl=/usr/local/bin/perl5.14.4
DOCUMENTATION_PATH /usr/local/share/doc/ImageMagick
EXEC-PREFIX /usr/local
EXECUTABLE_PATH /usr/local/bin
FEATURES
FILTER_PATH /usr/local/lib/ImageMagick-6.8.0/modules-Q16/filters
HOST amd64-portbld-freebsd9.1
INCLUDE_PATH /usr/local/include/ImageMagick
LDFLAGS -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -R/usr/local/lib -L/usr/local/lib -L/usr/local/lib
LIB_VERSION 0x680
LIB_VERSION_NUMBER 6,8,0,7
LIBRARY_PATH /usr/local/lib/ImageMagick-6.8.0
LIBS -lMagickCore -llcms2 -lfreetype -llqr-1 -L/usr/local/lib -lglib-2.0 -lintl -lfftw3 -lfontconfig -L/usr/local/lib -lfreetype -lXext -lSM -lICE -lX11 -lXt -lbz2 -lz -lltdl -lm
NAME ImageMagick
PCFLAGS
PREFIX /usr/local
QuantumDepth 16
RELEASE_DATE 2014-02-02
SHARE_PATH /usr/local/share/ImageMagick-6.8.0
SVN_REVISION 10029
TARGET_CPU amd64
TARGET_OS freebsd9.1
TARGET_VENDOR portbld
VERSION 6.8.0
WEBSITE http://www.imagemagick.org

Path: [built-in]

Name Value
——————————————————————————-
NAME ImageMagick[/bash]

La riga DELEGATES è chiarificatrice, manca il supporto al FreeType, penso che probabilmente nell’ultimo aggiornamento non ho inserito il supporto per il FreeType quindi compilo nuovamente il pacchetto assicurandomi di aver attivato il supporto, ma il problema rimane, provo a leggere il log del make e noto il seguente testo:

[plain]————————————————————-
checking for FreeType 2.0…
checking for freetype-config… freetype-config
checking for FT_Init_FreeType in -lfreetype… no
checking ft2build.h usability… yes
checking ft2build.h presence… yes
checking for ft2build.h… yes
checking for freetype/freetype.h… no
checking if FreeType package is complete… no — some components failed test
————————————————————-[/plain]

Quelle ultime due righe mi hanno fatto uscire pazzo, vi dico subito che è inutile pensare di compilare nuovamente le dipendenze credendo inutilmente che qualche libreria sia andata a pallino, il problema non si risolve così, purtroppo.
Analizzando il file work/ImageMagick-6.8.0-7/config.log ho capito che non veniva trovato il file freetype/freetype.h e veniva cercato in /usr/local/include/freetype2/freetype/freetype.h quindi mi è bastato controllare in quella directory per notare subito l’assenza di una directory freetype sotto freetype2, per risolvere è bastato semplicemente:

[bash]# ln -s /usr/local/include/freetype2/ /usr/local/include/freetype2/freetype[/bash]

Fatto questo ho pulito e compilato nuovamente ImageMagick e nel log del config:

[plain]————————————————————-
checking for FreeType 2.0…
checking for freetype-config… freetype-config
checking for FT_Init_FreeType in -lfreetype… no
checking ft2build.h usability… yes
checking ft2build.h presence… yes
checking for ft2build.h… yes
checking for freetype/freetype.h… yes
checking if FreeType package is complete… yes
————————————————————-[/plain]

Perfetto, nessun errore, non resta che verificare i delegati e quindi provare il file image.php

[bash]# convert -list configure

Path: /usr/local/lib/ImageMagick-6.8.0/config/configure.xml

Name Value
——————————————————————————-
CC cc -std=gnu99 -std=gnu99
CFLAGS -I/usr/local/include/lqr-1 -I/usr/local/include/glib-2.0 -I/usr/local/include -O2 -pipe -I/usr/local/include/freetype2 -fno-strict-aliasing -Wall
CODER_PATH /usr/local/lib/ImageMagick-6.8.0/modules-Q16/coders
CONFIGURE ./configure ‘–enable-shared’ ‘–without-dps’ ‘–without-lcms’ ‘–disable-hdri’ ‘–with-perl=/usr/local/bin/perl5.14.4’ ‘–without-threads’ ‘–disable-openmp’ ‘–with-modules’ ‘–without-openexr’ ‘–without-djvu’ ‘–without-gslib’ ‘–with-lqr’ ‘–with-fftw’ ‘–with-fpx’ ‘–without-gvc’ ‘–with-freetype’ ‘–with-webp’ ‘–with-fontconfig’ ‘–with-wmf=yes’ ‘–with-rsvg’ ‘–with-xml’ ‘–without-pango’ ‘–with-x’ ‘–x-libraries=/usr/local/lib’ ‘–x-includes=/usr/local/include’ ‘–prefix=/usr/local’ ‘–mandir=/usr/local/man’ ‘–infodir=/usr/local/info/’ ‘–build=amd64-portbld-freebsd9.1’ ‘build_alias=amd64-portbld-freebsd9.1’ ‘CC=cc’ ‘CFLAGS=-O2 -pipe -I/usr/local/include/freetype2 -fno-strict-aliasing’ ‘LDFLAGS= -L/usr/local/lib’ ‘CPPFLAGS=-I/usr/local/include’ ‘CPP=cpp’ ‘CXX=c++’ ‘CXXFLAGS=-O2 -pipe -I/usr/local/include/freetype2 -fno-strict-aliasing’ ‘PKG_CONFIG=pkgconf’ ‘FONTCONFIG_CFLAGS=-I/usr/local/include’ ‘FONTCONFIG_LIBS=-L/usr/local/lib’ ‘RSVG_CFLAGS=-I/usr/local/include/librsvg-2.0’ ‘RSVG_LIBS=-L/usr/local/lib’
CONFIGURE_PATH /usr/local/etc/ImageMagick/
COPYRIGHT Copyright (C) 1999-2012 ImageMagick Studio LLC
CPPFLAGS -I/usr/local/include/ImageMagick
CXX c++
CXXFLAGS -O2 -pipe -I/usr/local/include/freetype2 -fno-strict-aliasing
DEFS -DHAVE_CONFIG_H
DELEGATES bzlib fftw fpx fontconfig freetype jbig jpeg jng jp2 lcms2 lqr png rsvg tiff x11 xml wmf zlib
DISTCHECK_CONFIG_FLAGS ‘CC=cc’ ‘CFLAGS=-O2 -pipe -I/usr/local/include/freetype2 -fno-strict-aliasing’ ‘CPPFLAGS=-I/usr/local/include’ ‘CXX=c++’ ‘LDFLAGS= -L/usr/local/lib’ –disable-deprecated –with-quantum-depth=16 –with-umem=no –with-autotrace=no –with-dps=no –with-djvu=no –with-gslib=no –with-fontpath= –with-gvc=no –with-lcms=no –with-openexr=no –with-pango=no –with-perl=/usr/local/bin/perl5.14.4
DOCUMENTATION_PATH /usr/local/share/doc/ImageMagick
EXEC-PREFIX /usr/local
EXECUTABLE_PATH /usr/local/bin
FEATURES
FILTER_PATH /usr/local/lib/ImageMagick-6.8.0/modules-Q16/filters
HOST amd64-portbld-freebsd9.1
INCLUDE_PATH /usr/local/include/ImageMagick
LDFLAGS -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -R/usr/local/lib -L/usr/local/lib -L/usr/local/lib
LIB_VERSION 0x680
LIB_VERSION_NUMBER 6,8,0,7
LIBRARY_PATH /usr/local/lib/ImageMagick-6.8.0
LIBS -lMagickCore -llcms2 -lfreetype -llqr-1 -L/usr/local/lib -lglib-2.0 -lintl -lfftw3 -lfontconfig -L/usr/local/lib -lfreetype -lXext -lSM -lICE -lX11 -lXt -lbz2 -lz -lltdl -lm
NAME ImageMagick
PCFLAGS
PREFIX /usr/local
QuantumDepth 16
RELEASE_DATE 2014-02-02
SHARE_PATH /usr/local/share/ImageMagick-6.8.0
SVN_REVISION 10029
TARGET_CPU amd64
TARGET_OS freebsd9.1
TARGET_VENDOR portbld
VERSION 6.8.0
WEBSITE http://www.imagemagick.org

Path: [built-in]

Name Value
——————————————————————————-
NAME ImageMagick[/bash]

Perfetto! Anche tra i delegati risulta il FreeType e naturalmente il file image.php di vBulletin è tornato a funzionare perfettamente.

Informazioni RedFoxy

ha scritto 42 articoli in questo blog.

Commenti (1)

Trackback URL | Comments RSS Feed

  1. wie viel kostet live6 ha detto:

    Whɑt a information of un-ambiguity and preѕегvenesѕ of valuable know-how oո the
    topic of unexpected emotiοns.

%d blogger hanno fatto clic su Mi Piace per questo: