Installing moonscript via luarocks on Windows - lua

When I try to install moonscript through luarocks, the process errors out in installing the dependencies for moonscript, saying that "cl" isn't an installed / recognized program.
C:\Users\Kingdaro>luarocks install moonscript
Installing http://luarocks.org/repositories/rocks/moonscript-0.2.4-1.src.rock...
Missing dependencies for moonscript:
lpeg >= 0.10, ~= 0.11
alt-getopt >= 0.7
7-Zip 9.10 beta Copyright (c) 1999-2009 Igor Pavlov 2009-12-22
Processing archive: lpeg-0.12.tar.gz
Extracting lpeg-0.12.tar
Everything is Ok
Size: 245760
Compressed: 66649
7-Zip 9.10 beta Copyright (c) 1999-2009 Igor Pavlov 2009-12-22
Processing archive: lpeg-0.12.tar
Extracting lpeg-0.12
Extracting lpeg-0.12\makefile
Extracting lpeg-0.12\HISTORY
Extracting lpeg-0.12\test.lua
Extracting lpeg-0.12\re.lua
Extracting lpeg-0.12\lpeg.html
Extracting lpeg-0.12\re.html
Extracting lpeg-0.12\lpeg-128.gif
Extracting lpeg-0.12\lptypes.h
Extracting lpeg-0.12\lpcap.h
Extracting lpeg-0.12\lpcap.c
Extracting lpeg-0.12\lpcode.h
Extracting lpeg-0.12\lpcode.c
Extracting lpeg-0.12\lpprint.h
Extracting lpeg-0.12\lpprint.c
Extracting lpeg-0.12\lptree.h
Extracting lpeg-0.12\lptree.c
Extracting lpeg-0.12\lpvm.h
Extracting lpeg-0.12\lpvm.c
Everything is Ok
Folders: 1
Files: 18
Size: 220385
Compressed: 245760
cl /MD /O2 -c -Folpcap.obj -IC:/Program Files (x86)/Lua/5.1/include lpcap.c
'cl' is not recognized as an internal or external command,
operable program or batch file.
Error: Failed installing dependency: http://luarocks.org/repositories/rocks/lpeg
-0.12-1.src.rock - Build error: Failed compiling object lpcap.obj
I'm not sure what to do here; I've been googling a solution for the past couple of days but couldn't find anything relevant. If it helps, I'm using the Lua 5.1.4 installation provided by Lua for Windows.

From MSDN:
cl.exe is a tool that controls the Microsoft C and C++ compilers and
linker. cl.exe can be run only on operating systems that support
Microsoft Visual Studio.
You should run luarocks install inside the Visual Studio Command Prompt.
I tried to install moonscript without Visual Studio and found that moonscript does not have a binary distribution.
Anyway, I found the binary package for each of moonscript's dependencies, the installation procedure is the follwing:
luarocks install lpeg 0.10-1 # this is the one that failed first
luarocks install luafilesystem 1.6.0-1 # this one failed after installing lpeg
But the following:
luarocks install moonscript
Can only be done within the Visual Studio Command Prompt unless you manually download a binary package.

cl is the compiler that is part of Visual Studio. That failure is happening because luarocks is attempting to build lpeg as a dependency. You either need to find a way to get luarocks to install a pre-built lpeg (which I assume it would have done if one existed in its database) or you need to get a copy of visual studio (I believe some versions are free).

Related

Could not identify shiboken version (5.15.2)

I try use combination from shiboken + C++ + Qt on Windows as my colleagues and it is not working
Console: x86 from MVS with administrator, QT 5.15.2 , CMAKE 3.19.8
Python from MVS installer 3.7 (use paths: PYTHONHOME C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64, path : C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64)
Shiboken download from https://code.qt.io/cgit/pyside/pyside-setup.git/
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug
C:\Users\...qt-5.15.2\pyside-setup\sources\shiboken2\ -DBUILD_TESTS=False
-DCMAKE_PREFIX_PATH='C:\Users\...\qt-5.15.2;' -DCMAKE_INSTALL_PREFIX='C:\Users\...\QT\shiboken2-debug' -
DPYTHON_EXECUTABLE='C:\ProgramFiles(x86)\MicrosoftVisualStudio\Shared\Python37_64\python_d.exe'
OUTPUT:
CMake Error at CMakeLists.txt:51 (message):
Could not identify shiboken version. Error:
when i change cmake file i saw interesting: PYTHON_DEBUG_LIBRARIES is empty
Having examined the cmakefile, I can saw that wherever the cmake calls the execute_process with python_d, python does not work and returns null, path to python_d is correct. I have python_d.exe in directory. I try install python not from MVS, and have same result. I try use 3.9 python. I cleaned sys paths from old python versions.
So, thanks colleague, it was a bad path DPYTHON_EXECUTABLE, i add message in Cmake file to output correct path, and successed used.
"C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python37_64/python_d.exe"
Before that I reinstalled the MVS, but I don’t think it had any effect

Install zbar failed on Watson Studio

I tried to execute this
! pip install zbar
The error message is
Collecting zbar
Using cached .../zbar-0.10.tar.bz2
Building wheels for collected packages: zbar
Running setup.py bdist_wheel for zbar ... error
Complete output from command /...:
...
gcc ...
In file included from zbarmodule.c:24:0:
zbarmodule.h:26:18: fatal error: zbar.h: No such file or directory
#include <zbar.h>
^
compilation terminated.
Looks like an include file is missing. Any idea?
As you guessed, it does need zbar-devel to be installed on centos kind systems.
sudo yum install zbar-devel
Sudo is disabled on Jupyter Notebook on watson studio and is only accessible
by Watson Studio - IBM Cloud Operators.
At this moment, it is advisable to raise the Enhancement request so that
Watson studio Development team can consider and install this library by default.
http://ibm.biz/dsxideas
Thanks,
Charles.

