davidm / luacom

Microsoft Component Object Model (COM) binding for Lua
http://lua-users.org/wiki/LuaCom
Other
116 stars 51 forks source link

Cannot require luacom #18

Open Gyoraiyl opened 7 years ago

Gyoraiyl commented 7 years ago

Every time i use require("luacom") It always drop an error says:

error loading module 'luacom' from file 'c:\program files (x86)\lua\5.3\lib\lua\5.3\luacom.dll'

but I do have the luacom.dll file in c:\program files (x86)\lua\5.3\lib\lua\5.3\ this directory. I use luarocks to install luacom, other libraries installed by luarocks like luasocket or luafilesystem all working fine. Dont know what's going on here :(

moteus commented 7 years ago

This error means that Lua can find module file but it can not load it. E.g. dll is for different arch (x64 but Lua is x86). Or if there no some deps (e.g. you have no needed runtime). I belive if dll does not export correct function luaopen_luacom error message should be different. And I hope you do not install binary rock which installed when you just type luarocks install luacom Because in this case it install version for Lua 5.1 with deps from runtime from MSVC 2005. LuaRocks can not provide different binaries for different Lua versions. Try this one

luarocks install https://luarocks.org/manifests/luarocks/luacom-1.4-1.rockspec

But I fail compile original LuaCOM with luarocks so make my own pacakge.

luarocks install https://luarocks.org/manifests/moteus/luacom-scm.moteus-1.rockspec
Gyoraiyl commented 7 years ago

Hi moteus,

Thanks a lot for your help. But I got this error now when trying to install luacom by using this script

C:\Program Files (x86)\Lua\5.3>luarocks install https://luarocks.org/manifests/luarocks/luacom-1.4-1.rockspec Warning: variable CFLAGS was not passed in build_variables Makefile:73: *** missing separator. Stop.

Error: Build error: Failed building.

Got a same error when installing your package

C:\Program Files (x86)\Lua\5.3>luarocks install https://luarocks.org/manifests/moteus/luacom-scm.moteus-1.rockspec Makefile.win:52: *** missing separator. Stop.

Error: Build error: Failed building.

I'm totally a newbee about this ,no idea what's the error means.

moteus commented 7 years ago

Makefile:73: *** missing separator. Stop.

LuaCOM Make file compatiable with nmake from MSVC and fail for make from MinGW. Not sure how hard is build LuaCOM with MinGW. And because rockspec for LuaCOM uses this makefile as whell you have to use MSVC to build it. I compile my rockspec with MSVC 2010/2015.

robertlzj commented 6 years ago

I failed compile, too. Using MSBuild Tool (stand alone package from Microsoft Visual Studio) with Makefile53.win. Such as ..\luacom\source>nmake Makefile53.win all from 'Visual C++ 2015 x86 Native Build Tools Command Prompt'. Prompting:

.\src\library\luacom.cpp(2223): error C3861: 'luaL_register': identifier not found NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.EXE"' : return code '0x2' Stop.

Maybe I need to set "Installation paths" said in Makefile53.win carefully, and get Lua 5.3 compiled first.

Currently, I get a complied binary version which satisfied my requirement - use in windows 10, support lua 5.3. File is from Zuume Scripting Engine at SourceForge.

Just share remarks here. Thanks~