[go: up one dir, main page]

Skip to content
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

What's the correct way to build this under Windows w/ MinGW? #72

Open
greatwolf opened this issue Aug 16, 2016 · 0 comments
Open

What's the correct way to build this under Windows w/ MinGW? #72

greatwolf opened this issue Aug 16, 2016 · 0 comments

Comments

@greatwolf
Copy link
greatwolf commented Aug 16, 2016

In particular how does my build environment need to be setup to ensure cmake finds what it needs?

Here's what's setup so far:

  • CMake 2.8.12.2
  • Mingw-64 gcc 4.9.1
  • luajit 2.1.0 built from luajit's repo
  • luarocks is setup

The corresponding paths for each of the above have been added to set Path.

Problems encountered so far:

  • Under mingw ssize_t is already defined under one of its headers. I fixed it by wrapping that typedef in an #ifndef guard in lib/TH/THGeneral.h.in.

  • The torch7 cmake file isn't properly locating my luajit location setup. I had to manually add

    FIND_PACKAGE(Lua51 REQUIRED)
    SET(LUA_INCDIR ${LUA_INCLUDE_DIR})
    SET(LUALIB ${LUA_LIBRARIES})
    

And even then cmake couldn't locate my lua header directly. I had to manually set the LUA_INCLUDE_DIR to G:/LuaJIT-2.1.0/include/luajit-2.1.

Torch7 finally builds after making the above changes. It produced 3 targets: libtorch.dll, libTH.dll and libluaT.dll and they all reside in G:/OSS/torch7/build. It's unclear to me if the directory layout of those target outputs and intermediate files is even correct. What should a properly installed directory tree look like so that outside projects can correctly and reliably find it as a dependency?

Since I'm originally trying to get torch-threads working, let's use that as an example. Running cmake over torch-threads gives me the follow errors:

CMake Error at CMakeLists.txt:7 (find_package):
  By not providing "FindTorch.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Torch", but
  CMake did not find one.

  Could not find a package configuration file provided by "Torch" with any of
  the following names:

    TorchConfig.cmake
    torch-config.cmake

  Add the installation prefix of "Torch" to CMAKE_PREFIX_PATH or set
  "Torch_DIR" to a directory containing one of the above files.  If "Torch"
  provides a separate development package or SDK, be sure it has been
  installed.

Now I can point Torch_DIR to some place in where TorchConfig.cmake exist but somehow that doesn't seem to be the right way to resolve things. And indeed I tried exactly that setting Torch_DIR to G:/OSS/torch7/build/cmake-exports but that only gives me more errors like:

CMake Error at G:/OSS/torch7/build/cmake-exports/TorchConfig.cmake:24 (INCLUDE):
  include could not find load file:

    TorchPathsInit

Likewise for TorchPackage, TorchWrap and others.

I'd really like to not have to play whack-a-mole with the build process. What's the right approach to ensure I can build torch and torch-threads painlessly with the environment I have?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant