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

chore: Replace Rcpp by cpp11 #419

Merged
merged 37 commits into from Feb 13, 2023
Merged

chore: Replace Rcpp by cpp11 #419

merged 37 commits into from Feb 13, 2023

Conversation

Antonov548
Copy link
Contributor

No description provided.

@Antonov548 Antonov548 marked this pull request as draft January 26, 2023 14:54
@Antonov548 Antonov548 marked this pull request as ready for review January 28, 2023 11:30
@Antonov548 Antonov548 changed the title Replace Rcpp by cpp11 chore: Replace Rcpp by cpp11 Jan 28, 2023
Copy link
Member

@krlmlr krlmlr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. What does the C stack overflow on macOS mean?

DESCRIPTION Outdated Show resolved Hide resolved
DESCRIPTION Outdated
@@ -48,13 +49,13 @@ LazyLoad: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
SystemRequirements: libpq >= 9.0: libpq-dev (deb) or postgresql-devel
(rpm)
(rpm), C++17
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need C++17?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was warning in CI about default c++17 standard in DESCRIPTION file on the latest Ubuntu as I understood

}
}

Rcpp::RObject DbColumnStorage::class_from_datatype(DATA_TYPE dt) {
cpp11::sexp DbColumnStorage::class_from_datatype(DATA_TYPE dt) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can a cpp11 vector object contain R_NilValue ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cpp11::r_vector which is used for cpp11::strings, cpp11::integers etc., can not be assigned to R_NilValue, only cpp11::sexp which in general make sense.

src/connection.cpp Outdated Show resolved Hide resolved
@Antonov548
Copy link
Contributor Author

Thanks. What does the C stack overflow on macOS mean?

It's seems known problem, I will take a look. The same problem on Mac was with cpp11.

@pachadotdev
Copy link
Contributor

Thanks. What does the C stack overflow on macOS mean?

It's seems known problem, I will take a look. The same problem on Mac was with cpp11.

I've been testing this PR and it works well

also, it solves #400

@krlmlr
Copy link
Member

krlmlr commented Feb 1, 2023

Thanks. We need to fix the stack overflow on macOS.

DESCRIPTION Outdated
@@ -1,6 +1,6 @@
Package: RPostgres
Title: Rcpp Interface to PostgreSQL
Version: 1.4.5.9002
Version: 1.4.5.9003
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't change this in PRs.

DESCRIPTION Outdated
Comment on lines 49 to 51
SystemRequirements:
libpq >= 9.0: libpq-dev (deb) or postgresql-devel (rpm),
C++11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C++11 can no longer be mentioned due to recent changes in R-devel. Will the checks succeed if we leave it out?

Suggested change
SystemRequirements:
libpq >= 9.0: libpq-dev (deb) or postgresql-devel (rpm),
C++11
SystemRequirements:
libpq >= 9.0: libpq-dev (deb) or postgresql-devel (rpm)

@pachadotdev
Copy link
Contributor

@Antonov548 I tested locally and it works. The CI shows a problem with CRAN links, I googled and I found this r-lib/actions#697. Lmk how can I help to fix this.

@pachadotdev
Copy link
Contributor

@Antonov548 it seems to be ok now r-lib/actions#697 (comment)

all the checks here are passing

so far, I am using this PR wih my usual data analysis and it works

Copy link
Member

@krlmlr krlmlr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I have tweaked one test, looks great otherwise.

Some tests now output Error: Disconnected . I have tracked this down to a failure in DbConnection::check_connection() when a result set is invalid (?). The commit 373c7a5 succeeds in the main branch, but after merging the main branch here, the tests now fail. Can you please take a look?

@Antonov548
Copy link
Contributor Author

@krlmlr Fixed 👍

@pachadotdev
Copy link
Contributor

@krlmlr @Antonov548 I pulled the last changes. It works well with Ubuntu 20.04.

Here's the full check

> check()
ℹ Updating RPostgres documentation
ℹ Loading RPostgres
ℹ 26 functions decorated with [[cpp11::register]]
✔ generated file cpp11.R
✔ generated file cpp11.cpp
ℹ Re-compiling RPostgres (debug build)
── R CMD INSTALL ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────
─  installing *source* package ‘RPostgres’ ...
   ** using staged installation
   Found pkg-config cflags and libs (libpq 15.1)!
   Using PKG_CFLAGS=-I/usr/include/postgresql
   Using PKG_LIBS=-lpq
   Using PKG_PLOGR=
   ** libs
   g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/postgresql -Ivendor -DRCPP_DEFAULT_INCLUDE_CALL=false -DRCPP_USING_UTF8_ERROR_STRING -DBOOST_NO_AUTO_PTR  -I'/usr/lib/R/site-library/cpp11/include' -I'/usr/lib/R/site-library/plogr/include'   -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-a3XuZ5/r-base-4.2.2.20221110=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c connection.cpp -o connection.o
   g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I/usr/include/postgresql -Ivendor -DRCPP_DEFAULT_INCLUDE_CALL=false -DRCPP_USING_UTF8_ERROR_STRING -DBOOST_NO_AUTO_PTR  -I'/usr/lib/R/site-library/cpp11/include' -I'/usr/lib/R/site-library/plogr/include'   -fvisibility=hidden -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-a3XuZ5/r-base-4.2.2.20221110=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c cpp11.cpp -o cpp11.o
   g++ -std=gnu++14 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o RPostgres.so DbColumn.o DbColumnDataSource.o DbColumnDataSourceFactory.o DbColumnStorage.o DbConnection.o DbDataFrame.o DbResult.o PqColumnDataSource.o PqColumnDataSourceFactory.o PqDataFrame.o PqResult.o PqResultImpl.o PqResultSource.o PqUtils.o RPostgres-init.o connection.o cpp11.o encode.o encrypt.o logging.o result.o -lpq -L/usr/lib/R/lib -lR
   installing to /tmp/RtmpkE2Ned/devtools_install_1be4a5bff7354/00LOCK-RPostgres/00new/RPostgres/libs
   ** checking absolute paths in shared objects and dynamic libraries
─  DONE (RPostgres)
── Building ───────────────────────────────────────────────────────────────────────────────────────────────────────── RPostgres ──
Setting env vars:
• CFLAGS    : -Wall -pedantic -fdiagnostics-color=always
• CXXFLAGS  : -Wall -pedantic -fdiagnostics-color=always
• CXX11FLAGS: -Wall -pedantic -fdiagnostics-color=always
• CXX14FLAGS: -Wall -pedantic -fdiagnostics-color=always
• CXX17FLAGS: -Wall -pedantic -fdiagnostics-color=always
• CXX20FLAGS: -Wall -pedantic -fdiagnostics-color=always
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
── R CMD build ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────
✔  checking for file ‘/home/pacha/github/RPostgres/DESCRIPTION’ ...
─  preparing ‘RPostgres’:
✔  checking DESCRIPTION meta-information ...
─  cleaning src
─  installing the package to build vignettes
✔  creating vignettes (19.6s)
─  cleaning src
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘RPostgres_1.4.5.9003.tar.gz’
   
── Checking ─────────────────────────────────────────────────────────────────────── RPostgres ──
Setting env vars:
• _R_CHECK_CRAN_INCOMING_USE_ASPELL_: TRUE
• _R_CHECK_CRAN_INCOMING_REMOTE_    : FALSE
• _R_CHECK_CRAN_INCOMING_           : FALSE
• _R_CHECK_FORCE_SUGGESTS_          : FALSE
• NOT_CRAN                          : true
── R CMD check ─────────────────────────────────────────────────────────────────────────────────
─  using log directory ‘/tmp/RtmpkE2Ned/RPostgres.Rcheck’
─  using R version 4.2.2 Patched (2022-11-10 r83330)
─  using platform: x86_64-pc-linux-gnu (64-bit)
─  using session charset: UTF-8
─  using options ‘--no-manual --as-cran’ (842ms)
✔  checking for file ‘RPostgres/DESCRIPTION’
─  this is package ‘RPostgres’ version ‘1.4.5.9003’
─  package encoding: UTF-8
✔  checking package namespace information
✔  checking package dependencies (989ms)
✔  checking if this is a source package ...
✔  checking if there is a namespace
✔  checking for executable files (1.5s)
✔  checking for hidden files and directories ...
✔  checking for portable file names ...
✔  checking for sufficient/correct file permissions ...
✔  checking serialization versions
─  checking whether package ‘RPostgres’ can be installed ... [25s/25s] OK (25s)
N  checking installed package size ...
     installed size is  5.8Mb
     sub-directories of 1Mb or more:
       libs   5.3Mb
✔  checking package directory
✔  checking for future file timestamps ...
✔  checking ‘build’ directory ...
✔  checking DESCRIPTION meta-information ...
N  checking top-level files ...
     possible bashism in configure line 21 ('command' with option other than -p):
     if [ `uname` = "Darwin" ] && [ `command -v pkg-config` ]; then
     possible bashism in configure line 38 ('command' with option other than -p):
     if [ -z "$FORCE_AUTOBREW" ] && [ `command -v pkg-config` ]; then
     possible bashism in configure line 58 ('command' with option other than -p):
     if [ -z "$FORCE_AUTOBREW" ] && [ `command -v pg_config` ]; then
✔  checking for left-over files ...
✔  checking index information ...
✔  checking package subdirectories ...
✔  checking R files for non-ASCII characters ...
✔  checking R files for syntax errors ...
✔  checking whether the package can be loaded (396ms)
✔  checking whether the package can be loaded with stated dependencies ...
✔  checking whether the package can be unloaded cleanly ...
✔  checking whether the namespace can be loaded with stated dependencies ...
✔  checking whether the namespace can be unloaded cleanly (413ms)
✔  checking loading without being on the library search path (405ms)
✔  checking dependencies in R code (588ms)
✔  checking S3 generic/method consistency (741ms)
✔  checking replacement functions (352ms)
✔  checking foreign function calls (422ms)
✔  checking R code for possible problems (3.9s)
✔  checking Rd files ...
✔  checking Rd metadata ...
✔  checking Rd line widths ...
✔  checking Rd cross-references ...
✔  checking for missing documentation entries (431ms)
✔  checking for code/documentation mismatches (1.2s)
✔  checking Rd \usage sections (893ms)
✔  checking Rd contents ...
✔  checking for unstated dependencies in examples ...
✔  checking line endings in shell scripts
✔  checking line endings in C/C++/Fortran sources/headers ...
✔  checking line endings in Makefiles
✔  checking compilation flags in Makevars ...
✔  checking for GNU extensions in Makefiles ...
✔  checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS)
✔  checking use of PKG_*FLAGS in Makefiles ...
✔  checking use of SHLIB_OPENMP_*FLAGS in Makefiles ...
✔  checking pragmas in C/C++ headers and code ...
✔  checking compilation flags used ...
✔  checking compiled code ...
✔  checking installed files from ‘inst/doc’ ...
✔  checking files in ‘vignettes’
✔  checking examples (991ms)
✔  checking for unstated dependencies in ‘tests’ ...
─  checking tests ...
✔  Running ‘testthat.R’ (1.2s)
✔  checking for unstated dependencies in vignettes ...
✔  checking package vignettes in ‘inst/doc’ ...
✔  checking re-building of vignette outputs (1s)
✔  checking for non-standard things in the check directory ...
✔  checking for detritus in the temp directory
   
   See
     ‘/tmp/RtmpkE2Ned/RPostgres.Rcheck/00check.log’
   for details.
   
   
