spc476 / CBOR

The most comprehensive CBOR module in the Lua universe.
GNU Lesser General Public License v3.0
22 stars 3 forks source link

Windows support #1

Closed moteus closed 7 years ago

moteus commented 7 years ago

I can not install it on Windows/MSVC with LuaRocks. I really do not understand why need use build.type make in such rockspecs instead of builtin. In some cases LuaRocks not enouth but not in this. This works on my system.

build = {
  type = "builtin";
  modules = {
    ['org.conman.cbor_c'   ] = {
      sources = { 'cbor_c.c', 'dnf.c' };
      defines = {  'VERSION="1.2.0"'  };
    };
    ['org.conman.cbor'     ] = 'cbor.lua';
    ['org.conman.cbor_s'   ] = 'cbor_s.lua';
    ['org.conman.cbormisc' ] = 'cbormisc.lua';
  };
}

But it fail rains test

        Testing ARRAY ...GO!
        Testing _rains ...C:\LuaRocks\x64\5.2\bin\lua52.exe: cbor_test.lua:30: encoding for _rains failed:
DA 00 E9 9B A8 A1 00 81 82 04 A3 05 6F 77 77 77 2E 63 6F 6E 6D 61 6E 2E 6F 72 67 2E 0D 81 61 2E 0E 83 01 02 03
DA 00 E9 9B A8 A1 00 81 82 04 A3 0D 81 61 2E 05 6F 77 77 77 2E 63 6F 6E 6D 61 6E 2E 6F 72 67 2E 0E 83 01 02 03
stack traceback:
        [C]: in function 'assert'
        test.lua:30: in function 'assertf'
        test.lua:98: in function 'test'
        test.lua:655: in main chunk
        [C]: in ?
spc476 commented 7 years ago

Thanks for the heads up. I don't have Windows so it's kind of hard for me to test that particular platform. I'll fix the build type in the next few days (there's a hurricane headed my way so please excuse the delay).

If you aren't using RAINS (https://britram.github.io/rains-prototype/) then you can ignore this (the issue is the random nature of Lua hash tables---I'll have to fix the test). That the rest of the tests passed means it does work.

moteus commented 7 years ago

You can use e.g. AppVeyor. For module without external deps its really very easy. I just try hererocks and it works quite well. Checkout my appveyor.yml file for luacom

spc476 commented 7 years ago

Okay, now I remember why I used "make" instead of "builtin"---I need to use C99. If I use the builtin, it fails to compile under the Unix system I use (my C compiler does not default to C99, although it does support it).

spc476 commented 7 years ago

I think I solved the issue. I have just released 1.2.1.

moteus commented 7 years ago

Just note. MS add C99 since MSVC 2015. So your code does not compile with older versions. I test it with MSVC 2010. Also I do not use gcc/mingw so not sure which whey better for it.