Open HenrikBengtsson opened 8 years ago
Usually _MSC_VER is a check for the Visual C compiler. Unfortunately, it is hardcoded in a lot of places in Fusion. We could try to understand the issues a bit deeper.
In the meanwhile, an alternative "improvement" could be to see if it's possible to drop _mingw.h
and override just the __CRT_UUID_DECL
and __uuidof(type)
macros, e.g.
#undef __CRT_UUID_DECL
#define __CRT_UUID_DECL(type,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
extern "C++" { \
template<> inline const GUID &__mingw_uuidof<type>() { \
static const IID __uuid_inst = {l,w1,w2, {b1,b2,b3,b4,b5,b6,b7,b8}}; \
return __uuid_inst; \
} \
template<> inline const GUID &__mingw_uuidof<type*>() { \
return __mingw_uuidof<type>(); \
} \
}
#undef __uuidof
#define __uuidof(type) __mingw_uuidof<__typeof(type)>()
UPDATE: At least it's not as easy as putting the above in a uuid-fix.h
and then updating Makevars.win
:
%.o: %.cpp
$(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) $(MYCXXFLAGS) --include _mingwd-uuid-fix.h -c $< -o $@
(it should be pretty clear by now I'm mostly guessing here)
Dear HenrikBengtsson, i read this issue but i couldn't understand what this mean and how to fix it with re-write any code? I've post an issue lately, with my building error. Hope you have time to read that. Thanks a lot! @HenrikBengtsson
We should document/explain the rationale for having a
src/_mingw.h
in the package. I don't have notes from the original addition of this, but I'm pretty sure it is because of the following.Background
When trying to build/install the package on Windows with our
src/_mingw.h
workaround, one gets:Troubleshooting
The Rtools tool chain includes:
These two differ between the gcc-4.6.3 and the gcc 4.9.3 toolchains, but they both share the following identical parts relevant to what we are using them for:
and
The cause of our problem seem to be that when building the package on Windows we end up with the "else" clause in the above macro. The reason for this is that
USE___UUIDOF == 1
, which in turn is because_MSC_VER
is defined. The latter is defined becausesrc/Markvars.win
uses:First of all, if we don't define
_MSC_VER
, we get another error;I don't know the background/rational for
_MSC_VER
and whether it is important/critical for other reasons, so it could be that this "new" error is possible to fix. However, ...Workaround
An alternative is to force
USE___UUIDOF == 0
to get that [first clause]() in the if-else macro ofsrc/_mingw.h
. Unfortunately, it is not possible to do this from thesrc/Makevars.win
file, because thesrc/_mingw.h
file overrides it due to_MSC_VER
. This is the reason why we have our own customsrc/_mingw.h
file(s) that uses:(Sure, this could be replaced with a single line, but with the above the diff to the original ones is minimal; a single character).