Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict between Lua opcodes and the rest of Csound on Linux #1059

Closed
gogins opened this issue Nov 5, 2018 · 14 comments
Closed

Conflict between Lua opcodes and the rest of Csound on Linux #1059

gogins opened this issue Nov 5, 2018 · 14 comments
Labels

Comments

@gogins
Copy link
Contributor

gogins commented Nov 5, 2018

In the system packages for Csound on Linux, the Lua interfaces for Csound and CsoundAC appear to be linked with the standard Lua shared library, which is OK.

However, the Lua opcodes plugin for Csound in the system packages for bionic beaver is also linked with the standard Lua shared library, which is NOT OK. The opcodes will not function unless they are linked with the LuaJIT library.

On my system (Ubuntu 18.04 "bionic beaver") the Lua opcodes are linked with:

mkg@bodhimandala:~/csound-extended$ ldd /usr/lib/csound/plugins64-6.0/libLuaCsound.so 
	linux-vdso.so.1 (0x00007ffd1df82000)
	liblua5.1.so.0 => /usr/lib/x86_64-linux-gnu/liblua5.1.so.0 (0x00007f91127b1000)
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f9112428000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f9112210000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9111e1f000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9111a81000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f911187d000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f9112be5000)

On my system the installed Lua libraries are:

/usr/lib/x86_64-linux-gnu/liblua5.1.so.0.0.0
/usr/lib/x86_64-linux-gnu/liblua5.1-c++.a
/usr/lib/x86_64-linux-gnu/libluajit-5.1.a
/usr/lib/x86_64-linux-gnu/liblua5.2-c++.so.0.0.0
/usr/lib/x86_64-linux-gnu/liblua5.3.so.0.0.0
/usr/lib/x86_64-linux-gnu/liblua5.2.so.0.0.0
/usr/lib/x86_64-linux-gnu/liblua5.3-c++.so.0.0.0
/usr/lib/x86_64-linux-gnu/libluajit-5.1.so.2.1.0
/usr/lib/x86_64-linux-gnu/liblua5.1.a
/usr/lib/x86_64-linux-gnu/liblua5.1-c++.so.0.0.0

The Lua opcodes must be linked wth libluajit-5.1.so instead of liblua5 in any form.

Or, they could be statically linked, which would probably be best in this case.

There is a workaround for users, namely to replace /usr/lib/x86_64-linux-gnu/liblua5.1.so.0 with a symbolic link:

liblua5.1.so.0 -> libluajit-5.1.so
@gogins gogins added the bug label Nov 5, 2018
@vlazzarini
Copy link
Member

Why is this labelled as bug in Csound? It seems to be a packaging issue, which is a distro issue.
I can't see how this can be fixed in the Csound sources, but maybe I have not understood the problem.

@gogins
Copy link
Contributor Author

gogins commented Nov 5, 2018 via email

@vlazzarini
Copy link
Member

A bug where in Csound? CMake script?
If it's a bug in the distros you should open a ticket there.

@gogins
Copy link
Contributor Author

gogins commented Nov 5, 2018 via email

@fsateler
Copy link
Contributor

fsateler commented Nov 6, 2018

The Lua opcodes must be linked wth libluajit-5.1.so instead of liblua5 in any form

Why? This should probably be documented somewhere.

Looks like cmake/Modules/FindLUAJIT.cmake is wrong in trying to use find_library.

@gogins gogins closed this as completed May 1, 2019
@gogins gogins reopened this May 1, 2019
@gogins
Copy link
Contributor Author

gogins commented May 27, 2019

@fsateler I believe you are correct, find_library does not work.

Mike Pall is not focused on LuaJIT any more. Others are maintaining it. I wonder if they have messed up the packaging.

I was only able to get things to work for me by manually fiddling around in /usr after installing Lua and LuaJIT.

There are old pieces of mine that I may wish to update or adapt that use LuaJIT, and for that, I can do this manual fiddling. I generally write new pieces in C++, JavaScript, or Common Lisp. So I am not personally going to pursue this issue.

@kunstmusik
Copy link
Member

kunstmusik commented May 27, 2019 via email

@gogins
Copy link
Contributor Author

gogins commented May 27, 2019 via email

@rorywalsh
Copy link
Contributor

Hi Mike. While a functional package manager will be great, for now, there is nothing stopping us from simply including all of these opcodes in the current installers. For example, the Csound-Pd library has its own release page. The AppVeyor installer build script can grab the binaries for inclusion in the installer. As long as maintainers provide release candidates for their libraries, users should have access to them via the standard installers.

@gogins
Copy link
Contributor Author

gogins commented May 27, 2019 via email

@gogins
Copy link
Contributor Author

gogins commented May 28, 2019

I am going to remove the Lua opcodes from the Csound repository, and host them in the extended-csound repository.

@gogins
Copy link
Contributor Author

gogins commented May 30, 2019

Problems building the Emscripten directory for WebAssembly.

To fix the problems, it is necessary that the following code appear at the top of libcsound-worklet.js:

// Bug in Emscripten?
var tempDouble = 0.;
var tempI64 = 0;

gogins added a commit that referenced this issue May 30, 2019
gogins added a commit that referenced this issue May 31, 2019
gogins added a commit that referenced this issue May 31, 2019
@gogins
Copy link
Contributor Author

gogins commented May 31, 2019

I have merged the remove_luajit branch back into develop and am closing this issue.

Please note, the Emscripten problems are completely unrelated to removing LuaJIT, and turn up in this issue only because I tested the Emscripten build and it was not working. It works for me now with the current Emscripten SDK.

The fix was extremely simple, and implies that the current Emscripten SDK assumes that some variables such as tempDouble are defined in JavaScript ahead of loading the WebAssembly module.

One other fix was to remove the Pointer_stringify function, which has been removed from the Emscripten SDK, also from Csound code.

Other issues appear to have been red herrings.

@gogins gogins closed this as completed May 31, 2019
@kunstmusik
Copy link
Member

kunstmusik commented May 31, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants