[R-SIG-Mac] Source install calling "wrong" pkg-config -- how to fix R search path?

Tom Hopper tomhopper at gmail.com
Tue Apr 28 23:35:49 CEST 2015


Hello. I have a couple of packages---sysfonts and showtext—that I’m trying to update from source. I’ve successfully installed other packages from source in the past with no problems, but these packages have dependencies on libpng and freetype2, and the build is failing because pkg-config cannot find the libraries. Most likely, I previously installed these from binary, but the binaries have not been updated.

With Xcode, Fink and MacPorts (DarwinPorts) installed, I have at least three copies of pkg-config installed, and two copies each of libpng and freetype2. Cleaning up that mess is beyond my terminal skills. Unfortunately, R is using the one version of pkg-config that refuses to find any copy of libpng or freetype2. You can see the errors in the build process below my signature, as well as the output of sessionInfo().

I believe that if I could point R to one of the other copies of pkg-config (e.g. the version in /opt/local/bin/ instead of the version in /usr/local/bin/), then this problem would clear itself up. However, I cannot figure out how to do this. My search skills must be failing me, because I cannot figure out where R is getting its PATH variable from. I would expect it’s the global Mac OS PATH variable, but R and Terminal are calling different copies of pkg-config, so I’m thinking R is creating its own PATH variable. For example, “which pkg-config” in the Terminal and “system(“which pkg-config”)” in R return different paths (“/opt/local/bin/pkg-config” and “usr/local/bin/pkg-config” respectively).

Any help is much appreciated.

Thank you,

Tom

* installing *source* package ‘showtext’ ...
** package ‘showtext’ successfully unpacked and MD5 sums checked
checking for gcc... clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether clang accepts -g... yes
checking for clang option to accept ISO C89... none needed
checking for pkg-config... /usr/local/bin/pkg-config
checking whether pkg-config could find zlib... yes
checking whether pkg-config could find libpng... no
checking whether pkg-config could find freetype2... no
checking for png_init_io in -lpng... no

****************************************************
Error: libpng not found.
If you have not installed libpng, you can download
the source code from http://www.libpng.org/

In Debian/Ubuntu-like systems, you can use
  "sudo apt-get install libpng12-dev"
to install libpng

For rpm-based systems, try
  "sudo yum install libpng-devel"
****************************************************

ERROR: configuration failed for package ‘showtext’
* removing ‘/Users/tomhopper/Library/R/3.2/library/showtext’
* restoring previous ‘/Users/tomhopper/Library/R/3.2/library/showtext’
Warning in install.packages :
  installation of package ‘showtext’ had non-zero exit status


Output of sessionInfo():

R version 3.2.0 (2015-04-16)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.3 (Yosemite)

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] graphics  grDevices utils     datasets  stats     methods   base

other attached packages:
[1] tidyr_0.2.0   dplyr_0.4.1   ggplot2_1.0.1

loaded via a namespace (and not attached):
 [1] Rcpp_0.11.5      digest_0.6.8     assertthat_0.1   MASS_7.3-40      grid_3.2.0       plyr_1.8.2
 [7] gtable_0.1.2     DBI_0.3.1        magrittr_1.5     scales_0.2.4     reshape2_1.4.1   proto_0.3-10
[13] tools_3.2.0      stringr_0.6.2    munsell_0.4.2    parallel_3.2.0   colorspace_1.2-6

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 670 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20150428/49f1bd6b/attachment.bin>


More information about the R-SIG-Mac mailing list