r-lib / ragg

Graphic Devices Based on AGG
https://ragg.r-lib.org
Other
172 stars 24 forks source link

can not install ragg in R4.4.1 #169

Closed BenxiaHu closed 3 days ago

BenxiaHu commented 2 months ago

can not install ragg in R4.4.1

WildPenquin commented 1 week ago

Hi,

Not sure what is the issue BenxiaHu is having since there are no logs, but I still don't want to start another issue.

Installing ragg I get this:

* installing *source* package ‘ragg’ ...
** package ‘ragg’ successfully unpacked and MD5 sums checked
** using staged installation
Found pkg-config cflags and libs!
Using PKG_CFLAGS=-I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-6 -pthread
Using PKG_LIBS=-lfreetype -lpng16 -ltiff -ljpeg
** libs
using C++ compiler: ‘g++ (GCC) 14.2.1 20240805’
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG -I./agg/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-6 -pthread -I'/home/ville/R/x86_64-pc-linux-gnu-library/4.4/systemfonts/include' -I'/home/ville/R/x86_64-pc-linux-gnu-library/4.4/textshaping/include' -I/usr/local/include    -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection         -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects   -c capture_dev.cpp -o capture_dev.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG -I./agg/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-6 -pthread -I'/home/ville/R/x86_64-pc-linux-gnu-library/4.4/systemfonts/include' -I'/home/ville/R/x86_64-pc-linux-gnu-library/4.4/textshaping/include' -I/usr/local/include    -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection         -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects   -c init.cpp -o init.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG -I./agg/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-6 -pthread -I'/home/ville/R/x86_64-pc-linux-gnu-library/4.4/systemfonts/include' -I'/home/ville/R/x86_64-pc-linux-gnu-library/4.4/textshaping/include' -I/usr/local/include    -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection         -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects   -c jpeg_dev.cpp -o jpeg_dev.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG -I./agg/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-6 -pthread -I'/home/ville/R/x86_64-pc-linux-gnu-library/4.4/systemfonts/include' -I'/home/ville/R/x86_64-pc-linux-gnu-library/4.4/textshaping/include' -I/usr/local/include    -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection         -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects   -c png_dev.cpp -o png_dev.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG -I./agg/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-6 -pthread -I'/home/ville/R/x86_64-pc-linux-gnu-library/4.4/systemfonts/include' -I'/home/ville/R/x86_64-pc-linux-gnu-library/4.4/textshaping/include' -I/usr/local/include    -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection         -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects   -c ppm_dev.cpp -o ppm_dev.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG -I./agg/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-6 -pthread -I'/home/ville/R/x86_64-pc-linux-gnu-library/4.4/systemfonts/include' -I'/home/ville/R/x86_64-pc-linux-gnu-library/4.4/textshaping/include' -I/usr/local/include    -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection         -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects   -c tiff_dev.cpp -o tiff_dev.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG -I./agg/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-6 -pthread -I'/home/ville/R/x86_64-pc-linux-gnu-library/4.4/systemfonts/include' -I'/home/ville/R/x86_64-pc-linux-gnu-library/4.4/textshaping/include' -I/usr/local/include    -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection         -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects   -c agg/src/agg_curves.cpp -o agg/src/agg_curves.o
g++ -std=gnu++17 -I"/usr/include/R/" -DNDEBUG -I./agg/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-6 -pthread -I'/home/ville/R/x86_64-pc-linux-gnu-library/4.4/systemfonts/include' -I'/home/ville/R/x86_64-pc-linux-gnu-library/4.4/textshaping/include' -I/usr/local/include    -fpic  -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions         -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security         -fstack-clash-protection -fcf-protection         -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=/build/r/src=/usr/src/debug/r -flto=auto -ffat-lto-objects   -c agg/src/agg_font_freetype.cpp -o agg/src/agg_font_freetype.o
agg/src/agg_font_freetype.cpp: In instantiation of ”bool agg::decompose_ft_outline(const FT_Outline&, bool, const trans_affine&, PathStorage&) [with PathStorage = path_storage_integer<int, 6>; FT_Outline = FT_Outline_]”:
agg/src/agg_font_freetype.cpp:1071:48:   required from here
 1071 |                         if(decompose_ft_outline(m_cur_face->glyph->outline,
      |                            ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1072 |                                                 m_flip_y,
      |                                                 ~~~~~~~~~
 1073 |                                                 m_affine,
      |                                                 ~~~~~~~~~
 1074 |                                                 m_path32))
      |                                                 ~~~~~~~~~
