labstreaminglayer / LSL4Unity

A integration approach of the LabStreamingLayer Framework for Unity3D
Other
85 stars 39 forks source link

dlopen failed #35

Open tchemaly opened 4 years ago

tchemaly commented 4 years ago

Although my app works on Unity, it is not working when I build it on the Magic Leap device. I have these errors in mldb:

Plugins: Couldn't open /package/bin/liblsl64.so, error: dlopen failed: "package/bin/liblsl64.so has unexpected e_machine: 62

DllNotFoundException: Unable to load DLL 'liblsl64': The specified module could not be found.

Note that: -my dlls are in Assets>LSL4Unity>Plugins -I have added the following condition to the LSL script in the dll class:

elif UNITY_ANDROID || PLATFORM_LUMIN

        const string libname = "liblsl64";
cwule commented 4 years ago

I got the same error. Tried changing to liblsl32 but then it complains Plugins: Couldn't open /package/bin/liblsl32.so, error: dlopen failed: "/package/bin/liblsl32.so" is 32-bit instead of 64-bit

tstenner commented 4 years ago

Are any dependencies missing, i.e. what's the output of ldd /package/bin/liblsl64.so?

cwule commented 4 years ago
$ ldd liblsl64.so 

ldd: warning: you do not have execution permission for ./liblsl64.so.  

linux-vdso.so.1 =>  (0x00007ffc22267000).  

librt.so.1 => /lib64/librt.so.1 (0x00007f344c1c3000).  

libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f344bebc000).  

libm.so.6 => /lib64/libm.so.6 (0x00007f344bbba000). 

libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f344b9a4000). 

libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f344b788000). 

libc.so.6 => /lib64/libc.so.6 (0x00007f344b3bb000). 

/lib64/ld-linux-x86-64.so.2 (0x00007f344c6f9000)
tstenner commented 4 years ago

I suspect an architecture mismatch. What's the output of file liblsl64.so?

cwule commented 4 years ago

$ file liblsl64.so liblsl64.so: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, BuildID[sha1]=793a68998fa33198e0385039a13935d7afa1fbad, stripped

tstenner commented 4 years ago

liblsl64.so: ELF 64-bit LSB shared object, x86-64

I dimly recall that the Magic Leap is an ARM device, so the x64 binaries won't work (more in-depth explanation).

The easiest way would be to recompile liblsl for the magic leap with the standalone_compilation.sh script.

tchemaly commented 4 years ago

@tstenner Can you please indicate where I can find the standalone_compilation.sh script and how I can use it? It would be great if there is a resource.

tstenner commented 4 years ago

The documentation is a work in progress, e.g. the bit I linked to was added about 2 minutes before my comment.

I don't have a Magic Leap, but if you can SSH into it, you just need to download the liblsl source code (repository, zip), install g++ and then run standalone_compilation_linux.sh.

If the binary is only meant for the magic leap, you could tailor it for this specific processor (CFLAGS="-march=native" ./standalone_compilation_linux.sh)

syeddanishdev commented 3 years ago

The documentation is a work in progress, e.g. the bit I linked to was added about 2 minutes before my comment.

I don't have a Magic Leap, but if you can SSH into it, you just need to download the liblsl source code (repository, zip), install g++ and then run standalone_compilation_linux.sh.

If the binary is only meant for the magic leap, you could tailor it for this specific processor (CFLAGS="-march=native" ./standalone_compilation_linux.sh)

@tstenner Can you kindly share the procedure for Unity 3d for Android Platform (Quest)

Because I am facing issue

DllNotFoundException: lsl LSL.liblsl+StreamInfo..ctor (System.String name, System.String type, System.Int32 channel_count, System.Double nominal_srate, LSL.liblsl+channel_format_t channel_format, System.String source_id) (at Assets/LSL.cs:156) EventLSLOutlet.Start () (at Assets/Scripts/EventLSLOutlet.cs:29)