[cairo] Issues with Store-Bought v. Home-Grown builds of Cairo

Jennifer Adams jma at cola.iges.org
Thu Feb 10 09:03:50 PST 2011


An Update ...
I added libXrender-0.9.6 to my collection, and now I am able to  
statically link GrADS and other stand-alone programs with my home- 
grown build of Cairo, without any apparent change in performance.  
Unfortunately, one critical difference still exists between my home- 
grown build and the store-bought (i.e., macports/yum) build: I can no  
longer draw text with the "symbol" font. This is critical for GrADS,  
since our users are occasionally drawing Greek letters on their plot  
annotations. I know the docs say there is no way to know what fonts  
are available, but the generic font family names should perform as  
expected. This is no longer the case -- all I seem to have is sans- 
serif. Using cairo_select_font_face() with args "serif", "monospace",  
"symbol", "fancy", or "cursive" has no effect on the text. Other  
common font names such as "Times" and "Georgia" no longer work,  
whereas all these options worked when I was linking dynamically with  
the mac ports build. Is there something I need to change when building  
the fontconfig or freetype libraries? (My configure options are in the  
fine print below.)
Thanks for any help,
Jennifer




On Jan 21, 2011, at 12:31 PM, Jennifer Adams wrote:

> Dear Experts,
>
> I apologize in advance for a long email ... I'm just trying to be  
> thorough. The bottom line is my own build of Cairo compared with the  
> macports/yum build is MUCH too slow, and I don't know why.
>
> I am working toward getting Cairo to handle all the graphics for  
> GrADS, an open-source program for the analysis and display of  
> meteorological data. The old way of doing graphics in GrADS was a  
> combination of direct calls to the X11 library (for the X window  
> interface), calls to the gd library (for image output), plus some  
> extremely dated code to create postscript output. All text was drawn  
> in Hershey fonts. Cairo improves on this mish-mash in so many ways;  
> the graphics are looking absolutely fantastic, the toy font API is  
> adequate for our needs, and I know my users are going to be very  
> excited when they see these improvements.
>
> For GrADS distribution, I provide binary executables for a small set  
> of platforms, but many users must build from source. GrADS requires  
> a long list of supplemental libraries to fully enable all its  
> features: the current count is 20. With the exception of X11 and a  
> few other system libs, we link statically with all these supplibs,  
> so that our binaries are portable (some of the supplibs GrADS needs  
> are rather obscure.) I get the impression from browsing through the  
> forum archives that linking statically with Cairo isn't really the  
> right way to do it, so during my development and testing I have been  
> linking dynamically with a macports build of Cairo. It's been fine  
> that way, a little slower than the old way of using direct X11  
> calls, but not deal-breakingly slow.
>
> Looking forward to the time when I must put out a release, I am  
> trying to integrate Cairo into the GrADS autoconfiguration scripts  
> and the setup we have for building all the supplibs from source. I  
> can't assume that all my users will have macports or yum to do the  
> dirty work for them, so I provide a set of instructions to build the  
> libraries from source and link them with GrADS. It is something like  
> the end-to-end build instructions on the Cairo website. I try to  
> keep it as simple as possible, and tailor these instructions for the  
> specific needs of GrADS.
>
> Testing out my home-grown Cairo recipe, it built without any  
> problems (specifics given below). Then I linked GrADS two ways, one  
> with the macports build (gfast), the other with my home-grown build  
> (gslow). More specifics on how I linked the executables and output  
> from otool are given below. The performance difference between glsow  
> v. gfast is astonishing. Where gfast took 1-2 seconds to draw a  
> plot, gslow took ~100 seconds to do the same thing. I reran all  
> these steps on our 64-bit linux server running CentOS 5.4 and got  
> similar results.
>
> Thanks to earlier answers I got regarding getting cairo-trace to  
> work, I created a huge trace file, but I'm not sure how to interpret  
> it. It contained ~77,000 fills and ~10,000 strokes. I reran cairo- 
> trace with the --profile option and posted it at ftp://iges.org/pub/jma/gs.89039.lzma 
>  . The output from running cairo-perf-trace on my trace file is  
> given below. I have no idea whether the trace info is helpful.
>
> What I could use is some advice about linking statically v.  
> dynamically for my binary distributions, and some guidance for how  
> to build Cairo from source (with only as-needed features) and link  
> it with my application so that I get the same performance as the  
> carefully packaged, fully-enabled versions of Cairo.
>
> Thank you!!
> --Jennifer
>
>
>
> --
> Jennifer M. Adams
> IGES/COLA
> 4041 Powder Mill Road, Suite 302
> Calverton, MD 20705
> jma at cola.iges.org
>
>
>
> OS X version 10.5.8
>
> > uname -a
> Darwin Atlantic-2.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul  
> 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386
>
> > gcc --version
> i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5490)
>
>
> Configuration options used to build cairo from source:
> pkg-config-0.23
> (I then set the environment vars PKG_CONFIG and PKG_CONFIG_PATH to  
> the appropriate places)
> pixman-0.21.2
> freetype-2.4.3  --without-fsspec --without-fsref --without-ats -- 
> without-quickdraw-toolbox --without-quickdraw-carbon
> fontconfig-2.8.0  --enable-libxml2 --with-freetype-config=...
> cairo-1.10.2 --disable-dependency-tracking \
> --enable-xlib=yes \
> --enable-xml=yes \
> --enable-fc=yes \
> --enable-ft=yes \
> --enable-xlib-xrender=no \
> --enable-xcb=no \
> --enable-qt=no \
> --enable-quartz=no \
> --enable-win32=no \
> --enable-skia=no \
> --enable-os2=no \
> --enable-beos=no \
> --enable-drm=no \
> --enable-pthread \
> --enable-gl=no
>
>
> Linking commands used to build gfast and gslow (relevant bits  
> highlighed in red):
>
> gcc  -g -O2  -lSystemStubs -o gslow grads.o gxsubs.o gxmeta.o  
> gxchpl.o gxcntr.o gxstrm.o gxwmap.o gxshad.o gxshad2.o gaexpr.o  
> gafunc.o gautil.o gagx.o gscrpt.o gamach.o bufrstn.o gabufr.o  
> gabufrtbl.o gxX.o gxdxwd.o galloc.o gaddes.o gaio.o gacfg.o gauser.o  
> gasdf.o gatxt.o -L/Users/jma/supplibs/lib -lcairo -L/usr/X11R6/lib - 
> lX11 /Users/jma/supplibs/lib/libreadline.a /Users/jma/supplibs/lib/ 
> libncurses.a  /Users/jma/supplibs/lib/libgd.a /Users/jma/supplibs/ 
> lib/libpng12.a /Users/jma/supplibs/lib/libz.a /Users/jma/supplibs/ 
> lib/libjpeg.a /Users/jma/supplibs/lib/libgrib2c.a /Users/jma/ 
> supplibs/lib/libjasper.a /Users/jma/supplibs/lib/libpng12.a /Users/ 
> jma/supplibs/lib/libz.a /Users/jma/supplibs/lib/libmfhdf.a /Users/ 
> jma/supplibs/lib/libdf.a /Users/jma/supplibs/lib/libudunits.a /Users/ 
> jma/supplibs/lib/libsz.a /Users/jma/supplibs/lib/libjpeg.a /Users/ 
> jma/supplibs/lib/libz.a /Users/jma/supplibs/lib/libhdf5.a /Users/jma/ 
> supplibs/lib/libsz.a /Users/jma/supplibs/lib/libjpeg.a /Users/jma/ 
> supplibs/lib/libz.a /Users/jma/supplibs/lib/libudunits.a /Users/jma/ 
> supplibs/lib/libnetcdf.a /Users/jma/supplibs/lib/libhdf5_hl.a /Users/ 
> jma/supplibs/lib/libhdf5.a /Users/jma/supplibs/lib/libz.a /Users/jma/ 
> supplibs/lib/libsz.a /Users/jma/supplibs/lib/libcurl.a  /Users/jma/ 
> supplibs/lib/libtiff.a /Users/jma/supplibs/lib/libgeotiff.a /Users/ 
> jma/supplibs/lib/libshp.a  -lm
>
> gcc  -g -O2  -lSystemStubs -o gfast grads.o gxsubs.o gxmeta.o  
> gxchpl.o gxcntr.o gxstrm.o gxwmap.o gxshad.o gxshad2.o gaexpr.o  
> gafunc.o gautil.o gagx.o gscrpt.o gamach.o bufrstn.o gabufr.o  
> gabufrtbl.o gxX.o gxdxwd.o galloc.o gaddes.o gaio.o gacfg.o gauser.o  
> gasdf.o gatxt.o -L/opt/local/lib -lcairo -lX11 /Users/jma/supplibs/ 
> lib/libreadline.a /Users/jma/supplibs/lib/libncurses.a  /Users/jma/ 
> supplibs/lib/libgd.a /Users/jma/supplibs/lib/libpng12.a /Users/jma/ 
> supplibs/lib/libz.a /Users/jma/supplibs/lib/libjpeg.a /Users/jma/ 
> supplibs/lib/libgrib2c.a /Users/jma/supplibs/lib/libjasper.a /Users/ 
> jma/supplibs/lib/libpng12.a /Users/jma/supplibs/lib/libz.a /Users/ 
> jma/supplibs/lib/libmfhdf.a /Users/jma/supplibs/lib/libdf.a /Users/ 
> jma/supplibs/lib/libudunits.a /Users/jma/supplibs/lib/libsz.a /Users/ 
> jma/supplibs/lib/libjpeg.a /Users/jma/supplibs/lib/libz.a /Users/jma/ 
> supplibs/lib/libhdf5.a /Users/jma/supplibs/lib/libsz.a /Users/jma/ 
> supplibs/lib/libjpeg.a /Users/jma/supplibs/lib/libz.a /Users/jma/ 
> supplibs/lib/libudunits.a /Users/jma/supplibs/lib/libnetcdf.a /Users/ 
> jma/supplibs/lib/libhdf5_hl.a /Users/jma/supplibs/lib/libhdf5.a / 
> Users/jma/supplibs/lib/libz.a /Users/jma/supplibs/lib/libsz.a /Users/ 
> jma/supplibs/lib/libcurl.a  /Users/jma/supplibs/lib/libtiff.a /Users/ 
> jma/supplibs/lib/libgeotiff.a /Users/jma/supplibs/lib/libshp.a  -lm
>
>
> > otool -L gslow
> gslow:
>         /Users/jma/supplibs/src/cairo/lib/libcairo.2.dylib  
> (compatibility version 11003.0.0, current version 11003.2.0)
>         /usr/X11/lib/libX11.6.dylib (compatibility version 9.0.0,  
> current version 9.0.0)
>         /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,  
> current version 111.1.5)
>         /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0,  
> current version 1.0.0)
> > otool -L gfast
> gfast:
>         /opt/local/lib/libcairo.2.dylib (compatibility version  
> 11003.0.0, current version 11003.0.0)
>         /opt/local/lib/libX11.6.dylib (compatibility version 10.0.0,  
> current version 10.0.0)
>         /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,  
> current version 111.1.5)
>         /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0,  
> current version 1.0.0)
>
>
> > cairo-perf-trace gg.88743.trace
> [ # ]  backend                         test   min(s) median(s)  
> stddev. count
> [ # ]    image: pixman 0.21.2
> [  0]    image                           gg    0.691    0.696    
> 0.30%    6/6
> [ # ]  image16: pixman 0.21.2
> [  0]  image16                           gg    0.692    0.696    
> 0.21%    6/6
>
>
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20110210/d5286d72/attachment-0001.htm>


More information about the cairo mailing list