-
-
Notifications
You must be signed in to change notification settings - Fork 218
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
On Mac, error: no matching function for call to R_lsInternal
#1148
Comments
Uggh. Do you think you can test / devise a workaround for the includes we could include? |
This is a workaround for RcppCore/Rcpp#1148.
I think the problem that this line defines an typedef enum { FALSE = 0, TRUE /*, MAYBE */ } Rboolean; But the lines in #ifndef TRUE
#define TRUE 1
#endif /* TRUE */
#ifndef FALSE
#define FALSE 0
#endif /* FALSE */ Here's a possible workaround, though there may well be a better way. The idea is that you'd undefine At the top of the Rcpp code, you have something like: #ifdef TRUE
#define BEFORE_RCPP_TRUE TRUE
#undef TRUE
#endif
#ifdef FALSE
#define BEFORE_RCPP_FALSE FALSE
#undef FALSE
#endif And then at the end of all the Rcpp code: #ifdef BEFORE_RCPP_TRUE
#define TRUE BEFORE_RCPP_TRUE
#undef BEFORE_RCPP_TRUE
#endif
#ifdef BEFORE_RCPP_FALSE
#define FALSE BEFORE_RCPP_FALSE
#undef BEFORE_RCPP_FALSE
#endif This does compile without error: sourceCpp(code = '
#define R_NO_REMAP
#include <Rinternals.h>
#include <mach/Boolean.h>
#ifdef TRUE
#define BEFORE_RCPP_TRUE TRUE
#undef TRUE
#endif
#ifdef FALSE
#define BEFORE_RCPP_FALSE FALSE
#undef FALSE
#endif
#include <Rcpp.h>
#ifdef BEFORE_RCPP_TRUE
#define TRUE BEFORE_RCPP_TRUE
#undef BEFORE_RCPP_TRUE
#endif
#ifdef BEFORE_RCPP_FALSE
#define FALSE BEFORE_RCPP_FALSE
#undef BEFORE_RCPP_FALSE
#endif
') |
Let's revisit when I am more awake. We can hopefully protect a few more use cases that way. "include order bugs are really gnarly" --me |
Can we just avoid using TRUE and FALSE altogether define our own tools? E.g.
And then do some kind of smart search and replace as appropriate. |
Looks like there aren't too many usages, so shouldn't be too bad to update. |
@kevinushey I don't think that it'll work to define Rcpp/inst/include/Rcpp/Environment.h Line 91 in 9633169
The value passed to So it needs to be given the |
I'm afraid @wch's solution won't work, because it's simply not possible to define a macro to another's expanded result. So this:
sets There's a pragma for this, but I'm not sure about its general availability or whether we can use it without complaints from CRAN. |
Making the Devil's Advocate argument: Is this too rare to implement something? Luckily and thanks to his persistence, @wch has worked out how to address it for Lastly, given that we include sourceCpp(code = '
#include <mach/boolean.h>
#include <Rcpp.h>
') Will that work? I don't have |
@Enchufa2 Thanks for pointing that out. @eddelbuettel The example you provided does compile. I think it's because this is what happens:
The end state is that the In contrast, this is what happens in the error examples:
The end state here is that all instances of As for whether it's worth fixing in Rcpp, I don't really have any strong opinions either way. It apparently is a very rare case. |
I put a short extension to the FAQ in: 1684878 |
This is related to #897. It took me a while to figure out exactly why this was happening when building the dev version of {httpuv} with the dev version of {later}, but I finally got a minimal reproducible example.
To start off with, this compiles without error:
However, including `<mach/boolean.h>' results in an error:
The error happens because mach/boolean.h has the following:
So this results in the same error:
I was able to work around the problem by reordering the includes. Any order of those included header files will compile except the one in the failing example above. (Note that in my case, I didn't include
mach/boolean.h
directly -- it was included by a file, which was included by a file, etc.)The text was updated successfully, but these errors were encountered: