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

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.

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

How to use Bazel to crate a wheel file for a package that build with cmake

I have a made a python package. The package is currently build using cmake. I want to prebuild this package on my laptop and create a .whl file, such that I can install it on other platform without worrying about building.
I know that bazel could do it. Can someone help me with an example or is there any other tools to prebuild a package that build with Cmake into wheel file?

Building UWP app in command line (using MSBUILD)

I am trying to build UWP app (targeting 16299) from command line from Jenkins setup.
The system has only VS build tools 2017.
used this command to build
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\msbuild.exe" /t:Rebuild /p:Configuration=Release;AppxBundle=Always;AppxBundlePlatforms="x86\x64\ARM" /p:BuildAppxUploadPackageForUap=true SOLUTION_FILE.sln
error MSB4226: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\Microsoft\WindowsXaml\v15.0\Microsoft.Windows.UI.Xaml.CSharp.targets" was not found. Also, tried to find "Microsoft\WindowsXaml\v15.0\Microsoft.Windows.UI.Xaml.CSharp.targets" in the fallback search path(s) for $(MSBuildExtensionsPath) - "C:\Program Files (x86)\MSBuild" . These search paths are defined in "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe.Config". Confirm that the path in the declaration is correct, and that the file exists on disk in one of the search paths.
Another issue found is nuget is not restoring any package, so updated nuget to 4.4.1 then I got the error
MSBuild auto-detection: using msbuild version '15.5.180.51428' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\bin'.
Nothing to do. None of the projects in this solution specify any packages for NuGet to restore.
same issue with nuget 4.6.0 also
I tried by adding following in project file
<PropertyGroup>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle> </PropertyGroup>
same issue with msbuild and nuget, anyone succeed in building UWP in Jenkins?
Update 05-01-2015
Followed instruction according to answer.
Copied NuGet folder
Copied the "WindowsXaml" folder.
Used MSbuild restore instead of Nuget restore to fix msbuild trying to find packages in "C:\WINDOWS\system32\config\systemprofile.nuget\packages\"
With all these changes no more issues in build,
But the appx bundle is not present. may be individual appx for x86/x64/ARM has to be created and then some kind of merging i s required.
so need further investigations
From the directory path that you have for MSBuild, I see that you may have installed MSBuildTools installer instead of the community, professional,... editions.
I tried that before and found that it's incomplete and doesn't have all dependencies for building Uwp tools, take a look at some of the comments here about the issues.
First Workaround: You can install Uwp Workload from VS Community or Professional as it has all dependencies, till Microsoft fix the issues in BuildTools installer.
Bonus: if you want to run the installer from command line, you can compose command line like that:
vs_installer.exe --installPath "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools" ^
--add Microsoft.VisualStudio.Workload.Universal ^
--add Microsoft.VisualStudio.Component.Windows10SDK.14393 ^
--add Microsoft.Component.MSBuild ^
--passive --wait --norestart
The longer workaround, I managed to install other dependencies but I believe it's kind of hassle if you are automating this installation, snippets from this article
Copy the Sdks folder from a machine that has VS2017 installed at:
c:\Program Files(x86)\Visual Studio\2017\Professional\Build MSBuild\Sdks
to your build machine at:
c:\Program Files(x86)\Visual Studio\2017\Build Tools\MSBuild\Sdks
And for the nuggets issue:
Copying the NuGet import files will do the tr Again, from a machine
with VS2017, copy the following folder: C:\Program Files
(x86)\Microsoft Visual
Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\NuGet
to your build machine at: C:\Program Files (x86)\Microsoft Visual
Studio\2017\BuildTools\Common7\IDE\CommonExtensions\Microsoft\NuGet
Note: If you come by this later and found that Microsoft fixed the issues related to Uwp in MSBuildTools installer, please leave a comment about it in this answer to update it.

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.

Installing moonscript via luarocks on Windows

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).

Resources