[CXX-89] Add Evergreen builder for MinGW Created: 01/Feb/10  Updated: 23/Jul/21  Resolved: 22/May/18

Status: Closed
Project: C++ Driver
Component/s: Build, Portability
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Minor - P4
Reporter: David G Ortega Assignee: Unassigned
Resolution: Won't Fix Votes: 10
Labels: cxxmove, windows
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows XP


Attachments: Text File 0001-Make-mingw-work.-Make-boost-4.48-work.patch    
Issue Links:
Related
related to CDRIVER-959 mingw build & test in Evergreen Closed
is related to CXX-1206 Failed to build test_driver Closed
Epic Link: CXX Driver Testing (Evergreen)

 Description   

C++ Driver does not compile with Mingw.
Tested versions of Mingw are 3.4.5 which comes with Qt 4.5 and 4.6.

mongo/client/../util/goodies.h: In member function `mongo::WrappingInt
mongo::WrappingInt::atomicIncrement()':
mongo/client/../util/goodies.h:131: error: invalid conversion from
`volatile long int*' to `long int*'

mongo/client/../util/goodies.h:131: error: initializing argument 1
of `long int InterlockedIncrement(long int*)'
mongo/client/../util/goodies.h: In function `void
mongo::time_t_to_String(time_t, char*)':
mongo/client/../util/goodies.h:172: error: `ctime_s' was not declared
in this scope

mongo/client/../util/goodies.h:172: warning: unused variable 'ctime_s'
In file included from mongo/client/dbclient.h:22,

mongo/client/../db/jsobj.h: In constructor `mongo::JSObj1::JSObj1()':
mongo/client/../db/jsobj.h:1631: error: `strcpy_s' was not declared in
this scope



 Comments   
Comment by J Rassi [ 28/Jan/17 ]

gbschenkel: thanks for the report! I'm glad to hear to hear that you were able to successfully compile the latest version of the driver with MinGW. I've filed CXX-1207 to update our vendored Catch, so that you'd be able to build from pristine source in the future.

Comment by Gustavo Brondani Schenkel [ 27/Jan/17 ]

I found the problem related by me in CXX-1206, was the third party software Catch, which could handle the code(c++11), in my humble opinion. I downloaded the last stable version and updated the "mongo-cxx-driver/src/third_party/catch/include/catch.hpp". After that i was able to compile and install it. I used Msys2 with mingw-w64-x86_64 + (gcc + cmake + openssl + boost) for x86_64. For CMake I used the generator 'CodeBlocks - MinGW Makefiles'.
Oh, near forgot, I compiled all 3 drivers from master branch.

Comment by J Rassi [ 02/Sep/16 ]

I'm re-purposing this ticket to focus on official support for MinGW on the master branch. Relatedly, I've closed pull request #108; see my closing comment there for details.

Comment by David Golden [ 12/Aug/16 ]

Related PR was submitted as https://github.com/mongodb/mongo-cxx-driver/pull/108

Comment by Pieter Willem Jordaan [ 30/Jun/14 ]

Here is a blog post describing the detail and also a github link with a pull request

Comment by Andrew Morrow (Inactive) [ 26/Mar/14 ]

climax Mingw support is not currently a priority for us, though certainly a nice to have, so I'm not sure how soon we will be able to get to working on this. However, we are certainly interested in your scons diff as that will give us some guidance for when we do revisit this topic in the future. If you have any questions about the scons build system for the driver, mongodb-dev is probably an appropriate forum for questions.

Thanks,
Andrew

Comment by Pieter Willem Jordaan [ 26/Mar/14 ]

I managed to get the C++ driver built with mingw on Windows with minor changes to the code. The changes to the scons file, however, were not so easy. I will try to create a patch which makes it easier for cross-toolchains as that is currently my use case.

I am not very familiar with scons so this is delaying my progress.

Comment by Andrea Fontana [ 09/May/12 ]

still not work on linux using mingw :\

Comment by Pieter Willem Jordaan [ 21/Mar/12 ]

I remember now that you have to specify the UNICODE and _UNICODE defines when building the source, not sure if it is applicable.

Comment by Pieter Willem Jordaan [ 21/Mar/12 ]

This is correct, Thomas. I've noticed that the code using the *_s functions check if WIN32 is defined. The assumption is then made that it is Visual C++ compiling and not MingW. I have managed to build the source using mingw64 from TDM. The latest is utilizing gcc 4.6.1. I am uploading the patch I made. Please note that the patch also includes changes to SConstruct to use boost 1.48, but it is irrelevant for making mingw to work.

I am not sure which version mongo it was, but I believe the patch file will specify the git version used.

Please let met know if anything is missing and I will do my best to help out.

Comment by Thomas Pönitz [ 06/Dec/10 ]

Yes there are similar issues with ming64.

What's the use of the *_s functions? Shouldn't the CRT be thread safe (Thread local storage...)?

In Mingw there are macros like this:
#ifndef ctime_r
#define ctime_r(_Time,_Str) (ctime ((_Time)) ? (strcpy((_Str),ctime ((_Time))),(_Str)) : 0)
#endif
so it should be should be "only" a matter of inserting proper #ifdefs for mingw?

Comment by Justin Dearing [ 04/Sep/10 ]

Does the same thing happen on mingw64?

Comment by Andrea Fontana [ 29/Jun/10 ]

mingw on Linux gives same errors...

Generated at Wed Feb 07 21:58:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.