Reputation: 31
I'm working on this code, and when I try to knit analyses.Rmd on one of my computers, I get an error specifically due to the attempt to load kableExtra:
Error: package or namespace load failed for ‘kableExtra’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/Users/acristia/Library/Application Support/renv/cache/v5/R-4.1/x86_64-apple-darwin17.0/systemfonts/1.0.3/5be9fcf8ef6763e8cb13ab009e273a1d/systemfonts/libs/systemfonts.so': dlopen(/Users/acristia/Library/Application Support/renv/cache/v5/R-4.1/x86_64-apple-darwin17.0/systemfonts/1.0.3/5be9fcf8ef6763e8cb13ab009e273a1d/systemfonts/libs/systemfonts.so, 0x0006): Library not loaded: /usr/local/opt/freetype/lib/libfreetype.6.dylib Referenced from: /Users/acristia/Library/Application Support/renv/cache/v5/R-4.1/x86_64-apple-darwin17.0/systemfonts/1.0.3/5be9fcf8ef6763e8cb13ab009e273a1d/systemfonts/libs/systemfonts.so Reason: tried: '/usr/local/opt/freetype/lib/libfreetype.6.dylib' (no such file), '/Library/Frameworks/R.framework/Resources/lib/libfreetype.6.dylib' (no such file), '/Users/acristia/lib/libfreetype.6.dylib' (no such file), '/usr/local/lib/lib
I've checked that:
Since brew was not installing libfreetype where kableExtra expected it, I did sudo mkdir -p /usr/local/opt/freetype/lib/
and sudo ln -s /opt/homebrew/lib/libfreetype.6.dylib /usr/local/opt/freetype/lib/libfreetype.6.dylib MacBook-Air:weirdChildes acristia$ ls /usr/local/opt/freetype/lib/libfreetype.6.dylib
With this, I changed the error from not loaded because it doesn't exist, to not loaded because of wrong architecture:
tried: '/usr/local/opt/freetype/lib/libfreetype.6.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')),
(I also saw a suggestion to do brew install freetype --universal
but that command is not recognized.
For context: I migrated my mac account to a new laptop, which is intel / monterey, and this probably means that some basic files are not right.
Or potentially, the error arises because makers of kableExtra need to take into account this new architecture. I did find two open issues mentioning libfreetype in the kableExtra github (one saying the problem was resolved with the latest R version, which is not my case).
For full information on my system, see renv-diagnostics.txt
Upvotes: 0
Views: 933
Reputation: 195
As suggested by Richard Barber, you could try to create a symbolic link for libfreetype.6.dylib
in /usr/local/lib/
with
sudo ln -s /opt/homebrew/lib/libfreetype.6.dylib /usr/local/liblibfreetype.6.dylib
See related issue: https://stackoverflow.com/a/76903720/21565913.
Upvotes: 0
Reputation: 6431
You have linked a copy of freetype from your old Apple Silicon homebrew directory, which is /opt/homebrew/lib
For Intel macs, the directory in which homebrew installs the freetype package is /usr/local/lib
Intel macs use the architecture x86_64
Apple Silicon (M1) uses the arm64
architecture.
Upvotes: 1