On Aug 20, 2021, at 11:43 AM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
Thanks Simon (and Prof Ripley, offline). The --static modifier needs to be added in two places in configure.ac, which leads to it being added in two places in configure.
If anyone wants to build from source, you could get the CRAN release plus this modification using
remotes::install_github("dmurdoch/rgl at configpatch")
Duncan Murdoch
On 19/08/2021 6:08 p.m., Simon Urbanek wrote:
R (and the CRAN builds) use more recent static freetype with harfbuzz support so it does not depend for those in XQuartz.
The issue is that rgl doesn't use sufficient flags to compile against freetype since it misses the dependencies - in fact is fails checks,
https://www.r-project.org/nosvn/R.check/r-release-macos-arm64/rgl-00check.html
pkg-config has to be used with --static --libs otherwise the linking doesn't have all the dependencies included that are necessary:
$ pkg-config freetype2 --libs
-L/opt/R/arm64/lib -lfreetype
$ pkg-config freetype2 --static --libs
-L/opt/R/arm64/lib -lfreetype -lbz2 -lpng16 -lz -lharfbuzz -lm -lglib-2.0 -lintl -liconv -lm -Wl,-framework,CoreFoundation -Wl,-framework,Carbon -Wl,-framework,Foundation -Wl,-framework,AppKit -lpcre
The CRAN binaries are built against static libraries to make sure the user doesn't have to install 3rd party dependencies.
It looks line rgl does the right thing for libpng but not for freetype.
Cheers,
Simon
On Aug 19, 2021, at 9:54 PM, Stefan Evert <stefanML at collocations.de> wrote:
On 19 Aug 2021, at 10:40, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
Error in dyn.load(dynlib <- getDynlib(dir)) :
unable to load shared object '/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/rgl/libs/rgl.so':
dlopen(/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/rgl/libs/rgl.so, 6): Symbol not found: _hb_buffer_add_utf8
Referenced from: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/rgl/libs/rgl.so
Expected in: flat namespace
in /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/rgl/libs/rgl.so
That looks like a symbol in the harfbuzz lib. rgl doesn't reference it directly, I think FreeType does. I don't know what you need to do to fix this, but maybe that's enough of a hint.
I just ran into the same problem with a M1 MacBook and XQuartz 2.8.1 installed. My MacBook has no developer tools installed, not even XCode ? just R, "rgl" (and various other packages) from CRAN, and XQuartz.
XQuartz doesn't include libharfbuzz, so I doubt that it's libfreetype depends on it. Any chance that the CRAN machine that builds the aarch64 binary package links against some other version of freetype that pulls in the dependency?
Best,
Stefan