[Rcpp-devel] violates the C++ One Definition Rule ?

Dirk Eddelbuettel edd at debian.org
Tue Jan 25 19:26:01 CET 2022


On 25 January 2022 at 10:49, Toby Hocking wrote:
| That worked! Thanks Dirk.

Splendid.

Now that you have it working again, if you feel curious and have a few
minutes maybe you can drill down how/where it breaks. Because the general
ability to link, say, "interface files" that deal with R/C++ interchange (and
include RcppArmadillo.h) and pure "client library files" (that include the
armadillo header, and may be used elsewhere) is a nice advanced use case we
do not want to drop. But we need to document what needs to be turned on to
enable LTO support.

Dirk
 
| On Mon, Jan 24, 2022 at 1:14 PM Dirk Eddelbuettel <edd at debian.org> wrote:
| 
| >
| > On 24 January 2022 at 12:55, Toby Hocking wrote:
| > | Hi Rcpp Devs,
| > | Does anyone know how to fix this warning in a package with LinkingTo:
| > | RcppArmadillo? My package plotHMM
| > | https://www.stats.ox.ac.uk/pub/bdr/LTO/plotHMM.out got this message on
| > CRAN
| >
| > Worth stressing that this happens under link-time optimziation (lto) which
| > I
| > am not yet that familiar with.
| >
| > From _really briefly_ glancing at your package I see that you include
| > RcppArmadillo.h in some files (good !) but also include armadillo
| > directly. It's just a hunch and guess at this point but that may lead to
| > different 'settings' and #define values.  Maybe try using only
| > RcppArmadillo.h ?
| >
| > Dirk
| >
| > | Additional Checks LTO flavor,
| > | https://www.stats.ox.ac.uk/pub/bdr/LTO/README.txt
| > |
| > | g++ -std=gnu++14 -shared -L/usr/local/lib64 -o plotHMM.so
| > | RcppExports.o backward.o eln.o forward.o interface.o multiply.o
| > | pairwise.o transition.o viterbi.o
| > |
| > /data/gannet/ripley/R/test-4.2/RcppArmadillo/include/armadillo_bits/glue_solve_bones.hpp:84:10:
| > | warning: type ‘struct opts’ violates the C++ One Definition Rule
| > | [-Wodr]
| > |    84 |   struct opts
| > |       |          ^
| > |
| > /data/gannet/ripley/R/test-4.2/RcppArmadillo/include/armadillo_bits/glue_solve_bones.hpp:84:10:
| > | note: a different type is defined in another translation unit
| > |    84 |   struct opts
| > |       |          ^
| > |
| > /data/gannet/ripley/R/test-4.2/RcppArmadillo/include/armadillo_bits/glue_solve_bones.hpp:86:17:
| > | note: the first difference of corresponding definitions is field
| > | ‘flags’
| > |    86 |     const uword flags;
| > |       |                 ^
| > |
| > /data/gannet/ripley/R/test-4.2/RcppArmadillo/include/armadillo_bits/glue_solve_bones.hpp:86:17:
| > | note: a field of same name but different type is defined in another
| > | translation unit
| > |    86 |     const uword flags;
| > |       |                 ^
| > | _______________________________________________
| > | Rcpp-devel mailing list
| > | Rcpp-devel at lists.r-forge.r-project.org
| > | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
| > --
| > https://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
| >

-- 
https://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org


More information about the Rcpp-devel mailing list