agg/src/agg_font_freetype.cpp:182:35: virhe: invalid conversion from ”unsigned char*” to ”char*” [-fpermissive]
  182 |             tags  = outline.tags  + first;
      |                     ~~~~~~~~~~~~~~^~~~~~~
      |                                   |
      |                                   unsigned char*
agg/src/agg_font_freetype.cpp: In instantiation of ”bool agg::decompose_ft_outline(const FT_Outline&, bool, const trans_affine&, PathStorage&) [with PathStorage = path_storage_integer<short int, 6>; FT_Outline = FT_Outline_]”:
agg/src/agg_font_freetype.cpp:1092:48:   required from here
 1092 |                         if(decompose_ft_outline(m_cur_face->glyph->outline,
      |                            ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1093 |                                                 m_flip_y,
      |                                                 ~~~~~~~~~
 1094 |                                                 m_affine,
      |                                                 ~~~~~~~~~
 1095 |                                                 m_path16))
      |                                                 ~~~~~~~~~
agg/src/agg_font_freetype.cpp:182:35: virhe: invalid conversion from ”unsigned char*” to ”char*” [-fpermissive]
  182 |             tags  = outline.tags  + first;
      |                     ~~~~~~~~~~~~~~^~~~~~~
      |                                   |
      |                                   unsigned char*
make: *** [/usr/lib64/R/etc/Makeconf:204: agg/src/agg_font_freetype.o] Error 1
ERROR: compilation failed for package ‘ragg’
* removing ‘/home/ville/R/x86_64-pc-linux-gnu-library/4.4/ragg’
Warning in install.packages :
  installation of package ‘ragg’ had non-zero exit status
alexreg commented 1 week ago

@WildPenquin Indeed, this is the error I get. I'm on an M1 Mac, so this might be a problem with support for the ARM architecture?

WildPenquin commented 5 days ago

@alexreg I did not state my paltform, oops ;-)

This is on Arch Linux, X86_64, so it is not a platform thing. Possibly / rather a compile-from-source thing.

I should also probably mention I'm using R-Studio.

Many platform (all besides Windows?) compile everything in R from source (AFAIK! I'm just a regular user, I don't know that much about internals of R). I don't know what does and how does it set the compile options when doing install_packages. I suppose in 4.4.1 -fpermissive has been removed from compilation flags.

alexreg commented 4 days ago

@WildPenquin Yeah, that's what I thought too, about -fpermissive, but then I realised that clang doesn't have such an option (or an exact equivalent, I believe). But forcing R to build with GCC instead of clang served as a work-around for me.

Going forwards, I feel like the correct solution is to fix the source code in agg, adding a reinterpret_cast at the appropriate places.

multimeric commented 4 days ago

Thanks! Quick fix using @alexreg's changes:

remotes::install_github("alexreg/ragg", ref="fix-build")
j-i-l commented 4 days ago

What @WildPenquin and @alexreg describe belongs to #170

BenxiaHu commented 4 days ago

remotes::install_github("alexreg/ragg", ref="fix-build") does not work:

/data/anaconda3/envs/R4.4/bin/../lib/gcc/x86_64-conda-linux-gnu/14.1.0/../../../../x86_64-conda-linux-gnu/bin/ld: cannot find -lpng15: No such file or directory collect2: error: ld returned 1 exit status make: *** [/data/anaconda3/envs/R4.4/lib/R/share/make/shlib.mk:10: ragg.so] Error 1 ERROR: compilation failed for package ‘ragg’

multimeric commented 4 days ago

remotes::install_github("alexreg/ragg", ref="fix-build") does not work:

Unrelated issue. You're missing the libpng conda package.

thomasp85 commented 3 days ago

The original issue has been resolved by #172