I am trying to download some native linux libraries using mono. I performed mono with the debug flag:
Mono: DllImport attempting to load: 'libavformat.57'. Mono: DllImport error loading library '/home/filoe/Desktop/cscore/cscore/Samples/LinuxSample/bin/Debug/libavformat.57': '/home/filoe/Desktop/cscore/cscore/Samples/LinuxSample/bin/Debug/libavformat.57: cannot open shared object file: No such file or directory'. Mono: DllImport error loading library '/home/filoe/Desktop/cscore/cscore/Samples/LinuxSample/bin/Debug/libavformat.57.so': 'libavcodec.so.57: cannot open shared object file: No such file or directory'. Mono: DllImport error loading library '/usr/lib/libavformat.57': '/usr/lib/libavformat.57: cannot open shared object file: No such file or directory'. Mono: DllImport error loading library '/usr/lib/libavformat.57.so': '/usr/lib/libavformat.57.so: cannot open shared object file: No such file or directory'. Mono: DllImport error loading library 'libavformat.57': 'libavformat.57: cannot open shared object file: No such file or directory'. Mono: DllImport error loading library 'libavformat.57.so': 'libavformat.57.so: cannot open shared object file: No such file or directory'. Mono: DllImport error loading library 'libavformat.57': 'libavformat.57: cannot open shared object file: No such file or directory'. Mono: DllImport unable to load library 'libavformat.57: cannot open shared object file: No such file or directory'. Mono: DllImport attempting to load: 'libavformat.57'.
There are many search items, but at least one of them MUST match. This is what my directory looks like:
filoe@ubuntu :~/Desktop/cscore/cscore/Samples/LinuxSample/bin/Debug$ dir CSCore.Ffmpeg.dll CSCore.Ffmpeg.dll.mdb CSCore.Linux.dll.config FFmpeg libavformat.57 libswresample.2 LinuxSample.exe.mdb CSCore.Ffmpeg.dll.config CSCore.Linux.dll CSCore.Linux.dll.mdb libavcodec.57 libavutil.55 LinuxSample.exe log.txt filoe@ubuntu :~/Desktop/cscore/cscore/Samples/LinuxSample/bin/Debug$
As you can see, libavformat.57
exists. Mono tell me that it can not be found?
The following code demonstrates what has been done:
Declaring some DllImport
methods:
[DllImport("avformat-57", EntryPoint = "av_register_all", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] internal static extern void av_register_all(); [DllImport("avcodec-57", EntryPoint = "avcodec_register_all", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] internal static extern void avcodec_register_all();
The project also contains a file called "{output assembly name..config":
<configuration> <dllmap os="linux" dll="avcodec-57" target="libavcodec.57"/> <dllmap os="linux" dll="avformat-57" target="libavformat.57"/> </configuration>
As you can see above, the display is working fine. Mono accepts "avformat-57" and translates it to "libavformat.57". Mono is now looking for a library named "libavformat.57" or some related names, such as "libavformat.57.so". Mono searches the executable assembly directory.
But he fails to find the file he is looking for (according to the magazine published above). So why?
Thanks!
Hi