{"action":"created","issue":{"url":"https://api.github.com/repos/rake-compiler/rake-compiler-dock/issues/12","repository_url":"https://api.github.com/repos/rake-compiler/rake-compiler-dock","labels_url":"https://api.github.com/repos/rake-compiler/rake-compiler-dock/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/rake-compiler/rake-compiler-dock/issues/12/comments","events_url":"https://api.github.com/repos/rake-compiler/rake-compiler-dock/issues/12/events","html_url":"https://github.com/rake-compiler/rake-compiler-dock/issues/12","id":132902076,"number":12,"title":"The mingw32 environment is too old.","user":{"login":"nicolasnoble","id":7281574,"avatar_url":"https://avatars.githubusercontent.com/u/7281574?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolasnoble","html_url":"https://github.com/nicolasnoble","followers_url":"https://api.github.com/users/nicolasnoble/followers","following_url":"https://api.github.com/users/nicolasnoble/following{/other_user}","gists_url":"https://api.github.com/users/nicolasnoble/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolasnoble/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolasnoble/subscriptions","organizations_url":"https://api.github.com/users/nicolasnoble/orgs","repos_url":"https://api.github.com/users/nicolasnoble/repos","events_url":"https://api.github.com/users/nicolasnoble/events{/privacy}","received_events_url":"https://api.github.com/users/nicolasnoble/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-02-11T06:45:14Z","updated_at":"2016-02-14T19:14:04Z","closed_at":null,"body":"So I finally managed to get what I needed to do go create @grpc ruby gems. However, I had to heavily modify the Dockerfile for rake-compiler-dock, and [commit it to the repository](https://github.com/grpc/grpc/blob/release-0_13/third_party/rake-compiler-dock/Dockerfile). I am not happy about that, and I would love if we could make it so that grpc builds out of the box using rake-compiler-dock. But the changes I've made are extremely grpc-centric, and won't work for you without adaptation. Here's the first big issue I've encountered.\r\n\r\nThe current Docker image for rake-compiler-dock is using `mingw32`. The problem with that package is it's pretty much [obsolete](http://packages.ubuntu.com/search?keywords=mingw32&searchon=names&suite=all&section=all), [superseded](http://packages.ubuntu.com/search?keywords=mingw-w64&searchon=names&suite=all&section=all) by `mingw-w64`. In fact, grpc can't be used with it. The main reason is that it's using antediluvian headers, from the Windows XP era, and doesn't have [features](https://msdn.microsoft.com/en-us/library/windows/desktop/ms682052(v=vs.85).aspx) that grpc [requires](https://github.com/grpc/grpc/blob/release-0_13/include/grpc/impl/codegen/sync_win32.h) from its public headers API. In other words, if you are trying to compile a piece of C code (the ruby extension in that case) against grpc targeting Windows, you can't do that if your Windows SDK is the old mingw32 environment - we require at least Windows Vista.\r\n\r\nI don't know if you have any desire to migrate your environment to mingw-w64, but considering it's already disappearing from Ubuntu, it might be a good idea to upgrade at some point.\r\n\r\n\r\nHere's a list of problems, issues and various thoughts I had while dealing with mingw-w64, if that can help you with the migration, should you decide to go for it.\r\n- I am not sure what's special about the \"_rubenvb\" mingw-w64 compilers you're downloading, but maybe they're not so much necessary after that change ? I didn't try touching them, but my gut feeling would be to get rid of these after migrating \r\n- Ruby 1.8 and 1.9 didn't compile using it. I didn't really try poking these, as grpc's ruby implementation requires 2.0.0+ anyway. I just got rid of them. Sorry. Shall you need it, I can be of help if you get stuck on these, just contact me. So right now, grpc's rake-compiler-dock image only contains 2.0.0, 2.1.5, 2.2.2 and 2.3.0.\r\n- Once installed, all versions of Ruby had a definition of `gettimeofday` in `win32.h` which collides with mingw's. I [pushed them away](https://github.com/grpc/grpc/blob/release-0_13/third_party/rake-compiler-dock/Dockerfile#L180).\r\n- Once installed, Ruby 2.0.0-p645 has [a broken test](https://github.com/ruby/ruby/blob/ruby_2_0_0/include/ruby/win32.h#L781) to check for MINGW64, and enters a [control path](https://github.com/ruby/ruby/blob/ruby_2_0_0/include/ruby/win32.h#L798) which doesn't work on the new environment. I [pushed it away](https://github.com/grpc/grpc/blob/release-0_13/third_party/rake-compiler-dock/Dockerfile#L181).\r\n- When linking, the mingw-w64 environment creates a direct dependency on libgcc-XXX.dll, and transitive dependencies to others. I solved that by [adding `-static`](https://github.com/grpc/grpc/blob/release-0_13/src/ruby/ext/grpc/extconf.rb#L100) on the link options of the grpc extension, which is obviously not really something you should force everyone to. But pushing away the flurry of dlls directly into the image might be a good alternative.\r\n- Even when using `-static`, it still wanted a dependency on libwinpthread.dll. I [pushed it away](https://github.com/grpc/grpc/blob/release-0_13/third_party/rake-compiler-dock/Dockerfile#L182) by mangling the docker image directly. Which also shows what I was talking about in my previous point.\r\n- When using `-static`, obviously, it's using the static version of the ruby runtime dll. In all cases, this is a big no-no, so [my workaround](https://github.com/grpc/grpc/blob/release-0_13/third_party/rake-compiler-dock/Dockerfile#L184) might still be useful in the general case when people would shoot themselves in the foot using `-static`.\r\n\r\nThat's about it for the mingw-w64 issue :)"},"comment":{"url":"https://api.github.com/repos/rake-compiler/rake-compiler-dock/issues/comments/183957684","html_url":"https://github.com/rake-compiler/rake-compiler-dock/issues/12#issuecomment-183957684","issue_url":"https://api.github.com/repos/rake-compiler/rake-compiler-dock/issues/12","id":183957684,"user":{"login":"nicolasnoble","id":7281574,"avatar_url":"https://avatars.githubusercontent.com/u/7281574?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolasnoble","html_url":"https://github.com/nicolasnoble","followers_url":"https://api.github.com/users/nicolasnoble/followers","following_url":"https://api.github.com/users/nicolasnoble/following{/other_user}","gists_url":"https://api.github.com/users/nicolasnoble/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolasnoble/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolasnoble/subscriptions","organizations_url":"https://api.github.com/users/nicolasnoble/orgs","repos_url":"https://api.github.com/users/nicolasnoble/repos","events_url":"https://api.github.com/users/nicolasnoble/events{/privacy}","received_events_url":"https://api.github.com/users/nicolasnoble/received_events","type":"User","site_admin":false},"created_at":"2016-02-14T19:14:04Z","updated_at":"2016-02-14T19:14:04Z","body":"And that's what we do already :-)"}}