[Rd] rgl install for R 3.7

Prof Brian Ripley r|p|ey @end|ng |rom @t@t@@ox@@c@uk
Sun Jun 2 20:42:38 CEST 2019

On 02/06/2019 16:28, Koenker, Roger W wrote:
> I’ve installed R 3.7.0 on a new laptop running macos 10.14.5 and have managed to get most of my usual packages

I presume 'R 3.7.0' is R-devel: it is not released and may never be 
released under that version.

> to compile from source with a ~/.R/Makevars file that looks like this:
> CC=/usr/local/clang8/bin/clang
> CXX=/usr/local/clang8/bin/clang++
> LDFLAGS=-L/usr/local/clang8/lib
> CPPFLAGS=-I/usr/local/clang8/include -I/opt/X11/include/freetype2

I suspect you don't want the second: if you have pkg-config it should 
find include paths for you.

> FC=/usr/local/gfortran/bin/gfortran
> FLIBS=-L/usr/local/gfortran/lib -lgfortran
> As usual, the last challenge seems to be to get rgl installed.  Compilation _seems_ to go
> smoothly, but I now see:
> Error in dyn.load(file, DLLpath = DLLpath, ...) :
>    unable to load shared object '/Library/Frameworks/R.framework/Versions/3.7/Resources/library/00LOCK-rgl/00new/rgl/libs/rgl.so':
>    dlopen(/Library/Frameworks/R.framework/Versions/3.7/Resources/library/00LOCK-rgl/00new/rgl/libs/rgl.so, 6): Symbol not found: _FT_Attach_File
>    Referenced from: /Library/Frameworks/R.framework/Versions/3.7/Resources/library/00LOCK-rgl/00new/rgl/libs/rgl.so

Perhaps you should show the linking line.  A similar setup works for me:

configure: Darwin, so ensuring /opt/X11/bin is at the head of the PATH...
checking for pkg-config... yes

Do you have pkg-config (it is not a standard part of macOS, but is 
available on SU's site -- see the R-admin manual)?  You may need to set 
its path: for rgl I used


(which should be the default) but for a few packages (Cairo gdtools rsvg)


/usr/local/clang8/bin/clang++ -std=gnu++11 -dynamiclib 
-Wl,-headerpad_max_install_names -undefined dynamic_lookup 
-single_module -multiply_defined suppress -L/Users/ripley/R/R-devel/lib 
-L/usr/local/clang8/lib -L/usr/local/lib -o rgl.so ABCLineSet.o 
BBoxDeco.o Background.o ClipPlane.o Color.o Disposable.o Light.o 
LineSet.o LineStripSet.o Material.o NULLgui.o PlaneSet.o PointSet.o 
PrimitiveSet.o RenderContext.o Shape.o SphereMesh.o SphereSet.o 
SpriteSet.o String.o Surface.o TextSet.o Texture.o Viewpoint.o api.o 
assert.o callbacks.o device.o devicemanager.o fps.o ftgl.o geom.o 
gl2ps.o glErrors.o glgui.o gui.o init.o par3d.o pixmap.o platform.o 
pretty.o render.o rglmath.o rglview.o scene.o select.o subscene.o 
win32gui.o win32lib.o x11gui.o x11lib.o -lGLU -lGL -framework GLKit 
-framework OpenGL -dylib_file 
-L/usr/local/lib -lpng16 -L/usr/X11/lib -lX11 -L/usr/local/lib 
-lfreetype -L/Users/ripley/R/R-devel/lib -lR -Wl,-framework 

so that is statically linking libfreetype from /usr/local/lib and 
installed from 
https://mac.r-project.org/libs/freetype-2.5.5-darwin.13-x86_64.tar.gz . 
And that provides a freetype2.pc file, so

% pkg-config freetype2 --cflags
-I/usr/local/include/freetype2 -I/usr/local/include/libpng16
% pkg-config freetype2 --libs
-L/usr/local/lib -lfreetype

> There is a comment somewhat after this about rgl requiring XQuartz, but I have  XQuartz 2.7.11 so I don’t
> think that this is the problem.  Apparently, there is still a freetype problem, however I’m out of my depth at this
> point.   Any suggestions would be most welcome.
> Roger Koenker
> Honorary Professor
> Department of Economics, UCL
> London  WC1H 0AX.

Brian D. Ripley,                  ripley using stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford

More information about the R-devel mailing list