[R-SIG-Mac] Installing svglite in R-devel

peter dalgaard pd@|gd @end|ng |rom gm@||@com
Thu May 22 14:17:27 CEST 2025


(Simon will say something about not to use config.site...)

I think you need LDFLAGS in config.site. For the nightlies, I have

% more ~/r-devel/config.site 
CPPFLAGS=-I/opt/R/arm64/include
LDFLAGS=-L/opt/R/arm64/lib
with_tcl_config=/opt/R/arm64/lib/tclConfig.sh
with_tk_config=/opt/R/arm64/lib/tkConfig.sh

-pd

> On 22 May 2025, at 13:35 , Duncan Murdoch <murdoch.duncan using gmail.com> wrote:
> 
> I'm trying to install the svglite package in R-devel on my M3 Mac running Sonoma 14.7.1, and getting these results:
> 
>>> install.packages("svglite")
>> --- Please select a CRAN mirror for use in this session ---
>> trying URL 'https://cloud.r-project.org/src/contrib/svglite_2.2.1.tar.gz'
>> Content type 'application/x-gzip' length 134155 bytes (131 KB)
>> ==================================================
>> downloaded 131 KB
>> * installing *source* package ‘svglite’ ...
>> ** this is package ‘svglite’ version ‘2.2.1’
>> ** package ‘svglite’ successfully unpacked and MD5 sums checked
>> ** using staged installation
>> ** libs
>> using C++ compiler: ‘Apple clang version 16.0.0 (clang-1600.0.26.6)’
>> using SDK: ‘MacOSX15.2.sdk’
>> clang++ -std=gnu++17 -I"/Users/murdoch/R/R-devel/include" -DNDEBUG  -I'/Users/murdoch/R/R-devel/library/cpp11/include' -I'/Users/murdoch/R/R-devel/library/systemfonts/include' -I'/Users/murdoch/R/R-devel/library/textshaping/include' -isystem /opt/R/arm64/include    -fPIC  -g -O2   -c SvgStream.cpp -o SvgStream.o
>> clang++ -std=gnu++17 -I"/Users/murdoch/R/R-devel/include" -DNDEBUG  -I'/Users/murdoch/R/R-devel/library/cpp11/include' -I'/Users/murdoch/R/R-devel/library/systemfonts/include' -I'/Users/murdoch/R/R-devel/library/textshaping/include' -isystem /opt/R/arm64/include    -fPIC  -g -O2   -c cpp11.cpp -o cpp11.o
>> clang++ -std=gnu++17 -I"/Users/murdoch/R/R-devel/include" -DNDEBUG  -I'/Users/murdoch/R/R-devel/library/cpp11/include' -I'/Users/murdoch/R/R-devel/library/systemfonts/include' -I'/Users/murdoch/R/R-devel/library/textshaping/include' -isystem /opt/R/arm64/include    -fPIC  -g -O2   -c devSVG.cpp -o devSVG.o
>> clang++ -std=gnu++17 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -L/Users/murdoch/R/R-devel/lib -L/usr/local/lib -o svglite.so SvgStream.o cpp11.o devSVG.o -lpng -lz -L/Users/murdoch/R/R-devel/lib -lR
>> ld: library 'png' not found
>> clang++: error: linker command failed with exit code 1 (use -v to see invocation)
>> make: *** [svglite.so] Error 1
>> ERROR: compilation failed for package ‘svglite’
>> * removing ‘/Users/murdoch/R/R-devel/library/svglite’
> 
> I do have libpng installed:
> 
>> murdoch using djmair4 /opt/R/arm64/lib
>> $ ls -l libpng*
>> lrwxr-xr-x  1 root  admin       10 30 Mar 18:58 libpng.a@ -> libpng16.a
>> lrwxr-xr-x  1 root  admin       11 30 Mar 18:58 libpng.la@ -> libpng16.la
>> -rw-r--r--  1 root  admin  1094008 30 Mar 18:58 libpng16.a
>> -rwxr-xr-x  1 root  admin      895 30 Mar 18:58 libpng16.la*
> 
> I have a config.site file in the R-devel-src folder, modified with these changes:
> 
>> Index: config.site
>> ===================================================================
>> --- config.site	(revision 88220)
>> +++ config.site	(working copy)
>> @@ -45,7 +45,7 @@
>> ## It is also necessary to set the architecture here, e.g. 'gcc -m32'.
>> ## If this is a wrapper it should pass on --version to the real compiler.
>> ## This will be replaced by CC23 (see below) if a C23 compiler is found.
>> -## CC=
>> +CC=clang
>>  ## Debugging and optimization options for the C compiler.
>> ## Use this to specify CFLAGS for the version of the C compiler
>> @@ -111,12 +111,12 @@
>> ## options (such as defines) for the C preprocessor and compiler.
>> ## If unset defaults to '-I/usr/local/include', with '-I/sw/include'
>> ## prepended on systems using Fink with root '/sw'.
>> -## CPPFLAGS=
>> +CPPFLAGS='-isystem /opt/R/arm64/include'
>>  ## The command which runs the Fortran compiler.
>> ## Used for both fixed-form and free-form Fortran
>> ## If this is a wrapper it should pass on --version to the real compiler.
>> -## FC=
>> +FC="/opt/gfortran/bin/gfortran -mtune=native"
>>  ## Options for the Fortran compiler.
>> ## Use this to specify comilation flags for fixed-form Fortran.
>> @@ -223,7 +223,7 @@
>> ## and then looks under the names 'c++', 'g++', 'CC' and more OS-specific
>> ## names (from autoconf).
>> ## If this is a wrapper it should pass on --version to the real compiler.
>> -## CXX=
>> +CXX=clang++
>>  ## Options for the C++ compiler.
>> ## CXXFLAGS=
>> @@ -255,7 +255,7 @@
>>  ## Objective-C(++), mainly for macOS
>> ## On macOS, Apple clang with additional gcc flag -fobjc-exceptions
>> -## OBJC=
>> +OBJC=$CC
>> ## OBJCFLAGS=
>> ## OBJC_LIBS-
>> ## Objective-C compiler, usually the same as $CXX $CXXSTD
> 
> Can anyone spot what needs fixing?
> 
> Duncan Murdoch
> 
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes using cbs.dk  Priv: PDalgd using gmail.com



More information about the R-SIG-Mac mailing list