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

DejaVu fonts are needed to build from source #247

Open
sukanka opened this issue Dec 25, 2022 · 1 comment
Open

DejaVu fonts are needed to build from source #247

sukanka opened this issue Dec 25, 2022 · 1 comment
Labels

Comments

@sukanka
Copy link

sukanka commented Dec 25, 2022

The problem

Without dejavu fonts, it will fail to be built from source, a detailed log is as follows:

==> Starting build()...
* installing *source* package ‘ggiraph’ ...
** package ‘ggiraph’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -std=gnu++11 -I"/usr/include/R/" -DNDEBUG  -I'/usr/lib/R/library/Rcpp/include' -I'/usr/lib/R/library/systemfonts/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -flto=auto -ffat-lto-objects  -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++11 -I"/usr/include/R/" -DNDEBUG  -I'/usr/lib/R/library/Rcpp/include' -I'/usr/lib/R/library/systemfonts/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -flto=auto -ffat-lto-objects  -c a_color.cpp -o a_color.o
g++ -std=gnu++11 -I"/usr/include/R/" -DNDEBUG  -I'/usr/lib/R/library/Rcpp/include' -I'/usr/lib/R/library/systemfonts/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -flto=auto -ffat-lto-objects  -c clip.cpp -o clip.o
g++ -std=gnu++11 -I"/usr/include/R/" -DNDEBUG  -I'/usr/lib/R/library/Rcpp/include' -I'/usr/lib/R/library/systemfonts/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -flto=auto -ffat-lto-objects  -c dsvg.cpp -o dsvg.o
g++ -std=gnu++11 -I"/usr/include/R/" -DNDEBUG  -I'/usr/lib/R/library/Rcpp/include' -I'/usr/lib/R/library/systemfonts/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -flto=auto -ffat-lto-objects  -c dsvg_dev.cpp -o dsvg_dev.o
g++ -std=gnu++11 -I"/usr/include/R/" -DNDEBUG  -I'/usr/lib/R/library/Rcpp/include' -I'/usr/lib/R/library/systemfonts/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -flto=auto -ffat-lto-objects  -c geom.cpp -o geom.o
g++ -std=gnu++11 -I"/usr/include/R/" -DNDEBUG  -I'/usr/lib/R/library/Rcpp/include' -I'/usr/lib/R/library/systemfonts/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -flto=auto -ffat-lto-objects  -c indexed.cpp -o indexed.o
g++ -std=gnu++11 -I"/usr/include/R/" -DNDEBUG  -I'/usr/lib/R/library/Rcpp/include' -I'/usr/lib/R/library/systemfonts/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -flto=auto -ffat-lto-objects  -c interactive.cpp -o interactive.o
g++ -std=gnu++11 -I"/usr/include/R/" -DNDEBUG  -I'/usr/lib/R/library/Rcpp/include' -I'/usr/lib/R/library/systemfonts/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -flto=auto -ffat-lto-objects  -c mask.cpp -o mask.o
g++ -std=gnu++11 -I"/usr/include/R/" -DNDEBUG  -I'/usr/lib/R/library/Rcpp/include' -I'/usr/lib/R/library/systemfonts/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -flto=auto -ffat-lto-objects  -c pattern.cpp -o pattern.o
g++ -std=gnu++11 -I"/usr/include/R/" -DNDEBUG  -I'/usr/lib/R/library/Rcpp/include' -I'/usr/lib/R/library/systemfonts/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -flto=auto -ffat-lto-objects  -c raster.cpp -o raster.o
g++ -std=gnu++11 -I"/usr/include/R/" -DNDEBUG  -I'/usr/lib/R/library/Rcpp/include' -I'/usr/lib/R/library/systemfonts/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -flto=auto -ffat-lto-objects  -c shapes.cpp -o shapes.o
g++ -std=gnu++11 -I"/usr/include/R/" -DNDEBUG  -I'/usr/lib/R/library/Rcpp/include' -I'/usr/lib/R/library/systemfonts/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -flto=auto -ffat-lto-objects  -c svg.cpp -o svg.o
g++ -std=gnu++11 -I"/usr/include/R/" -DNDEBUG  -I'/usr/lib/R/library/Rcpp/include' -I'/usr/lib/R/library/systemfonts/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -flto=auto -ffat-lto-objects  -c text.cpp -o text.o
g++ -std=gnu++11 -I"/usr/include/R/" -DNDEBUG  -I'/usr/lib/R/library/Rcpp/include' -I'/usr/lib/R/library/systemfonts/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -flto=auto -ffat-lto-objects  -c tinyxml2.cpp -o tinyxml2.o
g++ -std=gnu++11 -I"/usr/include/R/" -DNDEBUG  -I'/usr/lib/R/library/Rcpp/include' -I'/usr/lib/R/library/systemfonts/include' -I/usr/local/include   -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection -Wp,-D_GLIBCXX_ASSERTIONS -flto=auto -ffat-lto-objects  -c utils.cpp -o utils.o
g++ -std=gnu++11 -shared -L/usr/lib64/R/lib -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -flto=auto -o ggiraph.so RcppExports.o a_color.o clip.o dsvg.o dsvg_dev.o geom.o indexed.o interactive.o mask.o pattern.o raster.o shapes.o svg.o text.o tinyxml2.o utils.o -lpng -lz -L/usr/lib64/R/lib -lR
installing to /build/r-ggiraph/src/00LOCK-ggiraph/00new/ggiraph/libs
** R
** inst
** byte-compile and prepare package for lazy loading

 *** caught segfault ***
