[R-SIG-Mac] Compiling Cairo
Simon Urbanek
simon.urbanek at r-project.org
Thu Apr 9 20:58:30 CEST 2015
Simon,
On Apr 9, 2015, at 5:35 AM, O'Hanlon, Simon J <simon.ohanlon at imperial.ac.uk> wrote:
> Dear Simon,
> Thanks for the fast reply. I did not compile R from source. Also I was
> trying to compile Cairo myself because if I used the pre-built binary from
> CRAN I get the error: "Failed to create Cairo backend!² when trying to use
> the postscript device.
>
Can you tell us what you actually did? The PS output works just fine in the CRAN binary AFAICT:
> Cairo(5,5,"test.ps","ps",units="in")
> plot(1:10)
> dev.off()
null device
1 > readLines("test.ps",5)
[1] "%!PS-Adobe-3.0"
[2] "%%Creator: cairo 1.12.16 (http://cairographics.org)"
[3] "%%CreationDate: Thu Apr 9 14:52:39 2015"
[4] "%%Pages: 1"
[5] "%%DocumentData: Clean7Bit"
> sessionInfo()
R version 3.1.2 Patched (2015-01-20 r67580)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.9.5 (Mavericks)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] Cairo_1.5-6
loaded via a namespace (and not attached):
[1] tools_3.1.2
> I completely removed all Homebrew packages and Homebrew itself. I also
> removed X11 using this gist:
> https://gist.github.com/TonyMtz/714e73ccb79e21c4fc9c.
>
> I then removed any installations I had made of the libraries cario,
> freetype and pixman using sudo make uninstall.
>
> I tried to install Cairo from source again and unsurprisingly it could not
> compile because no working installation of cairo or it¹s dependencies
> could be found. Great! I then reinstalled Homebrew and cairo, pkg-config,
> and X11 (via Homebrew) and their various dependencies.
>
> I realised that pkg-config was not looking in the right place for my
> installed libraries so I set the correct path using:
>
> Sys.setnev(
> PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig²)
>
> I then get the following output from the configure script which seems to
> indicate I am now entirely compiling against Homebrew installed packages
> (I think - sorry, I am relatively inexperienced at this):
>
> checking for pkg-config... /usr/local/bin/pkg-config
> checking whether pkg-config knows about cairo... yes
> checking for configurable backends... cairo cairo-ft cairo-pdf cairo-png
> cairo-ps cairo-xlib cairo-xlib-xrender
> configure: CAIRO_CFLAGS=-I/usr/local/Cellar/cairo/1.14.2/include/cairo
> -I/usr/local/Cellar/glib/2.44.0/include/glib-2.0
> -I/usr/local/Cellar/glib/2.44.0/lib/glib-2.0/include
> -I/usr/local/opt/gettext/include
> -I/usr/local/Cellar/pixman/0.32.6/include/pixman-1
> -I/usr/local/Cellar/fontconfig/2.11.1/include
> -I/usr/local/Cellar/freetype/2.5.3_1/include/freetype2
> -I/usr/local/Cellar/freetype/2.5.5/include/freetype2
> -I/usr/local/Cellar/libpng/1.6.16/include/libpng16 -I/opt/X11/include
> checking if R was compiled with the RConn patch... no
> checking cairo.h usability... yes
> checking cairo.h presence... yes
> checking for cairo.h... yes
> checking for PNG support in Cairo... yes
> checking for ATS font support in Cairo... no
> configure: CAIRO_LIBS=-L/usr/local/Cellar/freetype/2.5.5/lib
> -L/usr/local/Cellar/libpng/1.6.16/lib -L/usr/local/Cellar/cairo/1.14.2/lib
> -L/opt/X11/lib -lfreetype -lz -lpng16 -lz -lcairo -lXext -lXrender -lX11
>
>
> However, the exact same error persists. I also tried to compile using
> gcc-4.9 rather than clang, but same difference. So would your
> recommendation would be to attempt to compile R myself?
>
The main question is which libraries get loaded. You can follow the trace using DYLD_PRINT_LIBRARIES=1 to see if anything gets loaded out of order. I wouldn't really recommend compiling R and all packages from sources unless you have a very specific reason to do so.
What OS X version are you using?
Cheers,
Simon
> Many thanks,
>
> Simon
>
>
> On 09/04/2015 02:31, "Simon Urbanek" <simon.urbanek at r-project.org> wrote:
>
>>
>> On Apr 8, 2015, at 7:27 PM, O'Hanlon, Simon J
>> <simon.ohanlon at imperial.ac.uk> wrote:
>>
>>> I'm trying to compile Cairo on OS X 10.10.2 and R 3.1.3. ./configure
>>> seems to run ok, but I get a compilation error about a symbol not being
>>> found, namely _FT_Done_Face. The details are:
>>>
>>> Error : .onLoad failed in loadNamespace() for 'Cairo', details:
>>> call: dyn.load(file, DLLpath = DLLpath, ...)
>>> error: unable to load shared object
>>> '/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Cairo/lib
>>> s/Cairo.so':
>>>
>>> dlopen(/Library/Frameworks/R.framework/Versions/3.1/Resources/library/Cai
>>> ro/libs/Cairo.so, 6): Symbol not found: _FT_Done_Face
>>> Referenced from:
>>> /Library/Frameworks/R.framework/Versions/3.1/Resources/library/Cairo/libs
>>> /Cairo.so
>>> Expected in: flat namespace
>>> in
>>> /Library/Frameworks/R.framework/Versions/3.1/Resources/library/Cairo/libs
>>> /Cairo.so
>>> Error: loading failed
>>> Execution halted
>>>
>>
>> That's not a compilation error but rather a run-time error.
>>
>>
>>> Am I missing some dependency or something?
>>>
>>
>> My guess would be that you have multiple versions of FreeType and the
>> wrong one is picked up. It seems as if you have an odd mix of homebrew
>> and X11 which may be the problem. Did you compile everything from source
>> (including R)? If not, you'll have a hard time cleaning things up to work
>> with the system libraries, R and homebrew -- I'd recommend staying away
>> from trying to mix all three together (i.e., use either CRAN or homebrew
>> but not both).
>>
>> Cheers,
>> Simon
>>
>>
>>> So as not to clog the post, my sessionInfo() is available at:
>>> http://pastebin.com/raw.php?i=kQFiY699
>>> And the output of ./configure is available at:
>>> http://pastebin.com/raw.php?i=wCUGtbBZ
>>>
>>> Thanks,
>>>
>>> Simon
>>>
>>>
>>>
>>> [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> R-SIG-Mac mailing list
>>> R-SIG-Mac at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>
>
More information about the R-SIG-Mac
mailing list