简体   繁体   中英

How to install Cairo on R (Termux) with freetype support

I failed to install Cairo package on R(Termux) with:

install.packages('Cairo')

because of it doesn't find freetype support:

configure: error: Cannot use cairo-ft backend, 
although cairo claims it is working. Please check 
your caito installation and/or update cairo if 
necessary or set CAIRO_CFLAGS/CAIRO_LIBS 
accordingly.
ERROR: configuration failed for package ‘Cairo’
* removing  
 ‘/data/data/com.termux/files/usr/lib/R/library/Cairo’
sh: ȫ�: not found

I read here Install Cairo on R that the OP 'had to recompile cairo with --enable-ft=yes. '. I would need to know if this solves the installation failure on R and how to do it on Termux.

try this:

export LD_LIBRARY_PATH=$PREFIX/lib
export CAIRO_INCLUDE_PATH=$PREFIX/include/cairo
export CAIRO_CFLAGS=-I$PREFIX/include/cairo
export CAIRO_LIBS='-L$PREFIX/lib -lcairo'

I wanted to build cairo for a different purpose, but also had the problem of freetype library not being found.

First, cairo's configure is printing checking for FREETYPE... but it is not actually looking for FREETYPE or freetype , it is looking for freetype2 .

Second, freetype library has 2 versioning systems (one returning 2.X and other one returning 9.Y).

Inside configure , around line 30659 there is a such fragment:

# We use pkg-config to look for freetype2, but fall back to
# freetype-config if it fails.  We prefer pkg-config, since we can
# then just put freetype2 >= $FREETYPE_MIN_VERSION in
# Requires.private, but at least up to 2003-06-07, there was no
# freetype2.pc in the release.
#
# FreeType versions come in three forms:
#   release (such as 2.1.9)
#   libtool (such as 9.7.3) (returned by freetype-config and pkg-config)
#   platform-specific/soname (such as 6.3.4)
# and they recommend you never use the platform-specific version
# (see docs/VERSION.DLL in freetype2 sources)
#
# Set these as appropriate:

# release number - for information only
FREETYPE_MIN_RELEASE=2.1.9
# libtool-specific version - this is what is checked
FREETYPE_MIN_VERSION=9.7.3

In my case, pkg-config was using the 2.X one. Chaning the value of FREETYPE_MIN_VERSION to the value of FREETYPE_MIN_RELEASE fixed the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM