How to Install LuaFileSystem? - lua

I'm making a lua application and I am going to need the LFS. However it gives me an error while installing.
`Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\user>luarocks install luafilesystem
Installing http://luarocks.org/repositories/rocks/luafilesystem-1.6.2-2.src.
...
7-Zip 9.10 beta Copyright (c) 1999-2009 Igor Pavlov 2009-12-22
Processing archive: luafilesystem-1.6.2.tar.gz
Extracting luafilesystem-1.6.2.tar
Everything is Ok
Size: 122880
Compressed: 27886
7-Zip 9.10 beta Copyright (c) 1999-2009 Igor Pavlov 2009-12-22
Processing archive: luafilesystem-1.6.2.tar
Extracting pax_global_header
Extracting luafilesystem-1.6.2
Extracting luafilesystem-1.6.2\Makefile
Extracting luafilesystem-1.6.2\Makefile.win
Extracting luafilesystem-1.6.2\README
Extracting luafilesystem-1.6.2\config
Extracting luafilesystem-1.6.2\config.win
Extracting luafilesystem-1.6.2\doc
Extracting luafilesystem-1.6.2\doc\us
Extracting luafilesystem-1.6.2\doc\us\examples.html
Extracting luafilesystem-1.6.2\doc\us\index.html
Extracting luafilesystem-1.6.2\doc\us\license.html
Extracting luafilesystem-1.6.2\doc\us\luafilesystem.png
Extracting luafilesystem-1.6.2\doc\us\manual.html
Extracting luafilesystem-1.6.2\rockspecs
Extracting luafilesystem-1.6.2\rockspecs\luafilesystem-1.3.0-1.rockspec
Extracting luafilesystem-1.6.2\rockspecs\luafilesystem-1.4.0-1.rockspec
Extracting luafilesystem-1.6.2\rockspecs\luafilesystem-1.4.0-2.rockspec
Extracting luafilesystem-1.6.2\rockspecs\luafilesystem-1.4.1-1.rockspec
Extracting luafilesystem-1.6.2\rockspecs\luafilesystem-1.4.1rc1-1.rockspec
Extracting luafilesystem-1.6.2\rockspecs\luafilesystem-1.4.2-1.rockspec
Extracting luafilesystem-1.6.2\rockspecs\luafilesystem-1.5.0-1.rockspec
Extracting luafilesystem-1.6.2\rockspecs\luafilesystem-1.6.0-1.rockspec
Extracting luafilesystem-1.6.2\rockspecs\luafilesystem-1.6.1-1.rockspec
Extracting luafilesystem-1.6.2\rockspecs\luafilesystem-1.6.2-1.rockspec
Extracting luafilesystem-1.6.2\rockspecs\luafilesystem-cvs-1.rockspec
Extracting luafilesystem-1.6.2\rockspecs\luafilesystem-cvs-2.rockspec
Extracting luafilesystem-1.6.2\src
Extracting luafilesystem-1.6.2\src\.gitignore
Extracting luafilesystem-1.6.2\src\lfs.c
Extracting luafilesystem-1.6.2\src\lfs.def
Extracting luafilesystem-1.6.2\src\lfs.h
Extracting luafilesystem-1.6.2\tests
Extracting luafilesystem-1.6.2\tests\test.lua
Extracting luafilesystem-1.6.2\vc6
Extracting luafilesystem-1.6.2\vc6\lfs.def
Extracting luafilesystem-1.6.2\vc6\luafilesystem.dsw
Extracting luafilesystem-1.6.2\vc6\luafilesystem_dll.dsp
Everything is Ok
Folders: 7
Files: 31
Size: 86449
Compressed: 122880
cl /MD /O2 -c -Fosrc/lfs.obj -IC:/Program Files/Lua/5.1/include src/lfs.c
'cl' is not recognized as an internal or external command,
operable program or batch file.
Error: Build error: Failed compiling object src/lfs.obj
C:\Users\user>`
I was running as Admin. I have tried looking at other posts and looking at the manual, but to no avail, Can someone help?

You need a Microsoft C compiler. There are other C compilers for Windows but they might not have compatible switches.
Microsoft hasn't shipped a C compiler independent of Visual Studio since they began the free Express edition. Install it and you should be good to go.
Build environment means that various environment variables, esp. PATH, are set up for the compiler. This is set up by running a batch file the VS provides. There could be a shortcut for it but if not (I suspect the Express version might not) look for a file like vc*.cmd or vc*.bat and create a shortcut to it or just run it at your command prompt.

Related

