-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
MinGW port #64
MinGW port #64
Conversation
I have no way to test this so I can only trust that it's an improvement over the current state (and not a regression for other platforms). It seems to build for me, but I'm going to wait for #66 to land to get this PR run through the full matrix, if you don't mind. |
@dominichamon, #66 will be great to get in! I'll wait for that to touchdown before continuing with this. I've tested the patches on Arch, Windows. unfortunately I don't have access to MacOS so can't test that. Having travis do that would be great. Does travis support Windows? |
I wonder if I comment if it will bump the PR and kick off a travis build... |
@@ -6,7 +6,9 @@ | |||
!/cmake/*.cmake | |||
*~ | |||
/test/benchmark_test | |||
/test/benchmark_test.exe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need these? I don't think we should be building in-tree like this.
Either way the stuff already seems to be there for Unix so I guess this is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some people do build in-tree, though, even if it's not the best idea...
Me, I'd make a different comment: this should be a *.exe
entry, the same way object files are handled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we shouldn't build in tree. I tried to follow the current .gitignore
style that was specifically adding the built executables. I think a catchall *.exe
would be much more useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifically adding the built executables makes sense for Unix platforms that don't have an executable extensions, but no need to duplicate this if there's an extension, just add a catchall.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thanks for the advice.
That branch builds on Windows 8.1 and passes all tests with
It would be cool to set up |
Just having a go at setting up appveyor on my personal repo. Will create a PR on top of this once it is merged. |
i don't know what appveyor is, but anything that builds windows continuously would be great. |
#ifdef OS_WINDOWS | ||
#include <Windows.h> | ||
#endif | ||
|
||
namespace benchmark { | ||
#ifdef OS_WINDOWS | ||
// Window's _sleep takes milliseconds argument. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: update the comment please
@dominichamon, it's a cloud based windows build service (it's free for open source projects). I'm most of the way with the integration - should be able to finish it up on Monday. Would be really good to get that in! |
The appveyor stuff has taken much longer than I thought it would - I needed to write a script that could download a specific version of MinGW depending on the version, threading model and exception model. The appveyor YAML file took a bit of cajoling but got there in the end. I'll push up the final changes today to the |
Got the build working for |
We use the SHGetValueA on Windows to retrieve the MHz of the processor but this requires the shlwapi library. Previous to this patch the library was linked with a MSVC specific pragma but there is no guarantee that on Windows we will be using MSVC. Therefore, it is much compile agnostic to use the standard CMAKE library linking mechanism to provide the definition of SHGetValueA
For cross platform and cross compiler portability we use the standard integer type for a 64-bit integer. MinGW on Windows doesn't have the definition for `int64`.
The children CPU usage doesn't seem to have a equivalent on NT systems so it just returns zero.
The python script provides a method to get the repository of mingw-builds gcc compilers and download one of them. This is useful for providing a matrix of compilations on appveyor. The versions of compilers are seperated by multiple things: - version - threading model - exception model - revision All four of those things need to be matched if using the libraries built by MinGW. The script allows you to specify all of those variations. If a variation isn't defined it picks the most common or latest settings. For example, if the version isn't specified the latest will be selected and if the exception model isn't defined then the zero exception model (seh) will be selected if available.
This file provides scripting to build the benchmark library in the cloud on the appveyor build system. It provides a matrix of configurations to cover as many possibilities as it can. Eventually MSVC can be added to the matrix to provide coverage of the Visual Studio solutions.
I edited the history to resolve your comments @dominichamon. I've pushed up the |
Nice work! I'll take a look at the patch. I don't know if I have permission either - it may have to be a Google org admin. I'll poke around. |
root_dir = root(location = args.location, arch = args.arch, | ||
version = args.version, threading = args.threading, | ||
exceptions = args.exceptions, revision = args.revision, | ||
log = logger) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
given you always pass this, you can kill the EmptyLogger above.
honestly, you can probably make the logger global and not even pass it through everywhere :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reasons it's there is so someone can use that python module as a library and turn logging on (or leave it off) when using the methods individually. For example I can then do:
import mingw
versions = mingw.repository()
root = mingw.root(version = (4, 9, 2))
And that will give me all the mingw operations without logging anything or I could pass my own logger in.
That being said - completely happy to remove all that stuff if you don't want it in there! I tried to make the script as reusable as possible, if people want to use it in other projects for appveyor support or integrate it into python based tool chains.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair enough. i tend to err on the side of less code, minimal functionality, to avoid any subtle issues.
however, this isn't on the critical path so it seems reasonable.
Cool - if the appveyor backend can get set up I can tune the configuration file to give speedy builds for MinGW. |
I also don't have access to the google-level appveyor. i'll ask around but in the meantime we should get this merged (assuming you're happy with it). |
👍 |
Im currently trying to compile google benchmark for MingW and failing for c++11 features as mutex and threads, do you know how to resolve that? |
It's going to depend on your version of MinGW's gcc i imagine:
https://stackoverflow.com/questions/16136142/c11-functionality-with-mingw
Dominic Hamon | Google
*There are no bad ideas; only good ideas that go horribly wrong.*
…On Fri, Jan 12, 2018 at 4:52 AM, Tamar ***@***.***> wrote:
Im currently trying to compile google benchmark for MingW and failing for
c++11 features as mutex and threads, do you know how to resolve that?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#64 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAfIMhxOX1DS8uDpOb2OND7PKgb_977kks5tJ1WFgaJpZM4C2SLZ>
.
|
@tamarlev you can use the downloading script to get the correct MinGW version in this repository. |
So I've patched up the library to compile with
gcc
4.9.2
:I've just gone through and fixed up the compiler warnings/errors at the moment. I've tried to make the commits as fine grained as possible in case you would like to
git cherry-pick
them ontomaster
.The library doesn't seem to currently work due to hangs inside
WaitForMultipleObjects
in the Windows kernel. The backtrace looks like it is stalling inside the MinGW implementation ofpthread_cond_init
which is wrapped bystd::condition_variable
. Thought I'd publish the branch in case anyone can provide any pointers?I'll try to move forward with getting it compiling with VS2013 Express.