[odb-users] Re: Building ODB compiler on Windows using VC++

Edward Diener eldlistmailingz at tropicsoft.com
Fri Feb 13 11:54:53 EST 2015

On 2/13/2015 5:16 AM, Boris Kolpackov wrote:
> Hi Edward,
> Edward Diener <eldlistmailingz at tropicsoft.com> writes:
>> How can I build the ODB compiler on Windows using Visual Studio ?
> As soon as you can build GCC with Visual Studio ;-). I bet that
> won't happen any time soon. (any why?)
>> Although I have mingw and mingw64 I do not want to fool around with
>> MSYS, but if using MSYS is the only way to build odb on Windows I
>> will use that.
> Yes, that's probably the most straightforward way to do it. The way
> we do it is via a cross compiler from Linux, but that's quite
> involved.

I will follow the path of trying to build ODB using mingw/mingw64 and 
MSYS. if I cannot I will use pre-built binaries.

>> Although I do not absolutely have to build the ODB compiler from
>> source code I would like to keep up with source code changes using
>> git and build the compiler from source code myself rather than
>> install it.
> First, a bit of background:
> Internally, ODB is implemented as a GCC plugin. So, when you run
> 'odb', underneath it runs GCC which in turn runs a plugin which
> does most of the work. This all works very smoothly on UNIX-like
> platforms (e.g., Linux, Mac OS, Solaris) which have a sane dynamic
> library/loading models. On Windows, however, GCC does not support
> plugins since nobody managed to implement the dynamic loading
> part yet. So what we do is apply a patch (a relatively small one,
> considering what it does) to GCC to support a statically-linked
> plugin. We then go ahead and link the ODB plugin statically into
> GCC.

Thanks for the information.

> All the scripts, patches, and instructions for doing this are publicly
> available, so with enough determination you could probably build ODB
> for Windows yourself:
> http://scm.codesynthesis.com/?p=odb/odb-etc.git;a=tree;f=binary/mingw-w64
> The question is, of course, if it is worth the trouble. If you want
> to use some feature that is only available in the repository, just
> shout and I will gladly build you a pre-release pack of ODB. I do
> this all the time:
> http://codesynthesis.com/~boris/tmp/odb/pre-release/


if you have not done so already you might want to think about letting 
ODB compiler and other parts of ODB be built with CMake. I know that 
CMake/Ninja works fine on Windows, since I build the latest clang with 
it all the time. It should equally be useful for building the latest 
ODB, but maybe there are gotchas there I cannot imagine. That way no one 
has to play around with MingW/MSYS on Windows, which is always 
difficult, to build ODB and tools.

More information about the odb-users mailing list