<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    The Lua runtime that ships with OpenWrt is broken.  It is broken by
    one (or more) of the patches.<br>
    <br>
    I have create a ticket a while back about this issue, which you can
    find here: <a class="moz-txt-link-freetext"
      href="https://dev.openwrt.org/ticket/20821">https://dev.openwrt.org/ticket/20821</a><br>
    <br>
    I was able to work around this issue removing/fixing patches and
    compiling my own version of the Lua package.<br>
    <br>
    However, just today, I hit this issue AGAIN using a busybox docker
    container (which uses OpenWrt x86 packages).<br>
    <br>
    Ubuntu docker container.  Everything works fine.<br>
    <br>
    <small> $ docker run -it --rm ubuntu:14.04
<br>
      root@a278557d3a59:/# apt-get update<br>
      <br>
      ........................................<br>
      <br>
      root@a278557d3a59:/# apt-get install lua5.1 luarocks<br>
      <br>
      ........................................<br>
      <br>
      root@a278557d3a59:/# luarocks install bit32
<br>
      Installing
      <a class="moz-txt-link-freetext" href="http://luarocks.org/repositories/rocks/bit32-5.3.0-1.src.rock">http://luarocks.org/repositories/rocks/bit32-5.3.0-1.src.rock</a>...
<br>
      Using
      <a class="moz-txt-link-freetext" href="http://luarocks.org/repositories/rocks/bit32-5.3.0-1.src.rock">http://luarocks.org/repositories/rocks/bit32-5.3.0-1.src.rock</a>...
      switching to 'build' mode
<br>
      Archive: 
      /tmp/luarocks_luarocks-rock-bit32-5.3.0-1-5729/bit32-5.3.0-1.src.rock
<br>
        inflating: bit32-5.3.0-1.rockspec  
<br>
         creating: lua-compat-5.2/
<br>
         creating: lua-compat-5.2/c-api/
<br>
        inflating: lua-compat-5.2/c-api/compat-5.2.h  
<br>
        inflating: lua-compat-5.2/c-api/compat-5.2.c  
<br>
        inflating: lua-compat-5.2/LICENSE  
<br>
        inflating: lua-compat-5.2/lbitlib.c  
<br>
         creating: lua-compat-5.2/tests/
<br>
        inflating: lua-compat-5.2/tests/test.lua  
<br>
        inflating: lua-compat-5.2/tests/testmod.c  
<br>
        inflating: lua-compat-5.2/README.md  
<br>
         creating: lua-compat-5.2/compat52/
<br>
        inflating: lua-compat-5.2/compat52/mstrict.lua  
<br>
        inflating: lua-compat-5.2/compat52/strict.lua  
<br>
        inflating: lua-compat-5.2/compat52-scm-1.rockspec  
<br>
        inflating: lua-compat-5.2/compat52.lua  
<br>
        inflating: lua-compat-5.2/bit32-scm-1.rockspec  
<br>
         creating: lua-compat-5.2/rockspecs/
<br>
        inflating: lua-compat-5.2/rockspecs/bit32-5.3.0-1.rockspec  
<br>
        inflating: lua-compat-5.2/rockspecs/compat52-0.1-1.rockspec  
<br>
        inflating: lua-compat-5.2/rockspecs/bit32-5.2.2-1.rockspec  
<br>
        inflating: lua-compat-5.2/rockspecs/bit32-5.2.3-1.rockspec  
<br>
      gcc -O2 -fPIC -I/usr/include/lua5.1 -c lbitlib.c -o lbitlib.o
      -Ic-api
<br>
      gcc -shared -o bit32.so -L/usr/local/lib lbitlib.o
<br>
      Updating manifest for /usr/local/lib/luarocks/rocks
<br>
       <br>
      bit32 5.3.0-1 is now built and installed in /usr/local/ (license:
      MIT/X11)<br>
    </small><br>
    <br>
    <br>
    BusyBox docker container with opkg.<br>
    <br>
    <small>$ docker run -it --rm progrium/busybox
      <br>
      / # opkg-install lua luarocks
      <br>
      Downloading <a class="moz-txt-link-freetext"
href="http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/base/Packages.gz">http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/base/Packages.gz</a>.
      <br>
      Inflating <a class="moz-txt-link-freetext"
href="http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/base/Packages.gz">http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/base/Packages.gz</a>.
      <br>
      Updated list of available packages in /var/opkg-lists/base.
      <br>
      Downloading <a class="moz-txt-link-freetext"
href="http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/packages/Packages.gz">http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/packages/Packages.gz</a>.
      <br>
      Inflating <a class="moz-txt-link-freetext"
href="http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/packages/Packages.gz">http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/packages/Packages.gz</a>.
      <br>
      Updated list of available packages in /var/opkg-lists/packages.
      <br>
      Installing lua (5.1.5-1) to root...
      <br>
      Downloading <a class="moz-txt-link-freetext"
href="http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/base/lua_5.1.5-1_x86_64.ipk">http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/base/lua_5.1.5-1_x86_64.ipk</a>.
      <br>
      Installing liblua (5.1.5-1) to root...
      <br>
      Downloading <a class="moz-txt-link-freetext"
href="http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/base/liblua_5.1.5-1_x86_64.ipk">http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/base/liblua_5.1.5-1_x86_64.ipk</a>.
      <br>
      Installing luarocks (2.2.2-1) to root...
      <br>
      Downloading <a class="moz-txt-link-freetext"
