Skip to content

Fix CRAN "Additional Issues": LTO #323

@jonthegeek

Description

@jonthegeek

"LTO" is an additional CRAN check, "Tests for link-time optimization type mismatches". Details:

Compilation logs for CRAN packages using x86_64 Fedora 42 Linux 
built with configure --enable-lto=R and config.site:

CFLAGS="-g -O2 -Wall -pedantic -mtune=native"
FFLAGS="-g -O2 -mtune=native -Wall -pedantic"
CXXFLAGS="-g -O2 -Wall -pedantic -mtune=native -Wno-ignored-attributes -Wno-deprecated-declarations -Wno-parentheses"
AR=gcc-ar
RANLIB=gcc-ranlib
LTO=-flto=10
LTO_OPT=-flto

and packages under test installed with INSTALL --use-LTO. Other details as
at https://www.stats.ox.ac.uk/pub/bdr/Rconfig/r-devel-linux-x86_64-fedora-gcc .

Look for [-Wlto-type-mismatch] warnings.

Where mismatches involve C prototypes for Fortran code, do re-read the
discussion in 'Writing R Extensions' and check using
gfortran -fc--prototypes-external as described there.

Note the difficulties in passing Fortran LOGICAL to or from C discussed at
https://cran.r-project.org/doc/manuals/r-devel/R-exts.html#Fortran-LOGICAL

This is the log of the "LTO" check output on CRAN:

