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

LTO issue on CRAN #1849

Closed
osorensen opened this issue Aug 23, 2023 · 1 comment
Closed

LTO issue on CRAN #1849

osorensen opened this issue Aug 23, 2023 · 1 comment

Comments

@osorensen
Copy link

I see there is a previous issue on this that has been closed. It does not seem identical, so I open a new issue.

I'm maintaining the package BayesMallows, where we have unit tests of C++ code. In src/RcppExports.cpp, we recently noticed that the line RcppExport SEXP run_testthat_tests(SEXP); changed to RcppExport SEXP run_testthat_tests(void *);. This seems to cause an LTO issue on CRAN. Relevant parts are reproduced below:

** libs
using C++ compiler: ‘g++-13 (GCC) 13.2.0’
using C++17
make[2]: Entering directory '/data/gannet/ripley/R/packages/tests-LTO/BayesMallows/src'
g++-13 -std=gnu++17 -shared -L/usr/local/gcc13/lib64 -L/usr/local/lib64 -o BayesMallows.so RcppExports.o distances.o importance_sampling.o leapandshift.o misc.o missing_data.o mixtures.o pairwise_comparisons.o parameterupdates.o partitionfuns.o rmallows.o run_mcmc.o sample.o smc_calculate_probability.o smc_correction_kernel.o smc_correction_kernel_pseudo.o smc_get_exponent_sum.o smc_get_sample_probabilities.o smc_leap_and_shift_probs.o smc_mallows_new_item_rank.o smc_mallows_new_users.o smc_mallows_new_users_funs.o smc_metropolis_hastings_alpha.o smc_metropolis_hastings_aug_ranking.o smc_metropolis_hastings_rho.o subset.o test-leapandshift.o test-misc.o test-runner.o
RcppExports.cpp:383:17: warning: 'run_testthat_tests' violates the C++ One Definition Rule [-Wodr]
  383 | RcppExport SEXP run_testthat_tests(void *);
      |                 ^
/data/gannet/ripley/R/test-dev/testthat/include/testthat/testthat.h:172:17: note: 'run_testthat_tests' was previously declared here
  172 | extern "C" SEXP run_testthat_tests(SEXP use_xml_sxp) {
      |                 ^
make[2]: Leaving directory '/data/gannet/ripley/R/packages/tests-LTO/BayesMallows/src'
installing to /data/gannet/ripley/R/packages/tests-LTO/Libs/BayesMallows-lib/00LOCK-BayesMallows/00new/BayesMallows/libs

I've tried deleting src/RcppExports.cpp and running Rcpp::compileAttributes() on both Windows and Mac, and both generate run_testthat_tests(void * ) as above.

Any help with this issue would be much appreciated.

@osorensen
Copy link
Author

Solved by this Rcpp change: RcppCore/Rcpp#1274

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

No branches or pull requests

1 participant