address (nil), cause 'memory not mapped'

Traceback:
 1: match_font_c(family, as.logical(italic), as.logical(bold))
 2: match_font(font, bold = bold, italic = italic)
 3: FUN(X[[i]], ...)
 4: lapply(def_fonts[missing_fonts], match_family)
 5: default_fontname()
 6: eval(exprs[i], envir)
 7: eval(exprs[i], envir)
 8: sys.source(codeFile, env, keep.source = keep.source, keep.parse.data = keep.parse.data)
 9: doTryCatch(return(expr), name, parentenv, handler)
10: tryCatchOne(expr, names, parentenv, handlers[[1L]])
11: tryCatchList(expr, classes, parentenv, handlers)
12: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    if (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call, nlines = 1L)        prefix <- paste("Error in", dcall, ": ")        LONG <- 75L        sm <- strsplit(conditionMessage(e), "\n")[[1L]]        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))             w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],                 type = "b")        if (w > LONG)             prefix <- paste0(prefix, "\n  ")    }    else prefix <- "Error : "    msg <- paste0(prefix, conditionMessage(e), "\n")    .Internal(seterrmessage(msg[1L]))    if (!silent && isTRUE(getOption("show.error.messages"))) {        cat(msg, file = outFile)        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
13: try(sys.source(codeFile, env, keep.source = keep.source, keep.parse.data = keep.parse.data))
14: loadNamespace(package = package, lib.loc = lib.loc, keep.source = keep.source,     keep.parse.data = keep.parse.data, partial = TRUE)
15: withCallingHandlers(expr, packageStartupMessage = function(c) tryInvokeRestart("muffleMessage"))
16: suppressPackageStartupMessages(loadNamespace(package = package,     lib.loc = lib.loc, keep.source = keep.source, keep.parse.data = keep.parse.data,     partial = TRUE))
17: code2LazyLoadDB(package, lib.loc = lib.loc, keep.source = keep.source,     keep.parse.data = keep.parse.data, compress = compress, set.install.dir = set.install.dir)
18: tools:::makeLazyLoading("ggiraph", "/build/r-ggiraph/src/00LOCK-ggiraph/00new",     keep.source = FALSE, keep.parse.data = FALSE, set.install.dir = "/build/r-ggiraph/src/ggiraph")
An irrecoverable exception occurred. R is aborting now ...
ERROR: lazy loading failed for package ‘ggiraph’
* removing ‘/build/r-ggiraph/src/ggiraph’
* restoring previous ‘/build/r-ggiraph/src/ggiraph’
==> ERROR: A failure occurred in build().

The reason

The default_fonts on Linux is set to DejaVu fonts, see

ggiraph/R/fonts.R

Lines 2 to 21 in 0fc5995

default_fonts <- list(
windows = c(
sans = "Arial",
serif = "Times New Roman",
mono = "Courier New",
symbol = "Symbol"
),
osx = c(
sans = "Helvetica",
serif = "Times",
mono = "Courier",
symbol = "Symbol"
),
unix = c(
sans = "DejaVu Sans",
serif = "DejaVu serif",
mono = "DejaVu mono",
symbol = "DejaVu Sans"
)
)

But in a clean archlinux chroot, ttf-dejavu is not installed by default. So when building this package, ttf-dejavu should be installed first to avoid the above problem.

Could you please mention DejaVu fonts are needed on Linux in readme?
Thanks in advance.

@davidgohel
Copy link
Owner

Thanks for reporting this, I can reproduce. We will try to fix (or whatever will appear to be the correct solution) and if not possible we will document it as you suggested.

@davidgohel davidgohel added the bug label Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants