Coder Social home page Coder Social logo

Comments (10)

Frityet avatar Frityet commented on May 28, 2024 1

Could you test it? You should be able to do that by fetching that branch and then running luarocks make rockspecs/compat53-scm-0.rockspec. Thank you!!

Will do! Give me a moment

from lua-compat-5.3.

Frityet avatar Frityet commented on May 28, 2024 1

Fixed in #64

from lua-compat-5.3.

hishamhm avatar hishamhm commented on May 28, 2024

This is odd because it should be getting those defines from your lua.h settings. Does this rockspec work?

You can save this file as compat53-0.12-1.rockspec and run luarocks build compat53-0.12-1.rockspec.

package = "compat53"
version = "0.12-1"
source = {
   url = "https://github.com/lunarmodules/lua-compat-5.3/archive/v0.12.zip",
   dir = "lua-compat-5.3-0.12",
}
description = {
   summary = "Compatibility module providing Lua-5.3-style APIs for Lua 5.2 and 5.1",
   detailed = [[
      This is a small module that aims to make it easier to write Lua
      code in a Lua-5.3-style that runs on Lua 5.1+.
      It does *not* make Lua 5.2 (or even 5.1) entirely compatible
      with Lua 5.3, but it brings the API closer to that of Lua 5.3.
   ]],
   homepage = "https://github.com/lunarmodules/lua-compat-5.3",
   license = "MIT"
}
dependencies = {
   "lua >= 5.1, < 5.5",
   --"struct" -- make Roberto's struct module optional
}
build = {
   type = "builtin",
   modules = {
      ["compat53.init"] = "compat53/init.lua",
      ["compat53.module"] = "compat53/module.lua",
      ["compat53.utf8"] = "lutf8lib.c",
      ["compat53.table"] = "ltablib.c",
      ["compat53.string"] = "lstrlib.c",
      ["compat53.io"] = {
         sources = { "liolib.c" },
      }
   },
   platforms = {
      windows = {
         modules = {
            ["compat53.io"] = {
               defines = { "LUA_USE_WINDOWS" },
            }
         }
      }
   }
}

from lua-compat-5.3.

hishamhm avatar hishamhm commented on May 28, 2024

Unfortunately I don't have a Windows system to test this on, so any help debugging this is much appreciated!

from lua-compat-5.3.

Frityet avatar Frityet commented on May 28, 2024

This is odd because it should be getting those defines from your lua.h settings. Does this rockspec work?

You can save this file as compat53-0.12-1.rockspec and run luarocks build compat53-0.12-1.rockspec.

package = "compat53"

version = "0.12-1"

source = {

   url = "https://github.com/lunarmodules/lua-compat-5.3/archive/v0.12.zip",

   dir = "lua-compat-5.3-0.12",

}

description = {

   summary = "Compatibility module providing Lua-5.3-style APIs for Lua 5.2 and 5.1",

   detailed = [[

      This is a small module that aims to make it easier to write Lua

      code in a Lua-5.3-style that runs on Lua 5.1+.

      It does *not* make Lua 5.2 (or even 5.1) entirely compatible

      with Lua 5.3, but it brings the API closer to that of Lua 5.3.

   ]],

   homepage = "https://github.com/lunarmodules/lua-compat-5.3",

   license = "MIT"

}

dependencies = {

   "lua >= 5.1, < 5.5",

   --"struct" -- make Roberto's struct module optional

}

build = {

   type = "builtin",

   modules = {

      ["compat53.init"] = "compat53/init.lua",

      ["compat53.module"] = "compat53/module.lua",

      ["compat53.utf8"] = "lutf8lib.c",

      ["compat53.table"] = "ltablib.c",

      ["compat53.string"] = "lstrlib.c",

      ["compat53.io"] = {

         sources = { "liolib.c" },

      }

   },

   platforms = {

      windows = {

         modules = {

            ["compat53.io"] = {

               defines = { "LUA_USE_WINDOWS" },

            }

         }

      }

   }

}


I'll try this too, I am using the latest (like latest commit) of luarocks because it seems to be the only one that works well on windows

from lua-compat-5.3.

hishamhm avatar hishamhm commented on May 28, 2024

the latest (like latest commit) of luarocks because it seems to be the only one that works well on windows

That is encouraging to hear :) I am planning to cut a new LuaRocks release by the end of the week.

from lua-compat-5.3.

Frityet avatar Frityet commented on May 28, 2024

This is odd because it should be getting those defines from your lua.h settings. Does this rockspec work?

You can save this file as compat53-0.12-1.rockspec and run luarocks build compat53-0.12-1.rockspec.

package = "compat53"
version = "0.12-1"
source = {
   url = "https://github.com/lunarmodules/lua-compat-5.3/archive/v0.12.zip",
   dir = "lua-compat-5.3-0.12",
}
description = {
   summary = "Compatibility module providing Lua-5.3-style APIs for Lua 5.2 and 5.1",
   detailed = [[
      This is a small module that aims to make it easier to write Lua
      code in a Lua-5.3-style that runs on Lua 5.1+.
      It does *not* make Lua 5.2 (or even 5.1) entirely compatible
      with Lua 5.3, but it brings the API closer to that of Lua 5.3.
   ]],
   homepage = "https://github.com/lunarmodules/lua-compat-5.3",
   license = "MIT"
}
dependencies = {
   "lua >= 5.1, < 5.5",
   --"struct" -- make Roberto's struct module optional
}
build = {
   type = "builtin",
   modules = {
      ["compat53.init"] = "compat53/init.lua",
      ["compat53.module"] = "compat53/module.lua",
      ["compat53.utf8"] = "lutf8lib.c",
      ["compat53.table"] = "ltablib.c",
      ["compat53.string"] = "lstrlib.c",
      ["compat53.io"] = {
         sources = { "liolib.c" },
      }
   },
   platforms = {
      windows = {
         modules = {
            ["compat53.io"] = {
               defines = { "LUA_USE_WINDOWS" },
            }
         }
      }
   }
}

Just got a chance to test it (had to create a new windows VM) same error, but I realise its using my luaconf.h I copied to my include dir. Should I have a luaconf.h there? I just copied it directly from the lua source tree when I built lua

"C:\Program Files\LLVM\bin\gcc.exe" -O2 -c -o liolib.o -IC:\Program Files\Lua\5.4\include liolib.c -DLUA_USE_WINDOWS
In file included from liolib.c:10:
In file included from ./lprefix.h:46:
In file included from ./c-api/compat-5.3.h:10:
In file included from C:\Program Files\Lua\5.4\include/lua.h:16:
C:\Program Files\Lua\5.4\include/luaconf.h:51:9: warning: 'LUA_USE_WINDOWS' macro redefined [-Wmacro-redefined]
   51 | #define LUA_USE_WINDOWS  /* enable goodies for regular Windows */
      |         ^
<command line>:1:9: note: previous definition is here
    1 | #define LUA_USE_WINDOWS 1
      |         ^
liolib.c:408:13: error: call to undeclared function 'getc_unlocked'; ISO C99 and later do not support implicit function
      declarations [-Wimplicit-function-declaration]
  408 |     rn->c = l_getc(rn->f);  /* read next one */
      |             ^

from lua-compat-5.3.

hishamhm avatar hishamhm commented on May 28, 2024

Should I have a luaconf.h there?

Yes, Lua installations include luaconf.h (e.g. the Ubuntu package installs /usr/include/lua5.4/luaconf.h).

C:\Program Files\Lua\5.4\include/luaconf.h:51:9: warning: 'LUA_USE_WINDOWS' macro redefined

Ok, so that means that the Lua headers do attempt to set LUA_USE_WINDOWS on your system. This means that the rockspec I sent you is not the right way to go, as it was trying to force that explicitly in that rockspec.

The reason why I wanted to try that rockspec is because this error...

"C:\Program Files\LLVM\bin\gcc.exe" -O2 -c -o liolib.o -IC:\Program Files\Lua\5.4\include liolib.c
liolib.c:408:13: error: call to undeclared function 'getc_unlocked'; ISO C99 and later do not support implicit function
      declarations [-Wimplicit-function-declaration]
  408 |     rn->c = l_getc(rn->f);  /* read next one */
      |             ^
liolib.c:86:20: note: expanded from macro 'l_getc'
   86 | #define l_getc(f)               getc_unlocked(f)

...is happening due to that line 86:

#define l_getc(f) getc_unlocked(f)

...which is inside a LUA_USE_POSIX block!

Perhaps there's some difference in configuration between the system in your original message and the Windows VM where you tried this rockspec? Does the original rockspec fail the same way as the original message in the Windows VM?

I don't see a way how LUA_USE_WINDOWS and LUA_USE_POSIX can be active at the same time...

Thank you for the testing! Let's keep digging this!

from lua-compat-5.3.

hishamhm avatar hishamhm commented on May 28, 2024

Oh wait, looks like compat-5.3 really is doing something wrong here:

lua-compat-5.3/lprefix.h

Lines 197 to 204 in 737264a

/* choose which popen implementation to pick */
# if (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || \
(defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 600) || \
defined(__APPLE__)
# define LUA_USE_POSIX 1
# elif (defined(_MSC_VER))
# define LUA_USE_WINDOWS 0
# endif

I made this PR to try to fix the issue: #64

Could you test it? You should be able to do that by fetching that branch and then running luarocks make rockspecs/compat53-scm-0.rockspec. Thank you!!

from lua-compat-5.3.

hishamhm avatar hishamhm commented on May 28, 2024

Compat-5.3 0.13 is released!!

from lua-compat-5.3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.