Building OpenCV with CUDA support Error on transpose.cu

Recently I am trying to build OpenCV with CUDA support, and I met problem while building the module cudaarithm.
OpenCV source: git cloned from : http://github.com/Itseez/opencv.git
OpenCV branch: master branch
OpenCV commit:
`commit 5466e321b8c8f97536002a357e5b7ff49a5d2bf9, on Tue Feb 10 12:17:11 2015 +0000`
CUDA version: CUDA 6.5
Hardware: MacBook Pro (13-inch, Mid 2010)
GPU: NVIDIA GeForce 320M 256 MB
OS Version: OS X Yosemite
Steps I used:
1. cd in OpenCVSource, then mkdir myrelease, and cd myrelease
2. cmake -DPLANTUML_JAR=/usr/local/Cellar/plantuml/8002 -D BUILD_DOCS=1 -DPYTHON2_LIBRARY=/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib -DPYTHON2_INCLUDE_DIR=/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -DPYTHON3_LIBRARY=/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/libpython3.4m.dylib -DPYTHON3_INCLUDE_DIR=/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/include/python3.4m -D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -Wno-dev -DNVCC_FLAGS_EXTRA="-Xcompiler -stdlib=libstdc++; -Xlinker -stdlib=libstdc++" -DOPENCV_EXTRA_CXX_FLAGS=" -stdlib=libstdc++" -DOPENCV_EXTRA_EXE_LINKER_FLAGS="-stdlib=libstdc++" ..
3. make VERBOSE=1
Expect Result: Building success without error
Actual Result: when building OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu, error happend like below:
/Users/Hawk/Documents/study/DIP/OpenCV/OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu(61): *error: identifier "getInputMat" is undefined*
/Users/Hawk/Documents/study/DIP/OpenCV/OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu(67): *error: identifier "getOutputMat" is undefined*
/Users/Hawk/Documents/study/DIP/OpenCV/OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu(92): *error: identifier "syncOutput" is undefined*
Then what action I take:
check the code and I found these undefined symboles are defined in OpenCVSource/modules/core/include/opencv2/core/private.cuda.hpp
check the code and I confrim that the "transpose.cu" file include "opencv2/core/private.cuda.hpp"
check the building log, and I the confirm the private.cuda.hpp is in the search path of header file
cp "opencv2/core/private.cuda.hpp" as another file "opencv2/core/hawk.hpp", and then edit "transpose.cu" to include this new file, and I found
the "undifined symbole error" disapeared.
Although this is a workable workaround, I would like know whether the original OpenCV source cannot be compiled.
All, I think I found the problem cause.
Before I met such problem, I've already build and install OpenCV using older code from the git repo. So that there already have header files in my /usr/local/include/opencv2, especially there is /usr/local/include/opencv2/core/private.cuda.hpp.
However, it is an older one that doesn't define the symbols reporting undefined in above question. At the same time I found during the building nvcc have -I/usr/local/include in the command line, so that it use wrong private.cuda.hpp. As you know it should use the one in OpenCVSource, not the older installed one.
I think the solution is to gracefully remove the original installed OpenCV from my computer, then build again. I am trying and I will report later.

How to integrate LuaJIT with LuaRocks on Windows?

