Clock will not compile on RHEL7/Centos7 because 4.8.5 is the only supported c++ compiler version on those platforms.
I have attached the output of the install.packages command to the end this ticket for the specific errors with date.h and error message
Howard Hinnant has provided a fix for this issue with a pre-compiler directive so that projects using his date library will compile under g++ 4.8.5.
RStudio Server is still supported for RHEL7/Centos7. A lot of government enterprise RStudio Server installations still use RHEL7.
Could you please consider adding the the pre-compiler directive from HH below to make the clock package backwardly compatible with RHEL7/Centos7 systems running g++ 4.8.5?
R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
[Previously saved workspace restored]
> install.packages("clock",repos="https://cran.rstudio.com/")
Installing package into ‘/rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/clock_0.3.0.tar.gz'
Content type 'application/x-gzip' length 454094 bytes (443 KB)
==================================================
downloaded 443 KB
* installing *source* package ‘clock’ ...
** package ‘clock’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -std=gnu++11 -I"/opt/R/3.6.3/lib/R/include" -DNDEBUG -I"/rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/cpp11/include" -I"/rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/tzdb/include" -I/usr/local/include -fpic -g -O2 -c cpp11.cpp -o cpp11.o
g++ -std=gnu++11 -I"/opt/R/3.6.3/lib/R/include" -DNDEBUG -I"/rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/cpp11/include" -I"/rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/tzdb/include" -I/usr/local/include -fpic -g -O2 -c duration.cpp -o duration.o
g++ -std=gnu++11 -I"/opt/R/3.6.3/lib/R/include" -DNDEBUG -I"/rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/cpp11/include" -I"/rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/tzdb/include" -I/usr/local/include -fpic -g -O2 -c enums.cpp -o enums.o
g++ -std=gnu++11 -I"/opt/R/3.6.3/lib/R/include" -DNDEBUG -I"/rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/cpp11/include" -I"/rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/tzdb/include" -I/usr/local/include -fpic -g -O2 -c format.cpp -o format.o
g++ -std=gnu++11 -I"/opt/R/3.6.3/lib/R/include" -DNDEBUG -I"/rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/cpp11/include" -I"/rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/tzdb/include" -I/usr/local/include -fpic -g -O2 -c gregorian-year-day.cpp -o gregorian-year-day.o
g++ -std=gnu++11 -I"/opt/R/3.6.3/lib/R/include" -DNDEBUG -I"/rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/cpp11/include" -I"/rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/tzdb/include" -I/usr/local/include -fpic -g -O2 -c gregorian-year-month-day.cpp -o gregorian-year-month-day.o
In file included from /rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/tzdb/include/tzdb/date.h:5:0,
from /rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/tzdb/include/tzdb/tzdb.h:4,
from clock.h:5,
from gregorian-year-month-day.h:4,
from gregorian-year-month-day.cpp:1:
/rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/tzdb/include/date/date.h: In instantiation of ‘std::basic_istream<_CharT, _Traits>& rclock::from_stream(std::basic_istream<_CharT, _Traits>&, const CharT*, const std::pair<const std::basic_string<char>*, const std::basic_string<char>*>&, const std::pair<const std::basic_string<char>*, const std::basic_string<char>*>&, const std::pair<const std::basic_string<char>*, const std::basic_string<char>*>&, const CharT&, date::year&, std::basic_string<_CharT, _Traits, _Alloc>*, std::chrono::minutes*) [with CharT = char; Traits = std::char_traits<char>; Alloc = std::allocator<char>; std::chrono::minutes = std::chrono::duration<int, std::ratio<60l> >]’:
gregorian-year-month-day.cpp:900:5: required from here
/rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/tzdb/include/date/date.h:4808:5: error: converting to ‘date::weekday’ from initializer list would use explicit constructor ‘constexpr date::weekday::weekday(unsigned int)’
fields() = default;
^
In file included from gregorian-year-month-day.cpp:7:0:
parse.h:1271:26: note: synthesized method ‘date::fields<Duration>::fields() [with Duration = std::chrono::duration<long int>]’ first required here
date::fields<CT> fds{};
^
In file included from /rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/tzdb/include/tzdb/date.h:5:0,
from /rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/tzdb/include/tzdb/tzdb.h:4,
from clock.h:5,
from gregorian-year-month-day.h:4,
from gregorian-year-month-day.cpp:1:
/rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/tzdb/include/date/date.h: In instantiation of ‘std::basic_istream<_CharT, _Traits>& rclock::from_stream(std::basic_istream<_CharT, _Traits>&, const CharT*, const std::pair<const std::basic_string<char>*, const std::basic_string<char>*>&, const std::pair<const std::basic_string<char>*, const std::basic_string<char>*>&, const std::pair<const std::basic_string<char>*, const std::basic_string<char>*>&, const CharT&, date::year_month_day&, date::hh_mm_ss<Duration>&, std::basic_string<CharT, Traits, Alloc>*, std::chrono::minutes*) [with Duration = std::chrono::duration<long int, std::ratio<1l, 1000l> >; CharT = char; Traits = std::char_traits<char>; Alloc = std::allocator<char>; std::chrono::minutes = std::chrono::duration<int, std::ratio<60l> >]’:
gregorian-year-month-day.cpp:855:5: required from ‘void year_month_day_from_stream(std::istringstream&, const std::vector<std::basic_string<char> >&, const std::pair<const std::basic_string<char>*, const std::basic_string<char>*>&, const std::pair<const std::basic_string<char>*, const std::basic_string<char>*>&, const std::pair<const std::basic_string<char>*, const std::basic_string<char>*>&, const char&, const R_xlen_t&, rclock::failures&, Calendar&) [with Calendar = rclock::gregorian::ymdhmss<std::chrono::duration<long int, std::ratio<1l, 1000l> > >; std::istringstream = std::basic_istringstream<char>; R_xlen_t = long int]’
gregorian-year-month-day.cpp:1201:5: required from ‘cpp11::writable::list year_month_day_parse_impl(const strings&, const strings&, const strings&, const strings&, const strings&, const strings&, const strings&, const strings&) [with Calendar = rclock::gregorian::ymdhmss<std::chrono::duration<long int, std::ratio<1l, 1000l> > >; cpp11::writable::list = cpp11::writable::r_vector<SEXPREC*>; cpp11::strings = cpp11::r_vector<cpp11::r_string>]’
gregorian-year-month-day.cpp:1233:180: required from here
/rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/tzdb/include/date/date.h:4808:5: error: converting to ‘date::weekday’ from initializer list would use explicit constructor ‘constexpr date::weekday::weekday(unsigned int)’
fields() = default;
^
In file included from gregorian-year-month-day.cpp:7:0:
parse.h:1328:24: note: synthesized method ‘date::fields<Duration>::fields() [with Duration = std::chrono::duration<long int, std::ratio<1l, 1000l> >]’ first required here
date::fields<CT> fds{};
^
In file included from /rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/tzdb/include/tzdb/date.h:5:0,
from /rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/tzdb/include/tzdb/tzdb.h:4,
from clock.h:5,
from gregorian-year-month-day.h:4,
from gregorian-year-month-day.cpp:1:
/rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/tzdb/include/date/date.h: In instantiation of ‘std::basic_istream<_CharT, _Traits>& rclock::from_stream(std::basic_istream<_CharT, _Traits>&, const CharT*, const std::pair<const std::basic_string<char>*, const std::basic_string<char>*>&, const std::pair<const std::basic_string<char>*, const std::basic_string<char>*>&, const std::pair<const std::basic_string<char>*, const std::basic_string<char>*>&, const CharT&, date::year_month_day&, date::hh_mm_ss<Duration>&, std::basic_string<CharT, Traits, Alloc>*, std::chrono::minutes*) [with Duration = std::chrono::duration<long int, std::ratio<1l, 1000000l> >; CharT = char; Traits = std::char_traits<char>; Alloc = std::allocator<char>; std::chrono::minutes = std::chrono::duration<int, std::ratio<60l> >]’:
gregorian-year-month-day.cpp:855:5: required from ‘void year_month_day_from_stream(std::istringstream&, const std::vector<std::basic_string<char> >&, const std::pair<const std::basic_string<char>*, const std::basic_string<char>*>&, const std::pair<const std::basic_string<char>*, const std::basic_string<char>*>&, const std::pair<const std::basic_string<char>*, const std::basic_string<char>*>&, const char&, const R_xlen_t&, rclock::failures&, Calendar&) [with Calendar = rclock::gregorian::ymdhmss<std::chrono::duration<long int, std::ratio<1l, 1000000l> > >; std::istringstream = std::basic_istringstream<char>; R_xlen_t = long int]’
gregorian-year-month-day.cpp:1201:5: required from ‘cpp11::writable::list year_month_day_parse_impl(const strings&, const strings&, const strings&, const strings&, const strings&, const strings&, const strings&, const strings&) [with Calendar = rclock::gregorian::ymdhmss<std::chrono::duration<long int, std::ratio<1l, 1000000l> > >; cpp11::writable::list = cpp11::writable::r_vector<SEXPREC*>; cpp11::strings = cpp11::r_vector<cpp11::r_string>]’
gregorian-year-month-day.cpp:1234:180: required from here
/rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/tzdb/include/date/date.h:4808:5: error: converting to ‘date::weekday’ from initializer list would use explicit constructor ‘constexpr date::weekday::weekday(unsigned int)’
fields() = default;
^
In file included from gregorian-year-month-day.cpp:7:0:
parse.h:1328:24: note: synthesized method ‘date::fields<Duration>::fields() [with Duration = std::chrono::duration<long int, std::ratio<1l, 1000000l> >]’ first required here
date::fields<CT> fds{};
^
In file included from /rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/tzdb/include/tzdb/date.h:5:0,
from /rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/tzdb/include/tzdb/tzdb.h:4,
from clock.h:5,
from gregorian-year-month-day.h:4,
from gregorian-year-month-day.cpp:1:
/rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/tzdb/include/date/date.h: In instantiation of ‘std::basic_istream<_CharT, _Traits>& rclock::from_stream(std::basic_istream<_CharT, _Traits>&, const CharT*, const std::pair<const std::basic_string<char>*, const std::basic_string<char>*>&, const std::pair<const std::basic_string<char>*, const std::basic_string<char>*>&, const std::pair<const std::basic_string<char>*, const std::basic_string<char>*>&, const CharT&, date::year_month_day&, date::hh_mm_ss<Duration>&, std::basic_string<CharT, Traits, Alloc>*, std::chrono::minutes*) [with Duration = std::chrono::duration<long int, std::ratio<1l, 1000000000l> >; CharT = char; Traits = std::char_traits<char>; Alloc = std::allocator<char>; std::chrono::minutes = std::chrono::duration<int, std::ratio<60l> >]’:
gregorian-year-month-day.cpp:855:5: required from ‘void year_month_day_from_stream(std::istringstream&, const std::vector<std::basic_string<char> >&, const std::pair<const std::basic_string<char>*, const std::basic_string<char>*>&, const std::pair<const std::basic_string<char>*, const std::basic_string<char>*>&, const std::pair<const std::basic_string<char>*, const std::basic_string<char>*>&, const char&, const R_xlen_t&, rclock::failures&, Calendar&) [with Calendar = rclock::gregorian::ymdhmss<std::chrono::duration<long int, std::ratio<1l, 1000000000l> > >; std::istringstream = std::basic_istringstream<char>; R_xlen_t = long int]’
gregorian-year-month-day.cpp:1201:5: required from ‘cpp11::writable::list year_month_day_parse_impl(const strings&, const strings&, const strings&, const strings&, const strings&, const strings&, const strings&, const strings&) [with Calendar = rclock::gregorian::ymdhmss<std::chrono::duration<long int, std::ratio<1l, 1000000000l> > >; cpp11::writable::list = cpp11::writable::r_vector<SEXPREC*>; cpp11::strings = cpp11::r_vector<cpp11::r_string>]’
gregorian-year-month-day.cpp:1235:178: required from here
/rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/tzdb/include/date/date.h:4808:5: error: converting to ‘date::weekday’ from initializer list would use explicit constructor ‘constexpr date::weekday::weekday(unsigned int)’
fields() = default;
^
In file included from gregorian-year-month-day.cpp:7:0:
parse.h:1328:24: note: synthesized method ‘date::fields<Duration>::fields() [with Duration = std::chrono::duration<long int, std::ratio<1l, 1000000000l> >]’ first required here
date::fields<CT> fds{};
^
make: *** [gregorian-year-month-day.o] Error 1
ERROR: compilation failed for package ‘clock’
* removing ‘/rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/clock’
The downloaded source packages are in
‘/tmp/RtmpeXTIj8/downloaded_packages’
Warning message:
In install.packages("clock", repos = "https://cran.rstudio.com/") :
installation of package ‘clock’ had non-zero exit status
>
Issue Summary
Clock will not compile on RHEL7/Centos7 because 4.8.5 is the only supported c++ compiler version on those platforms.
I have attached the output of the install.packages command to the end this ticket for the specific errors with date.h and error message
Possible Solution
Howard Hinnant has provided a fix for this issue with a pre-compiler directive so that projects using his date library will compile under g++ 4.8.5.
Why Fix This?
RStudio Server is still supported for RHEL7/Centos7. A lot of government enterprise RStudio Server installations still use RHEL7.
Request
Could you please consider adding the the pre-compiler directive from HH below to make the clock package backwardly compatible with RHEL7/Centos7 systems running g++ 4.8.5?
Reference
See: Date Issue#264
Compilation Output for clock on RHEL 7 wit g++ 4.8.5