hiili / WindowsTorch

Windows binary build of the Torch machine learning framework
63 stars 23 forks source link

csvigo build error #2

Open zsmith3 opened 7 years ago

zsmith3 commented 7 years ago

I am trying to install csvigo. I have used: luarocks install csvigo

But I get the error: libcsvigo.dll : fatal error LNK1120: 12 unresolved externals NMAKE : fatal error U1077: '"C:\Program Files\CMake\bin\cmake.exe"' : return code '0xffffffff' Stop. NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX86\x86\nmake.exe"' : return code '0x2' Stop. NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX86\x86\nmake.exe"' : return code '0x2' Stop. Error: Build error: Failed building.

Full output here: https://pastebin.com/AVQmwxWc

I had a similar error when trying to install nn, but fixed it using the steps here: https://github.com/torch/torch7/wiki/Windows#the-nn-package

How can I fix this?

hiili commented 7 years ago

Hi zsmith3!

First, sorry for the delay! Did you already get this resolved?

I haven't used that rock myself and haven't seen that particular error, neither. However, it looks like you are using the VS toolchain in 32-bit mode but linking with the 64-bit version of WindowsTorch. Could that cause also the link errors, maybe?

(From the aforementioned wiki page:) You can choose between a 32-bit and a 64-bit build by running the following build process in the corresponding environment.

32-bit: use the "VS2015 x86" task in Cmder or the VS2015 x86 Native Tools Command Prompt 64-bit: use the "VS2015 x64" task in Cmder or the VS2015 x64 Native Tools Command Prompt

Best regards, Paul

zsmith3 commented 7 years ago

Hi. I never resolved the issue, although it is no longer a problem to me as I have found a different way to do what I wanted to do.

I tried running the native tools command prompt in both x86 and x64 mode and they both give the errors. The only noticeable difference is that in x86 it gives '12 unresolved externals' whereas in x64 it only gives '7 unresolved externals'. To my knowledge it wouldn't make a difference, but if it is of any importance, I have been using the VS 2017 command prompts, rather than the VS 2015 ones. I did also try the 2015 version, and it gave a different error.

As I say, I no longer have a use for this so don't worry about it for my sake. Thanks anyway.

hiili commented 7 years ago

Thanks for the information, it might be useful if someone decides to look more closely into this problem. Unfortunately, these kind of errors seem to be quite typical when building these rocks on Windows. I'm glad to hear that you found a way to proceed!

vinic15 commented 5 years ago

Hey zsmith3 can you please tell me how you managed to install csvigo on windows?

zsmith3 commented 5 years ago

Hey zsmith3 can you please tell me how you managed to install csvigo on windows?

I didn't. As above, I attempted to use luarocks install csvigo, but it failed, so I eventually gave up and found some other software to do what I wanted to do. Sorry I can't be any more helpful.

EugeneManushkin commented 4 years ago

I have the same issue with both x86 and x64 WindowsTorch packages:

...
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
luarocks install csvigo
...
Scanning dependencies of target csvigo
[ 50%] Building C object CMakeFiles/csvigo.dir/init.c.obj
init.c
[100%] Linking C shared module libcsvigo.dll
init.c.obj : error LNK2019: unresolved external symbol _lua_settop referenced in function _luaL_setfuncs
init.c.obj : error LNK2019: unresolved external symbol _lua_pushvalue referenced in function _luaL_setfuncs
init.c.obj : error LNK2019: unresolved external symbol _lua_pushstring referenced in function _luaL_setfuncs
init.c.obj : error LNK2019: unresolved external symbol _lua_pushcclosure referenced in function _luaL_setfuncs
init.c.obj : error LNK2019: unresolved external symbol _lua_createtable referenced in function _luaopen_libcsvigo
init.c.obj : error LNK2019: unresolved external symbol _lua_settable referenced in function _luaL_setfuncs
init.c.obj : error LNK2019: unresolved external symbol _luaL_checkstack referenced in function _luaL_setfuncs
libcsvigo.dll : fatal error LNK1120: 7 unresolved externals
EugeneManushkin commented 4 years ago

It seems that unresolved symbols are situated in C:\torch\lib\libluajit.lib, so I workarounded the issue on csvigo side by modifying it's CMakeLists.txt:

 ADD_TORCH_PACKAGE(csvigo "${src}" "${luasrc}" "CSV Reader/Writer")

-TARGET_LINK_LIBRARIES(csvigo luaT TH )
+TARGET_LINK_LIBRARIES(csvigo luaT TH libluajit)

I do not recommend to use this solution, but this may help to investigate the issue.