I downloaded the source of LuaJIT and compiled it with msvc120.dll (VS 2013 x64). When I run it from the command line I have no problems executing some basic lua. Now the LuaJIT installation guide mentions moving luajit.exe and lua51.dll into their own folder. From there it says to create a lua folder and under that a jit folder with the contents of src/jit moved underneath the newly created jit folder.
From my understanding my folder should look like and contain:
luajit.exe
lua51.dll
/lua
/jit
bc.lua
[rest of jit files]
vmdef.lua
Is this correct or am I missing files?
Now after I built my luajit I tried to wire it up into my luarocks to act as my interpreter using
install.bat /LUA C:\LuaJIT\2.0.3\[folder with above content]
However this cannot find the header files. I then copied over what are the header files into the folder above and that wires it up, but I can never actually get anything to compile when pointed over to LuaJIT. Edit: The error I get is the following,
C:\LuaJIT\2.0.3\bin\lua51.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x2D0
Error: Failed installing dependency: https://rocks.moonscript.org/luafilesystem-1.6.2-2.src.rock - Build error: Failed compiling module lfs.dll
Is the correct way to handle this to simply point to my lua binaries and from there leverage LuaJIT to run my files or am I doing something wrong with wiring up LuaJIT and luarocks? The former seems to work for the most part, since I only ran into one library compilation issue, lua-cjson.
I've run on exactly the same problem, but they've found a solution right here:
https://github.com/keplerproject/luafilesystem/issues/22
I knew that for "linking DLLs statically" there is a so-called "export" .lib file, which is passed to the linker (and not the DLL itself).
So, for example, when compiling, LuaRocks was doing this:
cl /nologo /MD /O2 -c -Fosrc/mime.obj -ID:/LuaJIT-2.0.4/include/ src/mime.c -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DNDEBUG -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport) mime.c
link -dll -def:core.def -out:mime/core.dll D:/LuaJIT-2.0.4/bin/lua51.dll src/mime.obj
My LuaJIT was compiled from source in D:\LuaJIT-2.0.4\src, but I made two folders myself: D:\LuaJIT-2.0.4\include with all *.h files copied from src and D:\LuaJIT-2.0.4\bin with luajit.exe, lua51.dll, and then later lua51.exp and lua51.lib. Still same error, but this was the right track.
Fix
Now, check where your LuaRocks configs are:
luarocks.bat help
Scroll down to a section like:
CONFIGURATION
Lua version: 5.1
Configuration files:
System: D:/luarocks/config-5.1.lua (ok)
User : (... snip ...)
Edit the System configuration file, specifically see the part:
variables = {
MSVCRT = 'VCRUNTIME140',
LUALIB = 'lua51.dll'
}
Here! LUALIB should be the .lib file. If your export lib is alongside the DLL, you just need to change to:
variables = {
MSVCRT = 'VCRUNTIME140',
LUALIB = 'lua51.lib' -- here!
}
Verification
And now:
luarocks.bat install luasocket
(...)
link -dll -def:core.def -out:socket/core.dll D:/LuaJIT-2.0.4/bin/lua51.lib src/luasocket.obj (...)
(...)
luasocket 3.0rc1-2 is now built and installed in D:\luarocks\systree (license: MIT)
Note the first argument passed to the linker.

"Required package rtl not found" when building with Hudson

I am trying to get Hudson to work with my Delphi project. I am using the following batch file to build my project (as suggested in this blog post):
call "C:\Program Files\Embarcadero\RAD Studio\8.0\bin\rsvars.bat"
msbuild /p:Win32LibraryPath="$(BDS)\lib;$(BDS)\lib\win32\release;$(BDS)\lib\win32\debug;$(BDSUSERDIR)\Imports;$(BDS)\Imports;$(BDSCOMMONDIR)\Dcp;$(BDS)\include;" /t:build /p:config=Debug /verbosity:detailed "MyProject\src\MyProject.dproj"
if errorlevel 1 exit 1
I always end up with the error
Embarcadero Delphi for Win32 compiler version 22.0
Copyright (c) 1983,2010 Embarcadero Technologies, Inc.
Fatal: E2202 Required package 'rtl' not found
I don't understand this as rtl.dcp is in "$(BDS)\lib\win32\release" which is on the library path. I am using runtime packages by the way.
Any hints what I can do to solve this?
Edit It seems that the paths do not end up in the command line, which looks something like (after removing project-specific paths):
C:\Program Files\Embarcadero\RAD Studio\8.0\bin\dcc32.exe -$O- -$W+ --inline:off -$A4 -$R+ -$Q+ --doc --no-config -B -LUrtl;vcl;ReportingR;ComponentsR -Q -AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE -DDEBUG;CONSTRAINT_CHECKING;_VER6;EUREKALOG_VER6;EurekaLog -V -VN -GD --drc -W-SYMBOL_DEPRECATED -W-SYMBOL_PLATFORM -W-UNIT_PLATFORM -W-UNIT_DEPRECATED Myproject.dpr
I found the answer in a comment to the original blog post. It turns out that in Delphi XE they changed the name of the Win32LibraryPath property to DelphiWin32LibraryPath. Changing the batch script accordingly fixes the issue.
The first path $(BDS)\Lib for XE,XE2 and XE 10.2 should be change for $(BDSLIB)\$(PLATFORM)\release

rapc: c: Error!: Data contribution too large j2me polish

