[cairo] How to build without librsvg, libspectre, poppler

Ryan Schmidt cairo-2012b at ryandesign.com
Tue Apr 10 02:56:03 PDT 2012


On Apr 9, 2012, at 06:57, Uli Schlachter wrote:

> On 09.04.2012 12:29, Ryan Schmidt wrote:
>> Hello, I'm the maintainer of cairo in MacPorts. Since upgrading to 1.12, some users have reported build failures because of libraries cairo is using that I did not expect it to use.
>> 
>> Cairo in MacPorts currently expects the following dependencies:
>> 
>> $ port -q deps cairo
>> Build Dependencies:   pkgconfig
>> Library Dependencies: libpixman, glib2, fontconfig, freetype, libpng, zlib, expat, xrender, xorg-xcb-util
>> 
>> But we have users reporting that it's also using librsvg, libspectre and poppler.
>> 
>> How do I inform the cairo build process not to use those libraries? "configure --help" does not show any obvious switches.
>> 
>> Or, why would I want cairo to use those libraries?
>> 
>> librsvg is particularly puzzling; how can cairo be using librsvg, when librsvg itself uses cairo? That's a circular dependency, something MacPorts cannot accommodate.
> 
> Hi,
> 
> librsvg seems to be needed for the SVG backend's test suite. There doesn't seem
> to be an obvious switch to disable that, but since it's only the test suite that
> uses this, is that really a problem?
> As a hack, the following might work:
>  ./configure ac_cv_func_rsvg_pixbuf_from_file=no
> 
> The story with libspectre seems to be similar. This one is used for the ps
> backend's tests. For this one, I didn't find a hack like the above. Again, what
> is the problem with this? The test suite doesn't get installed, does it?
> 
> Finally we got poppler. This is needed for the PDF backend's tests. The hack to
> disable this would be
>  ./configure ac_cv_func_poppler_page_render=no
> 
> I hope this makes it clear why cairo uses these libraries. However, I'd still
> like to know what symptoms you see that makes these a problem.

The architecture(s) for which the user is building cairo is not necessarily the same as the architecture(s) for which librsvg, libspectre, or poppler were already installed. When it isn't, the build will fail with an architecture mismatch.

On most Macs today (i.e. 64-bit Intel Macs running Snow Leopard or later) the default build architecture is x86_64. But some software does not work 64-bit, like wine, which must still be built for i386.

The situation several 64-bit Intel Mac users with Snow Leopard or later have therefore run into is:

At some point, they installed librsvg, libspectre, and/or poppler, or a 64-bit-capable port that depends on them, so these ports are now installed for x86_64. cairo might also be installed for x86_64 by now.

Then later, the user wants to install wine (or another 32-bit-only port that needs cairo). MacPorts knows that wine only builds 32-bit, therefore it installs any normally 64-bit dependencies of wine -- including cairo -- as universal: 64-bit and 32-bit in the same file. Because librsvg, libspectre and poppler are not among the dependencies of cairo that MacPorts knows about, MacPorts does not rebuild them universal. Therefore when i386 portion of the universal build of cairo tries to access the x86_64-only librsvg, libspectre or poppler installations, something like this happens:


ld: warning: in /opt/local/lib/libpoppler-glib.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /opt/local/lib/libpoppler.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /opt/local/lib/librsvg-2.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /opt/local/lib/libspectre.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
Undefined symbols:
  "_spectre_render_context_set_page_size", referenced from:
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_page_free", referenced from:
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_document_status", referenced from:
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_page_status", referenced from:
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_status_to_string", referenced from:
      _ps_convert in any2ppm-any2ppm.o
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_document_render", referenced from:
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_page_render", referenced from:
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_document_new", referenced from:
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_render_context_free", referenced from:
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_page_get_size", referenced from:
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_document_free", referenced from:
      _ps_convert in any2ppm-any2ppm.o
      _ps_convert in any2ppm-any2ppm.o
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_document_get_page_size", referenced from:
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_document_get_page_by_label", referenced from:
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_render_context_new", referenced from:
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_document_load", referenced from:
      _ps_convert in any2ppm-any2ppm.o
ld: symbol(s) not found
collect2: ld returned 1 exit status


All of which reinforces the sanity of MacPorts' existing policy: a port must declare a dependency on every other port it will use; conversely, a port may not use another port that's already installed if it does not declare a dependency on it. We want repeatable predictable builds. That means cairo (and all other ports) should build the same way on every user's system, regardless what other software the user may already have installed.

Thank you for the ac_cv configure flags, but they don't seem to help. Using them, the configure output now shows:


checking for cairo's PostScript surface backend feature... 
checking whether cairo's PostScript surface backend feature could be enabled... yes
checking for gs... gs
checking for LIBSPECTRE... yes
checking for cairo's PDF surface backend feature... 
checking whether cairo's PDF surface backend feature could be enabled... yes
checking for POPPLER... yes
checking for poppler_page_render... (cached) no
configure: WARNING: PDF backend will not be tested since poppler >= 0.17.4 is not available
checking for cairo's SVG surface backend feature... 
checking whether cairo's SVG surface backend feature could be enabled... yes
checking for LIBRSVG... yes
checking for rsvg_pixbuf_from_file... (cached) no
configure: WARNING: SVG backend will not be tested since librsvg >= 2.15.0 is not available


So, remaining unexpected results there include "checking for gs... gs", "checking for LIBSPECTRE... yes", "checking for POPPLER... yes", "checking for LIBRSVG... yes". I would expect those to all read "no" or "disabled" or something.

The build output still contains:


ld: warning: in /opt/local/lib/libpoppler-glib.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /opt/local/lib/libpoppler.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /opt/local/lib/librsvg-2.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /opt/local/lib/libspectre.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
Undefined symbols:
  "_spectre_render_context_set_page_size", referenced from:
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_page_free", referenced from:
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_document_status", referenced from:
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_page_status", referenced from:
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_status_to_string", referenced from:
      _ps_convert in any2ppm-any2ppm.o
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_document_render", referenced from:
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_page_render", referenced from:
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_document_new", referenced from:
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_render_context_free", referenced from:
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_page_get_size", referenced from:
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_document_free", referenced from:
      _ps_convert in any2ppm-any2ppm.o
      _ps_convert in any2ppm-any2ppm.o
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_document_get_page_size", referenced from:
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_document_get_page_by_label", referenced from:
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_render_context_new", referenced from:
      _ps_convert in any2ppm-any2ppm.o
  "_spectre_document_load", referenced from:
      _ps_convert in any2ppm-any2ppm.o
ld: symbol(s) not found
collect2: ld returned 1 exit status


I've also tried running ./configure with:


LIBRSVG_CFLAGS=" "
LIBRSVG_LIBS=" "
LIBSPECTRE_CFLAGS=" "
LIBSPECTRE_LIBS=" "
POPPLER_CFLAGS=" "
POPPLER_LIBS=" "


This gets rid of the "was built for unsupported file format which is not the architecture being linked" messages, but the ultimate undefined _spectre_* symbol errors remain.




More information about the cairo mailing list