Compiling LuaSocket: Cannot open file: 'string.h'

The log:
C:\WINDOWS\system32>luarocks install luasocket
Installing https://luarocks.org/luasocket-3.0rc1-2.src.rock...
Using https://luarocks.org/luasocket-3.0rc1-2.src.rock... switching to 'build' mode
cl /nologo /MD /O2 -c -Fosrc/mime.obj -Ic:/lua/include/ src/mime.c -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DNDEBUG -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport)
mime.c
src/mime.c(5): fatal error C1083: Cannot open include file: 'string.h': No such file or directory
Error: Build error: Failed compiling object src/mime.obj
I'm very new to the whole LuaRocks thing, so I have no idea how to go about fixing this.
Here's a non-complete guide to get you started on installing lua modules from a fresh Windows 7.
1) We need LuaRocks in order to install Lua dependencies automatically (similar to cpan/cpanm in Perl or pip in Python). Download LuaRocks by grabbing the latest version with a "-win32.zip" suffix from here: http://keplerproject.github.io/luarocks/releases/
At the time of this writing, this is the following file: http://keplerproject.github.io/luarocks/releases/luarocks-2.3.0-win32.zip
2) Unzip it into a new directory and install it with install.bat /L. Without the "/L" flag, it will complain that it cannot find your existing Lua installation. With the flag, it will just install a new Lua binary (version 5.1). LuaRocks is now installed to C:\Program Files (x86)\LuaRocks. You may now delete the extracted "luarocks-2.3.0-win32" directory.
3) In order to compile and install modules, we will need a C++ compiler. Download and install the Visual C++ Build Tools 2015 from here: http://landinghub.visualstudio.com/visual-cpp-build-tools
(We want this so that we can avoiding installing the huge, multi-gigabyte Visual Studio 2015.)
4) Navigate to C:\Program Files (x86)\Microsoft Visual C++ Build Tools. Right click on "Visual C++ 2015 x86 Native Build Tools Command Prompt", and select "Run as administrator".
5) Run the following command: "C:\Program Files (x86)\LuaRocks\luarocks.bat" install luasocket.
Note that you may have to install additional stuff for certain modules. And sometimes, modules are simply unable to be compiled on Windows at all.

Error configuring OpenCV project with CMake on Windows

I used the prebuilt OpenCV 3.0.0 version. It works when I create a Visual Studio project directly, and when I add include and library directories.
Now I am making a CMakeList.txt file (so that I can run the same code on different systems). It will be used to create the Visual Studio project on Windows, and Makefile on Unixes, etc.
cmake_minimum_required(VERSION 2.8)
project( Facade )
find_package( OpenCV REQUIRED )
add_executable( Facade grammar.cpp )
target_link_libraries( Facade ${OpenCV_LIBS} )
When I generate the Visual Studio file on Windows, I got the following error:
CMake Warning at C:/opencv/build/OpenCVConfig.cmake:166 (message):
Found OpenCV Windows Pack but it has no binaries compatible with your
configuration.
You should manually point CMake variable OpenCV_DIR to your build of OpenCV
library.
Call Stack (most recent call first):
CMakeLists.txt:3 (find_package)
CMake Error at CMakeLists.txt:3 (find_package):
Found package configuration file:
C:/opencv/build/OpenCVConfig.cmake
but it set OpenCV_FOUND to FALSE so package "OpenCV" is considered to be
NOT FOUND.
Currently, OpenCV_DIR is C:\opencv\build, where it holds the CMake files. If I point OpenCV_DIR to C:\opencv\build\x64\vc12, it says, can't find CMake files.
How do I fix this?
What generator string did you use for the CMake configuration step? For VC12 x64, you need to use -G "Visual Studio 12 Win64" (if you were using CMake 3, you would use -G "Visual Studio 12 2013 Win64"). Note that you need to include Win64 at the end to get the x64 platform.
It is rather convenient that the OpenCV CMake config script is checking to make sure you are using the x64 binaries. You configured CMake to build 32-bit binaries, which would cause a runtime error if you were able to get an executable built.
Just in case anybody else has this problem, I got it from using old CMake config scripts. With VS2017 installed, I was getting this error- turns out that some auto-generated CMAKE configs have something like this:
elseif(MSVC_VERSION EQUAL 1910)
set(OpenCV_RUNTIME vc15)
I checked MSVC_VERSION and it was 1916, which is still VC15, but the files erroneously missed that. I changed to:
elseif((MSVC_VERSION EQUAL 1910) OR (MSVC_VERSION GREATER 1910))
set(OpenCV_RUNTIME vc15)
and it worked like a charm.

Lua's package management system?

What's the Lua's standard package management system and repository? Like brew for Mac OS X, npm for node.js.
There is no standard Lua package management system, but you can try out the following:
LuaRocks - contains a rather large number of Lua modules distributed as rocks. Once LuaRocks is installed, the installation is simple: luarocks install desired-package. On Linux/Unix/Mac, this will install into /usr/local/{share,lib}/lua/5.1, where the Lua interpreter looks for modules.
LuaDist - designed to create an independent standalone directory with Lua and modules (a dist). Everything in LuaDist is CMake-based, which means that it can be easily compiled using any compiler/IDE supported by CMake. LuaDist also has an extensive repository which contains Lua modules and also many C dependencies/libraries, which allows to create a truly independent Lua "distribution". Installation is the same as with LuaRocks - luadist install desired-package.

Resources