Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Systemfonts installation demands x86_64 versions of libpng and freetype on arm64 MacOS #117

Open
kpagacz opened this issue Sep 24, 2024 · 0 comments

Comments

@kpagacz
Copy link

kpagacz commented Sep 24, 2024

Here's the log from the installation:

> install.packages("systemfonts")

  There is a binary version available but the source version is
  later:
            binary source needs_compilation
systemfonts  1.0.5  1.1.0              TRUE

Do you want to install from sources the package which needs compilation? (
Yes/no/cancel) Yes
installing the source package ‘systemfonts’

trying URL 'https://cloud.r-project.org/src/contrib/systemfonts_1.1.0.tar.
gz'
Content type 'application/x-gzip' length 85584 bytes (83 KB)
==================================================
downloaded 83 KB

* installing *source* package ‘systemfonts’ ...
** package ‘systemfonts’ successfully unpacked and MD5 sums checked
** using staged installation
Found pkg-config cflags and libs!
Using PKG_CFLAGS=-I/opt/homebrew/opt/freetype/include/freetype2 -I/opt/hom
ebrew/opt/libpng/include/libpng16
Using PKG_LIBS=-L/opt/homebrew/opt/freetype/lib -L/opt/homebrew/opt/libpng
/lib -lfreetype -lbz2 -lpng16 -lz
** libs
rm -f systemfonts.so caches.o cpp11.o dev_metrics.o font_matching.o font_r
egistry.o ft_cache.o string_shape.o font_metrics.o font_fallback.o string_
metrics.o emoji.o cache_store.o init.o mac/FontManagerMac.o
clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.f
ramework/Resources/include" -DNDEBUG -I/opt/homebrew/opt/freetype/include/
freetype2 -I/opt/homebrew/opt/libpng/include/libpng16 -I'/Library/Framewor
ks/R.framework/Versions/4.2/Resources/library/cpp11/include' -I/usr/local/
include   -fPIC  -Wall -g -O2  -c caches.cpp -o caches.o
clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.f
ramework/Resources/include" -DNDEBUG -I/opt/homebrew/opt/freetype/include/
freetype2 -I/opt/homebrew/opt/libpng/include/libpng16 -I'/Library/Framewor
ks/R.framework/Versions/4.2/Resources/library/cpp11/include' -I/usr/local/
include   -fPIC  -Wall -g -O2  -c cpp11.cpp -o cpp11.o
clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.f
ramework/Resources/include" -DNDEBUG -I/opt/homebrew/opt/freetype/include/
freetype2 -I/opt/homebrew/opt/libpng/include/libpng16 -I'/Library/Framewor
ks/R.framework/Versions/4.2/Resources/library/cpp11/include' -I/usr/local/
include   -fPIC  -Wall -g -O2  -c dev_metrics.cpp -o dev_metrics.o
clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.f
ramework/Resources/include" -DNDEBUG -I/opt/homebrew/opt/freetype/include/
freetype2 -I/opt/homebrew/opt/libpng/include/libpng16 -I'/Library/Framewor
ks/R.framework/Versions/4.2/Resources/library/cpp11/include' -I/usr/local/
include   -fPIC  -Wall -g -O2  -c font_matching.cpp -o font_matching.o
clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.f
ramework/Resources/include" -DNDEBUG -I/opt/homebrew/opt/freetype/include/
freetype2 -I/opt/homebrew/opt/libpng/include/libpng16 -I'/Library/Framewor
ks/R.framework/Versions/4.2/Resources/library/cpp11/include' -I/usr/local/
include   -fPIC  -Wall -g -O2  -c font_registry.cpp -o font_registry.o
clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.f
ramework/Resources/include" -DNDEBUG -I/opt/homebrew/opt/freetype/include/
freetype2 -I/opt/homebrew/opt/libpng/include/libpng16 -I'/Library/Framewor
ks/R.framework/Versions/4.2/Resources/library/cpp11/include' -I/usr/local/
include   -fPIC  -Wall -g -O2  -c ft_cache.cpp -o ft_cache.o
clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.f
ramework/Resources/include" -DNDEBUG -I/opt/homebrew/opt/freetype/include/
freetype2 -I/opt/homebrew/opt/libpng/include/libpng16 -I'/Library/Framewor
ks/R.framework/Versions/4.2/Resources/library/cpp11/include' -I/usr/local/
include   -fPIC  -Wall -g -O2  -c string_shape.cpp -o string_shape.o
clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.f
ramework/Resources/include" -DNDEBUG -I/opt/homebrew/opt/freetype/include/
freetype2 -I/opt/homebrew/opt/libpng/include/libpng16 -I'/Library/Framewor
ks/R.framework/Versions/4.2/Resources/library/cpp11/include' -I/usr/local/
include   -fPIC  -Wall -g -O2  -c font_metrics.cpp -o font_metrics.o
clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.f
ramework/Resources/include" -DNDEBUG -I/opt/homebrew/opt/freetype/include/
freetype2 -I/opt/homebrew/opt/libpng/include/libpng16 -I'/Library/Framewor
ks/R.framework/Versions/4.2/Resources/library/cpp11/include' -I/usr/local/
include   -fPIC  -Wall -g -O2  -c font_fallback.cpp -o font_fallback.o
clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.f
ramework/Resources/include" -DNDEBUG -I/opt/homebrew/opt/freetype/include/
freetype2 -I/opt/homebrew/opt/libpng/include/libpng16 -I'/Library/Framewor
ks/R.framework/Versions/4.2/Resources/library/cpp11/include' -I/usr/local/
include   -fPIC  -Wall -g -O2  -c string_metrics.cpp -o string_metrics.o
clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.f
ramework/Resources/include" -DNDEBUG -I/opt/homebrew/opt/freetype/include/
freetype2 -I/opt/homebrew/opt/libpng/include/libpng16 -I'/Library/Framewor
ks/R.framework/Versions/4.2/Resources/library/cpp11/include' -I/usr/local/
include   -fPIC  -Wall -g -O2  -c emoji.cpp -o emoji.o
clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.f
ramework/Resources/include" -DNDEBUG -I/opt/homebrew/opt/freetype/include/
freetype2 -I/opt/homebrew/opt/libpng/include/libpng16 -I'/Library/Framewor
ks/R.framework/Versions/4.2/Resources/library/cpp11/include' -I/usr/local/
include   -fPIC  -Wall -g -O2  -c cache_store.cpp -o cache_store.o
clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.f
ramework/Resources/include" -DNDEBUG -I/opt/homebrew/opt/freetype/include/
freetype2 -I/opt/homebrew/opt/libpng/include/libpng16 -I'/Library/Framewor
ks/R.framework/Versions/4.2/Resources/library/cpp11/include' -I/usr/local/
include   -fPIC  -Wall -g -O2  -c init.cpp -o init.o
clang++ -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Reso
urces/include" -DNDEBUG -I/opt/homebrew/opt/freetype/include/freetype2 -I/
opt/homebrew/opt/libpng/include/libpng16 -I'/Library/Frameworks/R.framewor
k/Versions/4.2/Resources/library/cpp11/include' -I/usr/local/include  -fob
jc-arc -fPIC   -c mac/FontManagerMac.mm -o mac/FontManagerMac.o
clang++ -mmacosx-version-min=10.13 -std=gnu++14 -dynamiclib -Wl,-headerpad
_max_install_names -undefined dynamic_lookup -single_module -multiply_defi
ned suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/
lib -o systemfonts.so caches.o cpp11.o dev_metrics.o font_matching.o font_
registry.o ft_cache.o string_shape.o font_metrics.o font_fallback.o string
_metrics.o emoji.o cache_store.o init.o mac/FontManagerMac.o -L/opt/homebr
ew/opt/freetype/lib -L/opt/homebrew/opt/libpng/lib -lfreetype -lbz2 -lpng1
6 -lz -framework CoreText -framework Foundation -F/Library/Frameworks/R.fr
amework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: -single_module is obsolete
ld: warning: -multiply_defined is obsolete
ld: warning: ignoring file '/opt/homebrew/Cellar/freetype/2.13.3/lib/libfr
eetype.6.dylib': found architecture 'arm64', required architecture 'x86_64
'
ld: warning: ignoring file '/opt/homebrew/Cellar/libpng/1.6.44/lib/libpng1
6.16.dylib': found architecture 'arm64', required architecture 'x86_64'
installing to /Library/Frameworks/R.framework/Versions/4.2/Resources/libra
ry/00LOCK-systemfonts/00new/systemfonts/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘systemfonts’ in dyn.load(file
, DLLpath = DLLpath, ...):
 unable to load shared object '/Library/Frameworks/R.framework/Versions/4.
