{"action":"created","issue":{"url":"https://api.github.com/repos/torch/torch7/issues/287","labels_url":"https://api.github.com/repos/torch/torch7/issues/287/labels{/name}","comments_url":"https://api.github.com/repos/torch/torch7/issues/287/comments","events_url":"https://api.github.com/repos/torch/torch7/issues/287/events","html_url":"https://github.com/torch/torch7/pull/287","id":94177862,"number":287,"title":"Add support for compilation on Windows using mingw32","user":{"login":"pkulchenko","id":77071,"avatar_url":"https://avatars.githubusercontent.com/u/77071?v=3","gravatar_id":"","url":"https://api.github.com/users/pkulchenko","html_url":"https://github.com/pkulchenko","followers_url":"https://api.github.com/users/pkulchenko/followers","following_url":"https://api.github.com/users/pkulchenko/following{/other_user}","gists_url":"https://api.github.com/users/pkulchenko/gists{/gist_id}","starred_url":"https://api.github.com/users/pkulchenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkulchenko/subscriptions","organizations_url":"https://api.github.com/users/pkulchenko/orgs","repos_url":"https://api.github.com/users/pkulchenko/repos","events_url":"https://api.github.com/users/pkulchenko/events{/privacy}","received_events_url":"https://api.github.com/users/pkulchenko/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":25,"created_at":"2015-07-09T23:54:07Z","updated_at":"2015-08-20T15:06:37Z","closed_at":"2015-07-10T04:25:02Z","pull_request":{"url":"https://api.github.com/repos/torch/torch7/pulls/287","html_url":"https://github.com/torch/torch7/pull/287","diff_url":"https://github.com/torch/torch7/pull/287.diff","patch_url":"https://github.com/torch/torch7/pull/287.patch"},"body":"This patch enables Torch7 compilation on Windows using mingw32 (or tdm-gcc with msys/msys2).\r\n\r\nThe steps needed:\r\n\r\n1. Install `torch/cwrap` and `torch/paths`\r\n2. Run the following commands:\r\n\r\n```\r\ncmake -E make_directory build\r\ncd build\r\ncmake .. -G \"MSYS Makefiles\" -DCMAKE_BUILD_TYPE=Release -DLUALIB=lua51.dll -DLUA_INCDIR=\"%LUA_INCDIR%\" -DLUA_LIBDIR=\"%LUA_LIBDIR%\" -DLUA=\"%LUA%\"\r\nmake\r\n```\r\n\r\nRelated ticket: #150. I've tested this under Windows 8.1 using msys2 and tdm-gcc-4.8, but it should work with other versions and configurations of mingw."},"comment":{"url":"https://api.github.com/repos/torch/torch7/issues/comments/133043248","html_url":"https://github.com/torch/torch7/pull/287#issuecomment-133043248","issue_url":"https://api.github.com/repos/torch/torch7/issues/287","id":133043248,"user":{"login":"cgravier","id":1123304,"avatar_url":"https://avatars.githubusercontent.com/u/1123304?v=3","gravatar_id":"","url":"https://api.github.com/users/cgravier","html_url":"https://github.com/cgravier","followers_url":"https://api.github.com/users/cgravier/followers","following_url":"https://api.github.com/users/cgravier/following{/other_user}","gists_url":"https://api.github.com/users/cgravier/gists{/gist_id}","starred_url":"https://api.github.com/users/cgravier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cgravier/subscriptions","organizations_url":"https://api.github.com/users/cgravier/orgs","repos_url":"https://api.github.com/users/cgravier/repos","events_url":"https://api.github.com/users/cgravier/events{/privacy}","received_events_url":"https://api.github.com/users/cgravier/received_events","type":"User","site_admin":false},"created_at":"2015-08-20T15:06:37Z","updated_at":"2015-08-20T15:06:37Z","body":"I don't know if there have been any follow up on this.\r\nAs I am looking for some adventures, I am trying to get torch up and running on a windows 7.1 box, with lua 5.3 and luarocks installed.\r\n\r\nIn @pkulchenko ticket submission, it is assumed that the first step is done, i.e. `torch/cwrap` and `torch/paths` are installed.\r\n\r\nHowever, in the same environment (windows + mingw), when installing `torch/cwrap` or `torch/paths` using luarocks, there is the same problem to set `cmake` flags in a mingw context.\r\n\r\nIt can be fixed in the same way, I guess, using the `-G \"MSYS Makefiles\" ` switch for the cmake command that can be run manually.\r\n\r\nHowever, this process also fails for unobvious (to me!) reasons.\r\n\r\nMaybe I should move this comment to the `torch/paths` project ? (problem: `torch/cwrap` is also affected, in the same way for the same reason).\r\n\r\nExample of `cmake` command on my box that is run on a freshly cloned `torch/paths` (I just added the `-G` flag and value from the command that is generated by luarocks and previously failed) : \r\n\r\n```\r\ncmake -E make_directory build && cd build && cmake .. -G \"MSYS Makefiles\" -DCMAKE_BUILD_TYPE=Release -DLUALIB=lua53.dll -DLUA_INCDIR=\"C:/Program Files (x86)/lua/5.3/include/\" -DLUA_LIBDIR=\"C:/Program Files (x86)/lua/5.3/bin/\" -DLUADIR=\"C:\\Program Files (x86)\\LuaRocks\\systree/lib/luarocks/rocks/paths/scm-1/lua\" -DLIBDIR=\"C:\\Program Files (x86)\\LuaRocks\\systree/lib/luarocks/rocks/paths/scm-1/lib\" -DCMAKE_INSTALL_PREFIX=\"C:\\Program Files (x86)\\LuaRocks\\systree/lib/luarocks/rocks/paths/scm-1\" && mingw32-make\r\n```\r\n\r\nAnd the resulting output : \r\n``` \r\nG:\\test\\installations\\paths>cmake -E make_directory build && cd build && cmake .. -G \"MSYS Makefiles\" -DCMAKE_BUILD_TYPE=Release -DLUALIB=lua53.dll -DLUA_INCDIR=\"C:/Program Files (x86)/lua/5.3/include/\" -DLUA_LIBDIR=\"C:/Program Files (x86)/lua/5.3/bin/\" -DLUADIR=\"C:\\Program Files (x86)\\LuaRocks\\systree/lib/luarocks/rocks/paths/scm-1/lua\" -DLIBDIR=\"C:\\Program Files (x86)\\LuaRocks\\systree/lib/luarocks/rocks/paths/scm-1/lib\" -DCMAKE_INSTALL_PREFIX=\"C:\\Program Files (x86)\\LuaRocks\\systree/lib/luarocks/rocks/paths/scm-1\" && mingw32-make\r\n-- Configuring done\r\n-- Generating done\r\n-- Build files have been written to: G:/test/installations/paths/build\r\n[ 50%] Building C object CMakeFiles/paths.dir/paths.c.obj\r\nprocess_begin: CreateProcess(NULL, /G/mingw/bin/gcc.exe -Dpaths_EXPORTS -O3 -DNDEBUG @CMakeFiles/paths.dir/includes_C.rsp -o CMakeFiles/paths.dir/paths.c.obj -c /G/test/installations/paths/paths.c, ...) failed.\r\nmake (e=2): The system cannot find the file specified.\r\nCMakeFiles/paths.dir/build.make:63: recipe for target 'CMakeFiles/paths.dir/paths.c.obj' failed\r\nmingw32-make[2]: *** [CMakeFiles/paths.dir/paths.c.obj] Error 2\r\nCMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/paths.dir/all' failed\r\nmingw32-make[1]: *** [CMakeFiles/paths.dir/all] Error 2\r\nMakefile:127: recipe for target 'all' failed\r\nmingw32-make: *** [all] Error 2\r\n``` "}}