I am working on a project that uses j2me polish and now i am receiving an error i.e Using Default Jar Packager
creating JAD file [D:\MobileDevelopment\risingkarachi5_21_2012\dist\BlackBerry-5.0-de_DE-risingkarachi.jad].
jdp: Reading template...
jdp: Collecting java classes from D:\MobileDevelopment\risingkarachi5_21_2012\build\real\BlackBerry\5.0\de_DE\source...
jdp: Collecting resources from D:\MobileDevelopment\risingkarachi5_21_2012\build\real\BlackBerry\5.0\de_DE\resources...
jdp: Writing files to project D:\MobileDevelopment\risingkarachi5_21_2012\build\real\BlackBerry\5.0\de_DE\J2ME_Polish_Beispiel.jdp...
jdp: Creating D:\MobileDevelopment\risingkarachi5_21_2012\build\real\BlackBerry\5.0\de_DE\J2ME_Polish_Beispiel.jdp
JDP: Note: project is obfuscated, the generated JDP will not contain the necessary subproject for the imported files.
jdp: Creating D:\MobileDevelopment\risingkarachi5_21_2012\build\real\BlackBerry\5.0\de_DE\J2ME_Polish_BeispielLIB.jdp
rapc: Converting jar to cod for device [BlackBerry/5.0]
rapc: Resolving
rapc: Optimizing
rapc: c: Error!: Data contribution too large: 435372
rapc-call: [java, -Xmx512m, -cp, C:\Program Files (x86)\Research In Motion\BlackBerry JDE 5.0.0\bin\rapc.jar, net.rim.tools.compiler.Compiler, import=C:\Program Files (x86)\Research In Motion\BlackBerry JDE 5.0.0\lib\net_rim_api.jar, codename=BlackBerry-5.0-de_DE-risingkarachi, BlackBerry-5.0-de_DE-risingkarachi.rapc, BlackBerry-5.0-de_DE-risingkarachi.jar]
D:\MobileDevelopment\risingkarachi5_21_2012\build.xml:99: rapc failed and returned 97
BUILD FAILED (total time: 13 seconds)
I have used all blackberry properties in build.xml and i have followed
http://www.enough.de/products/j2me-polish/documentation/platforms/blackberry/ link to to create the blackberry build but still not resolved.
my issue has been resolved, this issue occurs when you are using some resources like classes or images are more then 64kb and my single class was 296kb so i was receiving this error and then i divided my that class into multiple small classes.
Thanks

Installing luasql 2.2 with luarocks onto lua for windows install

So it turns out lua for windows install has some earlier 2.1 version of luasql on it, and I need to be able to use luasql 2.2 (particularly mysql). I've spent all day trying to install this thing with luarocks but keep hitting a wall. This is the 3rd wall I've hit but the first one that I just have no clue where to even begin.
I run: luarocks install luasql-mysql MYSQL_DIR="E:/Programs/MySQL/MySQL Server 5.5"
It goes through and outputs (removing a lot of the output where it's just repeating the same thing but different file):
Extracting luasql-2.2.0\src\jdbc
Extracting luasql-2.2.0\src\jdbc\Makefile
... (lots of these here)
Extracting luasql-2.2.0\vc6\sqlite.def
Everything is Ok
Folders: 17
Files: 84
Size: 358091
Compressed: 440320
cl /MD /O2 -c -Fosrc/luasql.obj -IF:/Code/Lua/5.1/include src/luasql.c -IE:/Prog
rams/MySQL/MySQL Server 5.5/include
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
luasql.c
cl /MD /O2 -c -Fosrc/ls_mysql.obj -IF:/Code/Lua/5.1/include src/ls_mysql.c -IE:/
Programs/MySQL/MySQL Server 5.5/include
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
ls_mysql.c
e:\programs\mysql\mysql server 5.5\include\mysql_com.h(291) : error C2061: synta
x error : identifier 'SOCKET'
e:\programs\mysql\mysql server 5.5\include\mysql_com.h(337) : error C2059: synta
x error : '}'
... (lots of these here, same errors just different lines)
E:/Programs/MySQL/MySQL Server 5.5/include\mysql.h(374) : error C2143: syntax er
ror : missing '{' before '*'
E:/Programs/MySQL/MySQL Server 5.5/include\mysql.h(374) : fatal error C1003: err
or count exceeds 100; stopping compilation
Error: Build error: Failed compiling object src/ls_mysql.obj
Any idea where to start? I've had to a) install standalone mysql (was previously using one that came with WAMP since I was already using that before), and b) install visual studio 2010 (c# and c++ versions so far), and c) use visual studio command prompt to run the luarocks stuff, if I use regular command problem it breaks way before this.
I'm hoping this is an easy issue to fix for someone familiar with compiling C which is what this seems to be doing.
Add the following to ls_mysql.c after line 17:
#include <windows.h>
So that windows.h is included after winsock.h and before mysql.h.
References:
http://forums.mysql.com/read.php?45,37472,37472
C++ Redefinition Header Files (winsock2.h)

Resources