2/Resources/library/00LOCK-systemfonts/00new/systemfonts/libs/systemfonts.
so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.2/Resources/library/00
LOCK-systemfonts/00new/systemfonts/libs/systemfonts.so, 0x0006): symbol no
t found in flat namespace '_FT_Activate_Size'
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library
/systemfonts’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.2/Resourc
es/library/systemfonts’

The downloaded source packages are in
        ‘/private/var/folders/fw/dgshw82960d70m14w_tx_c7h0000gn/T/RtmpCiHs
ic/downloaded_packages’
Warning message:
In install.packages("systemfonts") :
  installation of package ‘systemfonts’ had non-zero exit status

The relevant part is here:

ld: warning: ignoring file '/opt/homebrew/Cellar/freetype/2.13.3/lib/libfr
eetype.6.dylib': found architecture 'arm64', required architecture 'x86_64
'
ld: warning: ignoring file '/opt/homebrew/Cellar/libpng/1.6.44/lib/libpng1
6.16.dylib': found architecture 'arm64', required architecture 'x86_64'
installing to /Library/Frameworks/R.framework/Versions/4.2/Resources/libra
ry/00LOCK-systemfonts/00new/systemfonts/libs

My libpng and freetype dynamic libraries are in fact compiled for arm:

kpagacz@konrads-mbp-2 ~/j/teal-modules-clinical-jnj> file /opt/homebrew/Cellar/libpng/1.6.44/lib/libpng16.16.dylib                                                                                                        127 feature/jgqo23_add_jnj_sorting_2?
/opt/homebrew/Cellar/libpng/1.6.44/lib/libpng16.16.dylib: Mach-O 64-bit dynamically linked shared library arm64
kpagacz@konrads-mbp-2 ~/j/teal-modules-clinical-jnj> file /opt/homebrew/Cellar/freetype/2.13.3/lib/libfreetype.6.dylib                                                                                                        feature/jgqo23_add_jnj_sorting_2?
/opt/homebrew/Cellar/freetype/2.13.3/lib/libfreetype.6.dylib: Mach-O 64-bit dynamically linked shared library arm64

For some reason the linker expects these libraries to be compiled for x86_64...

@kpagacz kpagacz changed the title Systemfonts installation demands x86_64 versions of libpng and Systemfonts installation demands x86_64 versions of libpng and freetype on arm64 MacOS Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant