open-ephys-plugins / rhythm-oni-plugin

Source plugin for Open Ephys Acquisition Board with custom FPGA (available Dec 2022)
1 stars 4 forks source link

Some dynamically-loaded files do not load from their installed location in Linux #12

Open aacuevas opened 9 months ago

aacuevas commented 9 months ago

specifically, libonidriver_ft600.so and libftd3xx.so need to be manually copied to a local library folder. liboni.so gets properly loaded from the shared-api8 folder

jsiegle commented 9 months ago

@anjaldoshi can you look into this?

anjaldoshi commented 9 months ago

Yep, I'll look into it. I think it just needs to explicitly link to liboni driver and ftd3 libraries on Linux, just like Mac.

anjaldoshi commented 9 months ago

I've been trying to reproduce this on my end, but not able to do so. I'm using Fedora 39, and I tried installing the plugin via Plugin Installer, and building it from source. In both cases, the GUI is able to load the plugin without any errors. I'm not sure if this issue occurs when connecting to a board as I don't have access to one so I was not able to test that.

@aacuevas Can you confirm if the plugin just fails to load (doesn't show up in the processor list) on your end or it just fails/crashes when trying to to connect to the board?

aacuevas commented 9 months ago

The plugin loads and then fails to open the acquisition board.

When the plugin tries to open the ONI context libONI looks for the appropriate onidriver, in this case libonidriver_ft600.so and use dload() to dynamically load it. (libftd3xx.so is required by libonidriver_ft600.so so failure to load the former will cause a failure to load the latter). If the onidriver cannot be loaded, the context cannot be opened so oni_create_ctx() returns NULL which, in the context of the plugin error reporting, causes an "acquisition board not found" error.

(As a note, actual "trying to open" code is performed by oni_init_ctx in line 41)

You could monitor de result of the oni_create_ctx() call to check for proper loading of all libraries. After that point, there should be no need for more dynamically loading anything.

anjaldoshi commented 9 months ago

Thanks for providing detailed explanation. It makes much more sense now. I was able to fix the context initialization error by explicitly linking the driver translation libraries. Now, the context gets initialized properly. I've pushed the fix to the dev branch. Can you test it on your end and make sure it is able to load the driver libraries and open the board properly. Here are the pre-compiled binaries for linux: rhythmi_oni_linux_driver_lib_fix.zip

aacuevas commented 9 months ago

I have installed the latest GUI and copied the files in the zip into ~/.config/open-ephys/plugins-api8 and shared-api8 and now it cannot even load the plugin. I only get this in the log:

[open-ephys][debug] Loading Plugin: rhythm-oni-plugin... 
[open-ephys] ***ERROR*** rhythm-oni-plugin.so)
[open-ephys] ***ERROR*** rhythm-oni-plugin.so Load FAILED