How to install lua socket?

39 views
Skip to first unread message

Olen Andoni

unread,
Jan 29, 2019, 8:19:56 AM1/29/19
to Orthanc Users
Hello,

I'm experiencing this issue while trying to install a custom lua library, so I can use it in the scripts ;

orthanc       | E0129 13:11:46.209987 OrthancException.h:85] Cannot execute a Lua command: error loading module 'socket.core' from file '/usr/lib/x86_64-linux-gnu/lua/5.1/socket/core.so':
orthanc       |         /usr/lib/x86_64-linux-gnu/lua/5.1/socket/core.so: undefined symbol: luaL_openlib

When I print the _VERSION in the script, it says Lua 5.3 but when I check the libraries inside the docker, it's only 5.1 - I don't know if this is intended?

I'm using this docker script :

# enable lua to find external modules (this list is obtained by running "return package.path" in a lua prompt)
ENV LUA_PATH="./?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/usr/local/lib/lua/5.1/?.lua;/usr/local/lib/lua/5.1/?/init.lua;/usr/share/lua/5.1/?.lua;/usr/share/lua/5.1/?/init.lua"
ENV LUA_CPATH="./?.so;/usr/local/lib/lua/5.1/?.so;/usr/lib/x86_64-linux-gnu/?.so;/usr/lib/x86_64-linux-gnu/lua/5.1/?.so;/usr/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so"
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y liblua5.1-socket

And my LUA script:

require "socket"

Olen Andoni

unread,
Jan 29, 2019, 9:10:45 AM1/29/19
to Orthanc Users
Ok so it looks like the base docker wheezy does only have LUA up to 5.2 so I can't pull any 5.3 LUA scripts.

So I guess my question remains as 'How do I install a custom lua package (like lua socket) with Orthanc docker?'

Sébastien Jodogne

unread,
Jan 29, 2019, 9:45:32 AM1/29/19
to Orthanc Users
You could for instance:
  • Replace the base Docker image from "debian:wheezy-slim" to "debian:stretch-slim": https://github.com/jodogne/OrthancDocker/tree/master/orthanc
  • Derive from "jodogne/orthanc", compile Lua 5.3.5 from source in it (or copy binaries), and adapt the environment variables from my previous answer
  • Compile Orthanc from source, with the "-DUSE_SYSTEM_LUA=ON" command-line option to CMake, so as to use the binaries that are provided by your GNU/Linux distribution

Olen Andoni

unread,
Jan 29, 2019, 9:53:09 AM1/29/19
to Orthanc Users
Are these consecutive steps or I can do any of them to make it work?

Sébastien Jodogne

unread,
Jan 29, 2019, 9:58:29 AM1/29/19
to Orthanc Users
This is a disjunction of possibilities, you can pick the one that best suits your needs.

Olen Andoni

unread,
Jan 30, 2019, 5:15:56 AM1/30/19
to Orthanc Users
Thanks for the directions.

I made it work with the debian:stretch-slim, I was able to install custom lua packages and use them.

But I ended up reverting everything, since the multipart packages that I was using didn't work properly for me, and just used os.execute(curl command) for doing the multipart/form-data.

Thanks again


On Tuesday, January 29, 2019 at 2:19:56 PM UTC+1, Olen Andoni wrote:
Reply all
Reply to author
Forward
0 new messages