midimonster: Lua interpreter extensions may fail to load if not linked against liblua themselves

My config wont parse because it gets this:

Failed to load source file fsgc2ir.lua for instance gc: error loading module 'socket.core' from file '/usr/lib/arm-linux-gnueabihf/lua/5.3/socket/core.so':
	/usr/lib/arm-linux-gnueabihf/lua/5.3/socket/core.so: undefined symbol: lua_gettop

Running Raspberry Pi4 with Raspbian latest. Aim is to use TouchOSC to control multiple aspects of my studio I have lua 5.1, 5.2 and 5.3 installed as well as luasocket library. Is there any other libraries I need? I tried installing the socket library with luarocks but it comes up with this error:

pi@raspberrypi:~ $ sudo luarocks install luasocket
Installing https://luarocks.org/luasocket-3.0rc1-2.src.rock
gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/mime.c -o src/mime.o -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DLUASOCKET_API=__attribute__((visibility("default"))) -DUNIX_API=__attribute__((visibility("default"))) -DMIME_API=__attribute__((visibility("default")))
src/mime.c:7:10: fatal error: lua.h: No such file or directory
 #include "lua.h"
          ^~~~~~~
compilation terminated.

Error: Build error: Failed compiling object src/mime.o

so I installed all the libraries the standard way including socket:

sudo apt-get install luasocket
sudo apt-get install luasocket-dev

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 25 (7 by maintainers)

Most upvoted comments

For your specific use case, an example config using Python might be as follows (this just maps my mouse keys to two commands, but you get the picture)

globalcache.cfg

[python gc]
module = globalcache

[evdev in]
input = TPPS

[map]
in.EV_KEY.BTN_LEFT > gc.globalcache.input1
in.EV_KEY.BTN_RIGHT > gc.globalcache.input2

globalcache.py

import socket
import midimonster

DEVICE_IP="127.0.0.1"
DEVICE_PORT=4998

def socket_handler(sock):
	data = sock.recv(1024)
	print("Received %d bytes from socket: %s" % (len(data), data))
	if(len(data) == 0):
		# Unmanage the socket if it has been closed
		print("Remote has closed the connection")
		midimonster.manage(None, sock)
		sock.close()

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((DEVICE_IP, DEVICE_PORT))
midimonster.manage(socket_handler, s)

def input1(value):
	if value > 0.9:
		s.send(bytes("sendir,1:1,0,38000,1,1,341,170,21,21,21,21,21,21,21,64,21,21,21,21,21,21,21,21,21,64,21,64,21,64,21,21,21,64,21,64,21,64,21,64,21,64,21,21,21,21,21,64,21,21,21,21,21,21,21,21,21,21,21,64,21,64,21,21,21,64,21,64,21,64,21,64,21,1517,341,85,21,3655\r", "utf-8"))

def input2(value):
	if value > 0.9:
		s.send(bytes("sendir,1:1,0,38000,1,1,341,170,21,21,21,21,21,21,21,64,21,21,21,21,21,21,21,21,21,64,21,64,21,64,21,21,21,64,21,64,21,64,21,64,21,21,21,21,21,64,21,21,21,64,21,21,21,64,21,21,21,64,21,64,21,21,21,64,21,21,21,64,21,21,21,64,21,1517,341,85,21,3655\r", "utf-8"))