[Rcpp-devel] Package does not compile on MAC when running R-CMD-check github action

Simon Zehnder simon.zehnder at googlemail.com
Sun Nov 14 12:24:31 CET 2021


Hi Dirk, Simon, Nik,

I found the roots for the failed checks. I used a virtual method and then
overloaded it in derived classes. Furthermore I used the inline keyword and
that produced some undefined symbols. Now all checks run through on all
platforms.

Thanks again to each one of you for giving me comments that helped me to
find out what the problem was.

Best, Simon

Am Mo., 8. Nov. 2021 um 11:36 Uhr schrieb Simon Zehnder <
simon.zehnder at googlemail.com>:

> Hi Simon,
>
> thank you for bringing this up. As mentioned in the answer to Dirk, I am
> at this point not anymore that fluent in C++ as I was some years ago. I am
> looking through the classes and I am not yet sure what to look for. What I
> see is an error message:
>
> ./PriorStudentInd.h:31:14: warning: 'PriorStudentInd::update' hides
> overloaded virtual function [-Woverloaded-virtual]
>
> When I look into the class definition
> <https://github.com/simonsays1980/finmix/blob/documentation/src/ParStudentInd.h>
> I see:
>
> #ifndef __FINMIX_PARSTUDENTIND_H__
> #define __FINMIX_PARSTUDENTIND_H__
>
> #include "ParStudentFix.h"
> #include "PriorStudentInd.h"
>
> class ParStudentInd : virtual public ParStudentFix {
> public:
> arma::rowvec weight;
>
> ParStudentInd (const bool&,
>                const FinmixModel&);
> virtual ~ParStudentInd ()
> {
> }
> virtual void update(const PriorStudentInd&);
> };
> #endif /* __FINMIX_PARSTUDENTIND_H__ */
>
> Can you give me a hint, what might be the reason here. I have an
> intuition that it is due to either the "virtual" class inheritance or/and
> the "virtual" method definition that now includes a different parameter
> (PriodStudentInd instead of PriorStudentFix).
>
> Best,
> Simon
>
>
> Am So., 7. Nov. 2021 um 22:22 Uhr schrieb Simon Urbanek <
> simon.urbanek at r-project.org>:
>
>> Simon,
>>
>> this is not a build issue, it breaks on all platforms in clang (tested on
>> macOS and Debian+clang-11). There are tons of warnings in the C++ code (way
>> over 1000 lines!) which lead to an error at link time (most of them are
>> type mismatches leading to overrides of virtual methods). The particular
>> one you see:
>>
>> $ for i in `ls *.o`; do nm $i | sed "s:^:$i:" | grep
>> __ZT.13ParStudentInd; done
>> ParStudentInd.o0000000000001820 S __ZTI13ParStudentInd
>> ParStudentInd.o0000000000001b50 S __ZTS13ParStudentInd
>> ParStudentInd.o00000000000017a0 S __ZTV13ParStudentInd
>> mcmc_student.o                 U __ZTT13ParStudentInd
>>
>> So mcmc_student expects a VTT, but there is none defined in the
>> implementation (ParStudentInd). To make it clear pass it thought de-mangler
>> like llvm-cxxfilt:
>>
>> ParStudentInd.o: 0000000000001820 S typeinfo for ParStudentInd
>> ParStudentInd.o: 0000000000001b50 S typeinfo name for ParStudentInd
>> ParStudentInd.o: 00000000000017a0 S vtable for ParStudentInd
>> mcmc_student.o:                  U VTT for ParStudentInd
>>
>> The above is just one of many link errors (pretty much all classes are
>> mismatched in the mcmc_*.cpp files).
>>
>> Cheers,
>> Simon
>>
>>
>>
>> > On Nov 8, 2021, at 4:56 AM, Dirk Eddelbuettel <edd at debian.org> wrote:
>> >
>> >
>> > Simon,
>> >
>> > Your Makevars [1] is very standard so I would suspect it may be the
>> actions
>> > setup for macOS.  Rcpp is still used by a large number of packages all
>> of
>> > which appear to build just fine on macOS (as eg evidenced by the CRAN
>> checks)
>> > if and when everything is setup correctly.
>> >
>> > Dirk
>> >
>> > [1]
>> https://github.com/simonsays1980/finmix/blob/documentation/src/Makevars
>> >
>> > --
>> > https://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
>> > _______________________________________________
>> > 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
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20211114/2b055f6c/attachment.html>


More information about the Rcpp-devel mailing list