── R CMD check results ───────────────────────────────────────────────────────────────────────────────── RPostgres 1.4.5.9003 ────
Duration: 46.5s

❯ checking installed package size ... NOTE
    installed size is  5.8Mb
    sub-directories of 1Mb or more:
      libs   5.3Mb

❯ checking top-level files ... NOTE
    possible bashism in configure line 21 ('command' with option other than -p):
    if [ `uname` = "Darwin" ] && [ `command -v pkg-config` ]; then
    possible bashism in configure line 38 ('command' with option other than -p):
    if [ -z "$FORCE_AUTOBREW" ] && [ `command -v pkg-config` ]; then
    possible bashism in configure line 58 ('command' with option other than -p):
    if [ -z "$FORCE_AUTOBREW" ] && [ `command -v pg_config` ]; then

0 errors ✔ | 0 warnings ✔ | 2 notes ✖

@pachadotdev
Copy link
Contributor

@krlmlr @Antonov548 I send a PR to fix the notes about bashisms

Copy link
Member

@krlmlr krlmlr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do one last pass.

src/encrypt.cpp Outdated Show resolved Hide resolved
src/connection.cpp Outdated Show resolved Hide resolved
@krlmlr krlmlr merged commit 0069b89 into r-dbi:main Feb 13, 2023
@krlmlr
Copy link
Member

krlmlr commented Feb 13, 2023

Thanks!

@Antonov548 Antonov548 deleted the cpp11 branch February 14, 2023 18:37
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants