[R-SIG-Mac] rgl in R version 4.1.1 Patched (2021-08-13 r80752)

Duncan Murdoch murdoch@dunc@n @end|ng |rom gm@||@com
Fri Aug 20 14:05:17 CEST 2021


On 19/08/2021 8:57 p.m., Simon Urbanek wrote:
> Duncan,
> 
> using that checkout I get
> 
> * checking package dependencies ... ERROR
> Package suggested but not available: ‘webshot2’

webshot2 still hasn't been sent to CRAN, so I've been putting tarballs 
on a Drat repos, and the DESCRIPTION has this:

   Additional_repositories:  https://dmurdoch.github.io/drat

Do you know if your check looked in that repos and didn't see it, or did 
it not look there?

BTW, the reason I am including a non-CRAN package is because it has 
several advantages over the internal rgl.snapshot.  rgl.snapshot 
requires that the scene be displayed on a local screen so it can't run 
on a headless machine; it also uses the very old rendering built in to 
rgl's in-R display, so typically produces poorer quality screenshots 
than webshot2 produces.  The main disadvantages of webshot2 are that 
it's not on CRAN and it's typically quite a bit slower than rgl.snapshot.

> 
> but otherwise it works as advertised.
> 
> However, I just found out that there is another problem in R that rgl exposed. Using non-session terminal:
> 
>> png("/tmp/1.png", type="quartz")
>> plot(1)
> Warning in axis(side = side, at = at, labels = labels, ...) :
>    no font could be found for family "Arial"
> 
> so requests for fonts using Quartz-back-end without an UI session fail. It works fine inside a session, but since checks are normally run without a session that explains the check failures. I can run checks in a session, so I think that's what I'll do for now.
> 
> Now, back to rgl - so checks can be run in a session, but oddly, rgl manages to segfault XQuartz in the checks. I don't think it's rgl's fault - more likely something in XQuartz (a TCP connection shouldn't be able to segfault the other end...).

I don't have an ARM machine to test on, but on my machine when running 
in lldb I see messages like these on startup:

2021-08-20 08:00:26.791865-0400 R[79608:1971631] flock failed to lock 
maps file: errno = 35
2021-08-20 08:00:26.796823-0400 R[79608:1971631] flock failed to lock 
maps file: errno = 35

and when I actually do some plotting I see lots like these:

2021-08-20 08:00:47.459884-0400 R[79608:1971542] 
apple_glx_create_context: ac 0x100a99830 ac->context_obj 0x106f4ea00
2021-08-20 08:00:47.460043-0400 R[79608:1971542] 
apple_glx_drawable_create: new drawable 0x103363e00
2021-08-20 08:00:47.461620-0400 R[79608:1971542] create_surface: created 
a surface for drawable 0x600067 with uid 49
2021-08-20 08:00:47.461657-0400 R[79608:1971542] surface_make_current: 
ac->context_obj 0x106f4ea00 s->surface_id 9
2021-08-20 08:00:47.462172-0400 R[79608:1971542] surface_make_current: 
drawable 0x600067
2021-08-20 08:00:47.462203-0400 R[79608:1971542] applegl_bind_context: 
error NO
2021-08-20 08:00:47.469827-0400 R[79608:1971542] caller is the same 
thread for uid 49
2021-08-20 08:00:47.470001-0400 R[79608:1971542] surface notify updated 0
2021-08-20 08:00:47.470340-0400 R[79608:1971542] caller is the same 
thread for uid 49

They don't seem to lead to any problems, but maybe on an ARM they're 
more serious.



> 
> Anyway, so if you can post the fixed release I'd be happy the recompile and publish manually.

Okay, I'll package it up and send it to CRAN.

Duncan Murdoch

> 
> Cheers,
> Simon
> 
> PS: I found yet another problem - XQuartz has moved the location of fonts from X11/lib to X11/shared so our fontconfig configuration in R needs to add that directory as well. So all is all this has highlighted quite a few related issues ;)
> 
> 
> 
>> On Aug 20, 2021, at 11:43 AM, Duncan Murdoch <murdoch.duncan using 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 using 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 using collocations.de> wrote:
>>>>
>>>>
>>>>
>>>>> On 19 Aug 2021, at 10:40, Duncan Murdoch <murdoch.duncan using 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
>>>> _______________________________________________
>>>> R-SIG-Mac mailing list
>>>> R-SIG-Mac using r-project.org
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>>>
>>
>



More information about the R-SIG-Mac mailing list