2

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.

two13
  • 345
  • 1
  • 3
  • 11

1 Answers1

0

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:

  1. http://forums.mysql.com/read.php?45,37472,37472
  2. C++ Redefinition Header Files (winsock2.h)
Community
  • 1
  • 1
gastrop0d
  • 61
  • 4