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

Can't compile on Linux Ubuntu 18.04 #93

Open
omfmartin opened this issue Feb 22, 2022 · 6 comments
Open

Can't compile on Linux Ubuntu 18.04 #93

omfmartin opened this issue Feb 22, 2022 · 6 comments

Comments

@omfmartin
Copy link

I tried to install the package on Ubuntu 18.04 and got the following error at compilation. Any idea how I could get it to compile?

> install.packages("systemfonts")
Installing package into ‘/home/olivier/R/x86_64-pc-linux-gnu-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/systemfonts_1.0.4.tar.gz'
Content type 'application/x-gzip' length 81757 bytes (79 KB)
==================================================
downloaded 79 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/usr/local/include/freetype2 -I/usr/local/include -I/usr/include/freetype2 -I/usr/include/libpng16
Using PKG_LIBS=-L/usr/local/lib -lfontconfig -lfreetype
** libs
rm -f 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 unix/FontManagerLinux.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include/freetype2 -I/usr/local/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I'/home/olivier/R/x86_64-pc-linux-gnu-library/4.1/cpp11/include'    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-J7pprH/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c caches.cpp -o caches.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include/freetype2 -I/usr/local/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I'/home/olivier/R/x86_64-pc-linux-gnu-library/4.1/cpp11/include'    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-J7pprH/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c cpp11.cpp -o cpp11.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include/freetype2 -I/usr/local/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I'/home/olivier/R/x86_64-pc-linux-gnu-library/4.1/cpp11/include'    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-J7pprH/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c dev_metrics.cpp -o dev_metrics.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include/freetype2 -I/usr/local/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I'/home/olivier/R/x86_64-pc-linux-gnu-library/4.1/cpp11/include'    -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-J7pprH/r-base-4.1.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c font_matching.cpp -o font_matching.o
In file included from /usr/local/include/freetype2/freetype.h:33:0,
                 from ft_cache.h:10,
                 from caches.h:7,
                 from font_matching.h:10,
                 from font_matching.cpp:1:
/home/olivier/R/x86_64-pc-linux-gnu-library/4.1/cpp11/include/cpp11/integers.hpp: In static member function ‘static SEXPREC* cpp11::r_vector<T>::valid_type(SEXP) [with T = int; SEXP = SEXPREC*]’:
/usr/local/include/freetype2/config/ftconfig.h:338:26: error: expected primary-expression before ‘__typeof__’
 #define TYPEOF( type )  (__typeof__ (type))
                          ^
/home/olivier/R/x86_64-pc-linux-gnu-library/4.1/cpp11/include/cpp11/integers.hpp:25:7: note: in expansion of macro ‘TYPEOF’
   if (TYPEOF(data) != INTSXP) {
       ^~~~~~
/usr/local/include/freetype2/config/ftconfig.h:338:26: error: expected ‘)’ before ‘__typeof__’
 #define TYPEOF( type )  (__typeof__ (type))
                          ^
/home/olivier/R/x86_64-pc-linux-gnu-library/4.1/cpp11/include/cpp11/integers.hpp:25:7: note: in expansion of macro ‘TYPEOF’
   if (TYPEOF(data) != INTSXP) {
       ^~~~~~
In file included from font_registry.h:6:0,
                 from font_matching.cpp:6:
/home/olivier/R/x86_64-pc-linux-gnu-library/4.1/cpp11/include/cpp11/integers.hpp:28:3: error: expected ‘)’ before ‘return’
   return data;
   ^~~~~~
In file included from /usr/local/include/freetype2/freetype.h:33:0,
                 from ft_cache.h:10,
                 from caches.h:7,
                 from font_matching.h:10,
                 from font_matching.cpp:1:
/home/olivier/R/x86_64-pc-linux-gnu-library/4.1/cpp11/include/cpp11/integers.hpp: In function ‘cpp11::integers cpp11::as_integers(cpp11::sexp)’:
/usr/local/include/freetype2/config/ftconfig.h:338:26: error: expected primary-expression before ‘__typeof__’
 #define TYPEOF( type )  (__typeof__ (type))
                          ^
/home/olivier/R/x86_64-pc-linux-gnu-library/4.1/cpp11/include/cpp11/integers.hpp:152:7: note: in expansion of macro ‘TYPEOF’
   if (TYPEOF(x) == INTSXP) {
       ^~~~~~
/usr/local/include/freetype2/config/ftconfig.h:338:26: error: expected ‘)’ before ‘__typeof__’
 #define TYPEOF( type )  (__typeof__ (type))
                          ^
/home/olivier/R/x86_64-pc-linux-gnu-library/4.1/cpp11/include/cpp11/integers.hpp:152:7: note: in expansion of macro ‘TYPEOF’
   if (TYPEOF(x) == INTSXP) {
       ^~~~~~
In file included from font_registry.h:6:0,
                 from font_matching.cpp:6:
/home/olivier/R/x86_64-pc-linux-gnu-library/4.1/cpp11/include/cpp11/integers.hpp:154:5: error: expected ‘)’ before ‘else’
   } else if (TYPEOF(x) == REALSXP) {
     ^~~~
/usr/lib/R/etc/Makeconf:177: recipe for target 'font_matching.o' failed
make: *** [font_matching.o] Error 1
ERROR: compilation failed for package ‘systemfonts’
* removing ‘/home/olivier/R/x86_64-pc-linux-gnu-library/4.1/systemfonts’
Warning in install.packages :
  installation of package ‘systemfonts’ had non-zero exit status

The downloaded source packages are in
	‘/tmp/RtmpcKcTg4/downloaded_packages’

Here is the session information.

> sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.6 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.1.2 tools_4.1.2  

Thank you!

@thomasp85
Copy link
Member

The error seems to be coming from cpp11 -- maybe try to update that package and see if it is resolved

@omfmartin
Copy link
Author

I was using g++ 7.5.0. I updated it to 11.1.0 and I'm unfortunately still getting the same error.

@thomasp85
Copy link
Member

Ah - I'm talking about the cpp11 R package

@omfmartin
Copy link
Author

Sorry for the misunderstanding. The R package seems up to date, I'm using cpp11 0.4.2

@thomasp85
Copy link
Member

So, it appears that Freetype has a Macro that interferes with R's TYPEOF macro (which is used in cpp11)

However the macro got renamed in 2015 so my guess is you are sitting on a very old freetype version

@omfmartin
Copy link
Author

I unfortunately don't have access anymore to the computer where I was having the bug, so I won't be able to confirm. Feel free to close the issue. Thanks for looking into it :)

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

2 participants