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

Does not compile on RHEL7/Centos - Parse errors with g++ 4.8.5 - possible solution provided #234

Closed
LauraBireley opened this issue Jun 2, 2021 · 4 comments · Fixed by #240

Comments

@LauraBireley
Copy link

LauraBireley commented Jun 2, 2021

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

error: converting to ‘date::weekday’ from initializer list would use explicit constructor ‘constexpr date::weekday::weekday(unsigned int)’.

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

"Sorry, I forgot to mention that ONLY_C_LOCALE is required for pre-gcc-5.0.
gcc-4.x doesn't have the C++11 std::time_get facets. Setting ONLY_C_LOCALE to 1 tells the library to roll its own parsing/formatting without using the C++11 time facets, but it can only do so assuming the "C" locale."

Compilation Output for clock on RHEL 7 wit 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’
(aslibis 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* packageclock...
** packageclocksuccessfully 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 ofstd::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 todate::weekdayfrom initializer list would use explicit constructorconstexpr date::weekday::weekday(unsigned int)’
     fields() = default;
     ^
In file included from gregorian-year-month-day.cpp:7:0:
parse.h:1271:26: note: synthesized methoddate::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 ofstd::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 fromvoid 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 fromcpp11::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 todate::weekdayfrom initializer list would use explicit constructorconstexpr date::weekday::weekday(unsigned int)’
     fields() = default;
     ^
In file included from gregorian-year-month-day.cpp:7:0:
parse.h:1328:24: note: synthesized methoddate::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 ofstd::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 fromvoid 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 fromcpp11::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 todate::weekdayfrom initializer list would use explicit constructorconstexpr date::weekday::weekday(unsigned int)’
     fields() = default;
     ^
In file included from gregorian-year-month-day.cpp:7:0:
parse.h:1328:24: note: synthesized methoddate::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 ofstd::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 fromvoid 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 fromcpp11::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 todate::weekdayfrom initializer list would use explicit constructorconstexpr date::weekday::weekday(unsigned int)’
     fields() = default;
     ^
In file included from gregorian-year-month-day.cpp:7:0:
parse.h:1328:24: note: synthesized methoddate::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 packageclock* removing/rstudio/rssp/dev/home/birelel/R/x86_64-pc-linux-gnu-library/3.6/clockThe downloaded source packages are in/tmp/RtmpeXTIj8/downloaded_packagesWarning message:
In install.packages("clock", repos = "https://cran.rstudio.com/") :
  installation of packageclockhad non-zero exit status
> 
@DavisVaughan
Copy link
Member

@LauraBireley can you try installing the branch in this PR? devtools::install_github("r-lib/clock#240")

@LauraBireley
Copy link
Author

LauraBireley commented Jul 13, 2021 via email

@DavisVaughan
Copy link
Member

@LauraBireley any updates here? I plan to submit a new version of clock fairly soon and am curious to know if this fixed it for you

@LauraBireley
Copy link
Author

LauraBireley commented Jul 21, 2021 via email

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

Successfully merging a pull request may close this issue.

2 participants