[R-pkg-devel] [Extern] Re: Problem building package depending on third party c++ source library.
Ivan Krylov
|kry|ov @end|ng |rom d|@root@org
Tue Jun 3 10:04:06 CEST 2025
On Sat, 24 May 2025 17:07:06 +0200
Nils Lüschow <nilue103 using hhu.de> wrote:
> Regarding the "mismatched-new-delete" warning I am also relatively
> sure that this is actually a false positive. Taking a look into the
> stack-trace, the new and delete operators are actually overloaded
> with functions that internally use malloc and free, hence, there is
> no mismatch
You're right, I see now that the call to free() is inlined into the
operator delete. This might be the same GCC bug as reported at
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100485>, but I've been
wrong about finding the exact problem before.
Generally, R CMD check will produce a NOTE if it sees you disabling a
compiler warning, but the compiler is in the wrong here, and a NOTE is
better than a WARNING. Still, it's best to have a package pass R CMD
check without even NOTEs because those don't need to be re-checked by a
human upon updates. Perhaps you could ask on Libera.Chat's #gcc channel
about possible workarounds? Sorry for not giving a more definitive
answer.
I've tried compiling the package on a Debian testing container, which
is the OS that runs the incoming package checks, and encountered even
more problems. Now gecode doesn't build at all, manually with
'./configure && make' or as part of the R package:
In file included from gecode/set/rel.cpp:39:
In file included from ./gecode/set/int.hh:296:
./gecode/set/int/weights.hpp:127:14: error: no viable overloaded '='
127 | elements = elements0; weights = weights0;
| ~~~~~~~~ ^ ~~~~~~~~~
./gecode/kernel/data/shared-array.hpp:53:9: note: candidate function (the implicit copy assignment operator) not viable: 'this' argument has type 'const SharedArray<int>', but
method is not marked const
53 | class SharedArray : public SharedHandle {
| ^
In file included from gecode/set/rel.cpp:39:
In file included from ./gecode/set/int.hh:296:
./gecode/set/int/weights.hpp:127:35: error: no viable overloaded '='
127 | elements = elements0; weights = weights0;
| ~~~~~~~ ^ ~~~~~~~~
./gecode/kernel/data/shared-array.hpp:53:9: note: candidate function (the implicit copy assignment operator) not viable: 'this' argument has type 'const SharedArray<int>', but
method is not marked const
53 | class SharedArray : public SharedHandle {
| ^
Additionally, gecode's ./configure wants to add --std=c++11 to the
compiler command line. I don't know if linking C++20 and C++11 code
would cause ABI problems, but it might better to configure gecode with
--enable-cpp11=no (since Makevars already gives the compatible standard
flag to ./configure).
--
Best regards,
Ivan
More information about the R-package-devel
mailing list