Question

I am trying to install the cairo backend for the Chart package. I first installed GTK and cairo as per the instructions here (Chart instructions) and here (GTK/cairo) and have the newest versions as of this post: cairo-0.12.5.3 and gtk-0.12.5.7.

However, when trying to use cairo, I run into a wall with the following step.

> cabal install chart-cairo
Resolving dependencies...
Configuring Chart-cairo-1.2.2...
Building Chart-cairo-1.2.2...
Preprocessing library Chart-cairo-1.2.2...
[1 of 1] Compiling Graphics.Rendering.Chart.Backend.Cairo ( Graphics\Rendering\Chart\Backend\Cairo.hs, dist\build\Graphics\Rendering\Chart\Backend\Cairo.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.4.0.1 ... linking ... done.
Loading package deepseq-1.3.0.1 ... linking ... done.
Loading package bytestring-0.10.0.2 ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package mtl-2.1.2 ... linking ... done.
Loading package utf8-string-0.3.7 ... linking ... done.
Loading package cairo-0.12.5.3 ... linking ... ghc.exe: C:\Users\user\AppData\Roaming\cabal\i386-windows-ghc-7.6.3\cairo-0.12.5.3\libHScairo-0.12.5.3.a: unknown symbol `_cairo_region_create_rectangles'*
ghc.exe: unable to load package `cairo-0.12.5.3'
Failed to install Chart-cairo-1.2.2
cabal: Error: some packages failed to install:
Chart-cairo-1.2.2 failed during the building phase. The exception was:
ExitFailure 1

Other cairo programs fail as well. The Drawing.hs file installed with it, for example, fails with:

Loading package cairo-0.12.5.3 ... linking ... <interactive>: C:\Users\user\AppData\Roaming\cabal\i386-windows-ghc-7.6.3\cairo-0.12.5.3\libHScairo-0.12.5.3.a: unknown symbol `_cairo_region_create_rectangles'
ghc.exe: unable to load package `cairo-0.12.5.3'

The symbol is missing from the .a file. nm lists it as u (undefined).

There's an open bug on this, but it hasn't been touched in three years. (The bug has a comment that suggests the problem is related to Template Haskell, but I am not doing anything with TH.)

Do I need a newer or older version of the cairo library or something? Where is the above function defined and why isn't it in the library? Any suggestions of how to address this?

Thanks!

EDIT I finally determined that Graphviz and Gnuplot were higher in %PATH% than than the GTK bundle and both have their own cairo.dll. Hence, the wrong one was getting picked up by the runtime linker. After removing those path elements and attempting a reinstall of all of cairo and GTK. I run into a new problem:

`libHSgtk-0.12.5.7.a: unknown symbol `__imp___fmode'`.  

I tried a clean install of the Haskell gtk and cairo packages (the whole process) and ensured all the dlls loaded this time and verified the GTK directory with Process Explorer. Sadly, I don't have any more time to work on this and must abandon attempting to get cairo working with Haskell on Windows. Maybe I'll try it again someday in the future.

Was it helpful?

Solution

According to Cairo Commit logs, the leading underscoreof that function has been removed in cairo-1.9.2. Consider using a version prior to it if the caller is on Haskel side (which seems not according to our comments) or a version newer if the exception is thrown inside gtk package.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top