Creating a new topic to continue the discussion about binary and compiler compatibility started here in the context of QML.jl.
All of this is in the context of CxxWrap.jl, where C++ code is made available in Julia by building a small C++ wrapper library that is accessed from Julia using ccall
. CxxWrap itself contains a C++ library, and so does any package built using it. Naturally, all of these have to be compiled with the same compiler for any binaries to be compatible with each other. Furthermore, in the event somene else but me would want to release Windows binaries for a CxxWrap-based package, this author would need to release his binaries built with the same compiler as I used for the CxxWrap binary release. The wrapped library itself (e.g. parts of Qt in case of QML.jl) also must be built with that same compiler.
Using Appveyor, it is possible to build binaries automatically using either MinGW or Visual Studio. Since Julia itself is build using Mingw, using that seems most logical, as suggested by @tkelman
The binary distribtion of Julia itself also contains a libstdc++ dll, however. Building with Mingw results in binaries that require the libstdc++ of the mingw compiler, which is different from the one used to compile Julia. For now, this seems to result in errors only on the 32 bit Windows version. Linking CxxWrap statically with libstdc++ solves it for CxxWrap, but for QML this doesn’t work.
Using MSVC, the C++ standard library is in an entirely different DLL, so the conflict doesn’t exist and both 64bit and 32bit binaries work fine for QML and CxxWrap. There is a concern when mixing Mingw and MSVC in the case of allocating an object in an MSVC dll and deallocating in a Mingw dll or vice versa, however I believe this is no issue here, since calls from Julia into CxxWrap happen only with ccall, and calls from CxxWrap into Julia happen only using the official Julia C interface, so allocation and deallocation always happen on the same side. This is also confirmed by the fact that all tests pass using MSVC.
In conclusion, I see 3 solutions:
- Use the standard Mingw compiler on Appveyor and abandon binaries on the 32 bit Windows platform
- Mix Mingw Julia with MSVC CxxWrap and QML binaries
- Use the exact same compiler as the one used for Julia
While option 3 is best theoretically, it has two major practical obstacles for which I don’t see the solution:
- How do I know which compiler to use, and where can I get it (automatically in an appveyor script)? Also, does that compiler risk changing between minor Julia revisions?
- How do I get Qt binaries built with that compiler (I don’t see building Qt myself as an option, automating it on Appveyor will also never fit in the time limit)?