* installing *source* package ‘tibblify’ ...
** this is package ‘tibblify’ version ‘0.4.0’
** package ‘tibblify’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C compiler: ‘gcc (GCC) 15.2.1 20260123 (Red Hat 15.2.1-7)’
using C++ compiler: ‘g++ (GCC) 15.2.1 20260123 (Red Hat 15.2.1-7)’
make[2]: Entering directory '/data/gannet/ripley/R/packages/tests-LTO/tibblify/src'
gcc -I"/data/gannet/ripley/R/R-devel/include" -DNDEBUG -I./rlang -I'/data/gannet/ripley/R/test-dev/vctrs/include' -I/usr/local/include   -fvisibility=hidden -DHAVE_VISIBILITY_ATTRIBUTE -fpic  -g -O2 -Wall -pedantic -mtune=native -Wp,-D_FORTIFY_SOURCE=3 -fexceptions -fstack-protector-strong -fstack-clash-protection -fcf-protection -Werror=implicit-function-declaration -Wstrict-prototypes -flto=10 -c add-value.c -o add-value.o
gcc -I"/data/gannet/ripley/R/R-devel/include" -DNDEBUG -I./rlang -I'/data/gannet/ripley/R/test-dev/vctrs/include' -I/usr/local/include   -fvisibility=hidden -DHAVE_VISIBILITY_ATTRIBUTE -fpic  -g -O2 -Wall -pedantic -mtune=native -Wp,-D_FORTIFY_SOURCE=3 -fexceptions -fstack-protector-strong -fstack-clash-protection -fcf-protection -Werror=implicit-function-declaration -Wstrict-prototypes -flto=10 -c collector.c -o collector.o
gcc -I"/data/gannet/ripley/R/R-devel/include" -DNDEBUG -I./rlang -I'/data/gannet/ripley/R/test-dev/vctrs/include' -I/usr/local/include   -fvisibility=hidden -DHAVE_VISIBILITY_ATTRIBUTE -fpic  -g -O2 -Wall -pedantic -mtune=native -Wp,-D_FORTIFY_SOURCE=3 -fexceptions -fstack-protector-strong -fstack-clash-protection -fcf-protection -Werror=implicit-function-declaration -Wstrict-prototypes -flto=10 -c finalize.c -o finalize.o
gcc -I"/data/gannet/ripley/R/R-devel/include" -DNDEBUG -I./rlang -I'/data/gannet/ripley/R/test-dev/vctrs/include' -I/usr/local/include   -fvisibility=hidden -DHAVE_VISIBILITY_ATTRIBUTE -fpic  -g -O2 -Wall -pedantic -mtune=native -Wp,-D_FORTIFY_SOURCE=3 -fexceptions -fstack-protector-strong -fstack-clash-protection -fcf-protection -Werror=implicit-function-declaration -Wstrict-prototypes -flto=10 -c init.c -o init.o
gcc -I"/data/gannet/ripley/R/R-devel/include" -DNDEBUG -I./rlang -I'/data/gannet/ripley/R/test-dev/vctrs/include' -I/usr/local/include   -fvisibility=hidden -DHAVE_VISIBILITY_ATTRIBUTE -fpic  -g -O2 -Wall -pedantic -mtune=native -Wp,-D_FORTIFY_SOURCE=3 -fexceptions -fstack-protector-strong -fstack-clash-protection -fcf-protection -Werror=implicit-function-declaration -Wstrict-prototypes -flto=10 -c parse-spec.c -o parse-spec.o
gcc -I"/data/gannet/ripley/R/R-devel/include" -DNDEBUG -I./rlang -I'/data/gannet/ripley/R/test-dev/vctrs/include' -I/usr/local/include   -fvisibility=hidden -DHAVE_VISIBILITY_ATTRIBUTE -fpic  -g -O2 -Wall -pedantic -mtune=native -Wp,-D_FORTIFY_SOURCE=3 -fexceptions -fstack-protector-strong -fstack-clash-protection -fcf-protection -Werror=implicit-function-declaration -Wstrict-prototypes -flto=10 -c r-vctrs.c -o r-vctrs.o
g++ -std=gnu++20 -I"/data/gannet/ripley/R/R-devel/include" -DNDEBUG -I./rlang -I'/data/gannet/ripley/R/test-dev/vctrs/include' -I/usr/local/include    -fpic  -g -O2 -Wall -pedantic -mtune=native -Wno-ignored-attributes -Wno-parentheses -Wp,-D_FORTIFY_SOURCE=3 -fexceptions -fstack-protector-strong -fstack-clash-protection -fcf-protection -flto=10  -c rlang-rcc.cpp -o rlang-rcc.o
gcc -I"/data/gannet/ripley/R/R-devel/include" -DNDEBUG -I./rlang -I'/data/gannet/ripley/R/test-dev/vctrs/include' -I/usr/local/include   -fvisibility=hidden -DHAVE_VISIBILITY_ATTRIBUTE -fpic  -g -O2 -Wall -pedantic -mtune=native -Wp,-D_FORTIFY_SOURCE=3 -fexceptions -fstack-protector-strong -fstack-clash-protection -fcf-protection -Werror=implicit-function-declaration -Wstrict-prototypes -flto=10 -c rlang.c -o rlang.o
gcc -I"/data/gannet/ripley/R/R-devel/include" -DNDEBUG -I./rlang -I'/data/gannet/ripley/R/test-dev/vctrs/include' -I/usr/local/include   -fvisibility=hidden -DHAVE_VISIBILITY_ATTRIBUTE -fpic  -g -O2 -Wall -pedantic -mtune=native -Wp,-D_FORTIFY_SOURCE=3 -fexceptions -fstack-protector-strong -fstack-clash-protection -fcf-protection -Werror=implicit-function-declaration -Wstrict-prototypes -flto=10 -c shape_utils.c -o shape_utils.o
gcc -I"/data/gannet/ripley/R/R-devel/include" -DNDEBUG -I./rlang -I'/data/gannet/ripley/R/test-dev/vctrs/include' -I/usr/local/include   -fvisibility=hidden -DHAVE_VISIBILITY_ATTRIBUTE -fpic  -g -O2 -Wall -pedantic -mtune=native -Wp,-D_FORTIFY_SOURCE=3 -fexceptions -fstack-protector-strong -fstack-clash-protection -fcf-protection -Werror=implicit-function-declaration -Wstrict-prototypes -flto=10 -c tibblify.c -o tibblify.o
gcc -I"/data/gannet/ripley/R/R-devel/include" -DNDEBUG -I./rlang -I'/data/gannet/ripley/R/test-dev/vctrs/include' -I/usr/local/include   -fvisibility=hidden -DHAVE_VISIBILITY_ATTRIBUTE -fpic  -g -O2 -Wall -pedantic -mtune=native -Wp,-D_FORTIFY_SOURCE=3 -fexceptions -fstack-protector-strong -fstack-clash-protection -fcf-protection -Werror=implicit-function-declaration -Wstrict-prototypes -flto=10 -c utils.c -o utils.o
g++ -std=gnu++20 -shared -L/usr/local/lib64 -o tibblify.so add-value.o collector.o finalize.o init.o parse-spec.o r-vctrs.o rlang-rcc.o rlang.o shape_utils.o tibblify.o utils.o
init.c:42:6: warning: type of ‘tibblify_init_utils’ does not match original declaration [-Wlto-type-mismatch]
   42 | void tibblify_init_utils(SEXP ns, SEXP vctrs_ns);
      |      ^
utils.c:123:6: note: type mismatch in parameter 2
  123 | void tibblify_init_utils(SEXP ns) {
      |      ^
utils.c:123:6: note: type ‘void’ should match type ‘struct SEXPREC *’
utils.c:123:6: note: ‘tibblify_init_utils’ was previously declared here
make[2]: Leaving directory '/data/gannet/ripley/R/packages/tests-LTO/tibblify/src'
installing to /data/gannet/ripley/R/packages/tests-LTO/Libs/tibblify-lib/00LOCK-tibblify/00new/tibblify/libs
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (tibblify)
Time 2:23.93, 22.70 + 2.05

Fix the error without breaking {tibblify} package tests.

Metadata

Metadata

Labels

qcthat-nocov{qcthat}: Do not include in issue-test coverage reports

Type

No fields configured for Bug.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions