Installing luasql 2.2 with luarocks onto lua for windows install - lua

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)

Related

MSB 1009 : project File doesn't exist

Terminal is given as:
C:\Windows\System32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\Pipeline1>cmake . .
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.18363.
CMake Error at CMakeLists.txt:2 (project):
Failed to run MSBuild command:
C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe
to get the value of VCTargetsPath:
Microsoft (R) Build Engine version 16.8.2+25e4d540b for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1009: Project file does not exist.
Switch: VCTargetsPath.vcxproj
Exit code: 1
-- Configuring incomplete, errors occurred!
See also "C:/Windows/System32/config/systemprofile/AppData/Local/Jenkins/.jenkins/workspace/Pipeline1/CMakeFiles/CMakeOutput.log".
I have declared MSBuild path in system variables and I have VisualStudio 16 2019 version.

How to launch FsUnit tests on Linux/Mac

I have installed FsUnit
» nuget install fsunit
Attempting to resolve dependency 'NUnit (≥ 2.6.3)'.
Installing 'NUnit 2.6.3'.
Successfully installed 'NUnit 2.6.3'.
Installing 'FsUnit 1.3.0.1'.
Successfully installed 'FsUnit 1.3.0.1'.
I have created simple unit test:
module Tests
open NUnit.Framework
open FsUnit
[<Test>]
let ``simple test`` () =
1 |> should equal 1
Here is I am launching my test:
» fsharpc -r NUnit.2.6.3/lib/nunit.framework.dll -r FsUnit.1.3.0.1/Lib/Net40/FsUnit.NUnit.dll 01_binomial_tests.fs
F# Compiler for F# 3.1 (Open Source Edition)
Freely distributed under the Apache 2.0 Open Source License
/Users/demas/development/book_exericses/fsharp_deep_dive/01_binomial_tests.fs(7,1): warning FS0988: Main module of program is empty: nothing will happen when it is run
It was compiled fine but I don't know how to launch the tests without VS
Update
I have tried to use NUnit.Runners:
> nuget install NUnit.Runners
> fsharpc -r NUnit.2.6.3/lib/nunit.framework.dll -r FsUnit.1.3.0.1/Lib/Net40/FsUnit.NUnit.dll --target:library 01_binomial_tests.fs
> mono NUnit.Runners.2.6.4/tools/nunit-console.exe 01_binomial_tests.dll
NUnit-Console version 2.6.4.14350
Copyright (C) 2002-2012 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.
Runtime Environment -
OS Version: Unix 14.4.0.0
CLR Version: 2.0.50727.1433 ( Mono 3.5 ( 3.10.0 ((detached/92c4884 Thu Nov 13 23:27:38 EST 2014) ) )
ProcessModel: Default DomainUsage: Single
Execution Runtime: mono-3.5
Could not load file or assembly '01_binomial_tests, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
You have a couple of options:
Add dependency on NUnit.Runners NuGet package, which comes with a stand-alone runner
Use Xamarin Studio, which seems to have Unit Tests panel for running tests
Use FAKE which is a nice F# build tool that can run unit tests
I personally use FAKE because it nicely automates everything. To do that, you need to put something like this in your FAKE build.fsx script:
Target "Test" (fun _ ->
!! "/tests*.dll |> NUnit (fun p ->
{p with
DisableShadowCopy = true;
OutputFile = testDir + "TestResults.xml" })
)
You'll need dependencies on FAKE and NUnit.Runners and then FAKE should also find the runner automatically (so you do not have to set it explicitly in your build script).

Dart native extension demo “sample_extension” on VS2010 setup

I've been able to create/compile the simple_extension.dll (32bit) only on PC's with VS2010 C++ Express Edition. I'm following WHesse's article on native extensions section Building on Windows. My PC on the other hand has Windows 2008 Server R2 64bit, VS2010 Ultimate, and Dart 64bit (SDK version 1.5.0-dev.4.17).
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
in http://dart.googlecode.com/svn/trunk/dart/samples/sample_extension/sample_extension.cc are not found.
Just guessing but I don't think the article's build steps are intended for full version VS2010 C++ projects or maybe 64bit?
Does anyone have a VS2010 C++ (full version) solution file working for sample_extension project?
Update: Output from running example_build.dart
Observatory listening on http://127.0.0.1:1283
Building project "C:\Users\OSSDevYorgi\DartPlayground\ccompile-master\example\../example/sample_extension.yaml"
sample_extension_dllmain_win.cc
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\windows.h(151) : fatal error C1083: Cannot open include file: 'excpt.h': No such file or directory
sample_extension.cc
sample_extension.cc(1) : fatal error C1083: Cannot open include file: 'string.h': No such file or directory
Generating Code...
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
sample_extension_dllmain_win.cc
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\windows.h(151) : fatal error C1083: Cannot open include file: 'excpt.h': No such file or directory
sample_extension.cc
sample_extension.cc(1) : fatal error C1083: Cannot open include file: 'string.h': No such file or directory
Generating Code...
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
Building complete with some errors

How to Install LuaFileSystem?

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.

"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

Resources