href="http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/packages/luarocks_2.2.2-1_x86_64.ipk">http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/packages/luarocks_2.2.2-1_x86_64.ipk</a>.
      <br>
      Installing luac (5.1.5-1) to root...
      <br>
      Downloading <a class="moz-txt-link-freetext"
href="http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/base/luac_5.1.5-1_x86_64.ipk">http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/base/luac_5.1.5-1_x86_64.ipk</a>.
      <br>
      Installing luasocket (3.0-rc1-20130909-3) to root...
      <br>
      Downloading <a class="moz-txt-link-freetext"
href="http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/packages/luasocket_3.0-rc1-20130909-3_x86_64.ipk">http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/packages/luasocket_3.0-rc1-20130909-3_x86_64.ipk</a>.
      <br>
      Installing unzip (6.0-4) to root...
      <br>
      Downloading <a class="moz-txt-link-freetext"
href="http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/packages/unzip_6.0-4_x86_64.ipk">http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/packages/unzip_6.0-4_x86_64.ipk</a>.
      <br>
      Installing curl (7.49.0-1) to root...
      <br>
      Downloading <a class="moz-txt-link-freetext"
href="http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/base/curl_7.49.0-1_x86_64.ipk">http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/base/curl_7.49.0-1_x86_64.ipk</a>.
      <br>
      Installing libcurl (7.49.0-1) to root...
      <br>
      Downloading <a class="moz-txt-link-freetext"
href="http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/base/libcurl_7.49.0-1_x86_64.ipk">http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/base/libcurl_7.49.0-1_x86_64.ipk</a>.
      <br>
      Installing libpolarssl (1.3.17-1) to root...
      <br>
      Downloading <a class="moz-txt-link-freetext"
href="http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/base/libpolarssl_1.3.17-1_x86_64.ipk">http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/base/libpolarssl_1.3.17-1_x86_64.ipk</a>.
      <br>
      Installing luasec (0.5.1-1) to root...
      <br>
      Downloading <a class="moz-txt-link-freetext"
href="http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/packages/luasec_0.5.1-1_x86_64.ipk">http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/packages/luasec_0.5.1-1_x86_64.ipk</a>.
      <br>
      Installing libopenssl (1.0.2h-1) to root...
      <br>
      Downloading <a class="moz-txt-link-freetext"
href="http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/base/libopenssl_1.0.2h-1_x86_64.ipk">http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/base/libopenssl_1.0.2h-1_x86_64.ipk</a>.
      <br>
      Installing zlib (1.2.8-1) to root...
      <br>
      Downloading <a class="moz-txt-link-freetext"
href="http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/base/zlib_1.2.8-1_x86_64.ipk">http://downloads.openwrt.org/snapshots/trunk/x86/64/packages/base/zlib_1.2.8-1_x86_64.ipk</a>.
      <br>
      Configuring libpolarssl.
      <br>
      Configuring libcurl.
      <br>
      Configuring liblua.
      <br>
      Configuring lua.
      <br>
      Configuring luac.
      <br>
      Configuring luasocket.
      <br>
      Configuring unzip.
      <br>
      Configuring curl.
      <br>
      Configuring zlib.
      <br>
      Configuring libopenssl.
      <br>
      Configuring luasec.
      <br>
      Configuring luarocks.
      <br>
      / # luarocks install bit32
      <br>
       <br>
      Error: LuaRocks 2.2.2 bug (please report at <a
        class="moz-txt-link-freetext"
        href="https://github.com/keplerproject/luarocks/issues"><a class="moz-txt-link-freetext" href="https://github.com/keplerproject/luarocks/issues">https://github.com/keplerproject/luarocks/issues</a></a>).
      <br>
      /usr/share/lua/5.1/luarocks/deps.lua:159: attempt to compare two
      table values
      <br>
      stack traceback:
      <br>
              /usr/share/lua/5.1/luarocks/deps.lua:159: in function
      'compare_versions'
      <br>
              /usr/share/lua/5.1/luarocks/type_check.lua:175: in
      function 'check_version'
      <br>
              /usr/share/lua/5.1/luarocks/type_check.lua:269: in
      function </usr/share/lua/5.1/luarocks/type_check.lua:264>
      <br>
              (tail call): ?
      <br>
              /usr/share/lua/5.1/luarocks/manif_core.lua:28: in function
      </usr/share/lua/5.1/luarocks/manif_core.lua:21>
      <br>
              (tail call): ?
      <br>
              /usr/share/lua/5.1/luarocks/search.lua:176: in function
      'manifest_search'
      <br>
              /usr/share/lua/5.1/luarocks/search.lua:209: in function
      'search_repos'
      <br>
              /usr/share/lua/5.1/luarocks/search.lua:285: in function
      'find_suitable_rock'
      <br>
              /usr/share/lua/5.1/luarocks/install.lua:189: in function
      </usr/share/lua/5.1/luarocks/install.lua:161>
      <br>
              (tail call): ?
      <br>
              [C]: in function 'xpcall'
      <br>
              /usr/share/lua/5.1/luarocks/command_line.lua:208: in
      function 'run_command'
      <br>
              /usr/bin/luarocks:33: in main chunk
      <br>
              [C]: ?<br>
    </small><br>
    <br>
    It would be nice if somebody finally fixes this issue or removes the
    breaking patches.<br>
    <br>
  </body>
</html>