Tangent128 / luasdl2

A pure C binding of SDL 2.0 for Lua 5.1, Lua 5.2, and LuaJIT.
ISC License
383 stars 73 forks source link

lua-sdl2 installation on win7 #41

Open gwgloria opened 8 years ago

gwgloria commented 8 years ago

I have successfully installed lua-sdl2 on linux (ubuntu) using luarocks,by typing "luarocks install lua-sdl2",though some other libraries are needed before this step. But it is still easy compared to the installation on win7. I have read the readme.txt and install.txt in the lua-sdl2 source code folder,but still don't know how to install it on win7. And I also got that lua-sdl2 has already been tested on win7. Is there anyone who has already made it? Or is there any helpful links that can be sent to me? Thank you very much!

Tangent128 commented 8 years ago

Building on Windows is currently unmaintained; there's no particular reason the code shouldn't work (the previous maintainer had Windows builds occasionally), but I do not have a Windows machine to test/build on.

A few options to try, in no special order:

In any case you will need a copy of the SDL2 library & headers.

markand commented 8 years ago

Hi,

You basically just need to install appropriate SDL2 libraries with MinGW or with Visual Studio in a directory and then have this directory in your CMAKE_PREFIX_PATH and PATH.

Then building with CMake will work.

I should write a small documentation about that.

lightman81 commented 8 years ago

Ugh. I'm trying to compile this on Win7, too. CMake is such an annoyance.

Using mingw, I got to: [ 80%] Linking C shared module SDL.dll

And then it crapped out, complaining about missing references. I gave it the proper paths, so I'm not sure what went wrong.

markand commented 8 years ago

Thanks for your complaint,

Without much info, there is nothing we can do.

lightman81 commented 8 years ago

Thanks for the response. Yes, I'm afraid it didn't provide much useful information, if any.

I wrote a Makefile for mingw environments. I'm testing on TDM but it should work on other mingw distributions, such as mingw-w64. I'd be happy to share the Makefile if that would be helpful to anyone.

Also, thanks for putting together these bindings! :) I was surprised to see that the popular Lua game engines all rely on OpenGL 2.x. I am probably in a small minority but some of us are stuck with old Intel GPUs that don't support the extensions.

markand commented 8 years ago

How did you install the SDL libraries on your Windows machine ?

I actually do not have a Windows machine so I can't test unfortunately.

lightman81 commented 8 years ago

The SDL libraries are available as binaries and just need to be in the path. So, that part is very easy.

The basic procedure I used is this:

  1. Install TDM/mingw (compiler etc. needs to be in the path)
  2. Build Lua
  3. Unpack/copy all SDL dev. libraries (32 or 64-bit)
  4. Build luasdl2

The structure that it expects: ./lua ./luasdl2 ./sdl2/lib ./sdl2/include/SDL2

I can probably add something to this to build Lua automatically, too... maybe even use wget to download things.

markand commented 7 years ago

Sorry for the very late response.

If there are lots of undefined reference, I think you link to the wrong architecture.

Maybe you've figured out already since August?

lightman81 commented 7 years ago

Hi. No problem. I figured it out, in the sense that my Makefile works.

lxsmnsyc commented 6 years ago

Hi, I am also trying to build lua-sdl2. luarocks gave me problems, so I tried the "Building with sources" steps and I've got a bit of progress. After cramming for 6 hours (I am a bit new with Makes-thingy) of trial and error, I also made it to the SDL.dll (80%), but now I'm stuck with the "Undefined references" thingy (all of which came from the /src folder from the repo. If someone knows the solution, please do share :)

markand commented 6 years ago

If you want a solution, you really need to give more information. Please paste the whole errors.

lxsmnsyc commented 6 years ago

shall I open a new issue or shall I put it here?

markand commented 6 years ago

No, put everything here.

Froyok commented 5 years ago

I'm trying as well to install lua-sdl2 on Windows (7), but in my case without building it from the source. At the moment I tried the following commands :

luarocks install lua-sdl2 SDL2_INCDIR="D:/Dropbox/Software/LUA/Lib" luarocks install lua-sdl2 SDL2_INCDIR="D:/Dropbox/Software/LUA/Lib/SDL2"

And both fail with the same following message :

luarocks install lua-sdl2-2.0.5.6.0-1.src.rock SDL2_INCDIR="D:/Dropbox/Software/LUA/Lib" Using lua-sdl2-2.0.5.6.0-1.src.rock... switching to 'build' mode

Error: Could not find expected file SDL2/SDL_ttf.h for SDL2_ttf -- you may have to install SDL2_ttf in your system and/or pass SDL2_ttf_DIR or SDL2_ttf_INCDIR to the luarocks command. Example: luarocks install lua-sdl2 SDL2_ttf_DIR=/usr/local

The file "D:/Dropbox/Software/LUA/Lib/SDL2/SDL_ttf.h" exists so at this point I don't know what do to without further information from the install process. :/

markand commented 5 years ago

And is the SDL2_ttf.lib available too? Also, the luarocks spec looks wrong because it search for SDL2/SDL_ttf.h which is wrong. The include convention in SDL is SDL.h without the directory prefix, but for some reasons this error happens often.

Froyok commented 5 years ago

Yes, the .lib is available too next to the .h. Regarding the path, that's why I posted two version of the install command to take that into account to see if it could have any impact. I can try editing the luarocks to investigate further, but I would need to know what to change exactly. Right now I'm stuck because I lack knowledge of the system I'm afraid.