Ruslan-B / FFmpeg.AutoGen

FFmpeg auto generated unsafe bindings for C#/.NET and Core (Linux, MacOS and Mono).
GNU Lesser General Public License v3.0
1.36k stars 321 forks source link

running under mono #27

Closed ispysoftware closed 8 years ago

ispysoftware commented 8 years ago

Hi, awesome project - thanks for writing it! It's working fine under the .net compiler/ debugger but when I use xamarin and try to run it using the mono executable on windows i'm getting errors:

Mono: DllImport attempting to load: 'avformat-57'. Mono: DllImport error loading library 'D:\Projects\test\bin\Debug\avformat-57': 'The system cannot find the file specified. '. Mono: DllImport error loading library 'D:\Projects\test\bin\Debug\avformat-57.dll': 'The system cannot find the file specified. '. Mono: DllImport loaded library 'avformat-57'. Mono: DllImport searching in: 'avformat-57' ('avformat-57'). Mono: Searching for 'av_register_all'. Mono: Probing 'av_register_all'. Mono: Found as 'av_register_all'. Unable to find seq points for method '(wrapper managed-to-native) FFmpeg.AutoGen.ffmpeg:av_register_all ()'.

Any ideas? I have the latest version of xamarin studio installed and it works fine under the .net debugger.

Ruslan-B commented 8 years ago

Quite obvious this project provides bindings to native libraries, thus you need native ffmpeg binaries for the target platform. #closed

Cheers, Ruslan

On 16 May 2016, at 14:41, sean tearney notifications@github.com wrote:

Hi, awesome project - thanks for writing it! It's working fine under the .net compiler/ debugger but when I use xamarin and try to run it using the mono executable on windows i'm getting errors:

Mono: DllImport attempting to load: 'avformat-57'. Mono: DllImport error loading library 'D:\Projects\test\bin\Debug\avformat-57': 'The system cannot find the file specified. '. Mono: DllImport error loading library 'D:\Projects\test\bin\Debug\avformat-57.dll': 'The system cannot find the file specified. '. Mono: DllImport loaded library 'avformat-57'. Mono: DllImport searching in: 'avformat-57' ('avformat-57'). Mono: Searching for 'av_register_all'. Mono: Probing 'av_register_all'. Mono: Found as 'av_register_all'. Unable to find seq points for method '(wrapper managed-to-native) FFmpeg.AutoGen.ffmpeg:av_register_all ()'.

Assertion at ..\mono\mini\debugger-agent.c:5345, condition `sp' not met Any ideas? I have the latest version of xamarin studio installed and it works fine under the .net debugger.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub

ispysoftware commented 8 years ago

Well the target platform is windows and i'm using windows native binaries... you can see it does find the dll and loads it and probes it and then fails with that sp error.

Ruslan-B commented 8 years ago

Then in assembly config FFmpeg.AutoGen.dll.config (supported by mono only) you need to specify path to binares (sections for linux and osx present already).

Ruslan-B commented 8 years ago

Or simply copy ddl next to executable then mono native module loader should discover them automatically.

ispysoftware commented 8 years ago

hmm.. thank you for your responses but I've tried both approaches and neither is working for me. I'm new to mono - could you give me an idea of what the updates to the ffmpeg.autogen.dll.config file should look like?

Thanks Ruslan.

Ruslan-B commented 8 years ago

Well you are first one who are trying run this using mono on windows :). It did work on OS X for example. There are few links but they are mostly related to posix environment: http://www.mono-project.com/docs/advanced/pinvoke/dllmap/ http://www.mono-project.com/docs/advanced/pinvoke/dllnotfoundexception/

On the other hand trace says that: 'D:\Projects\test\bin\Debug\avformat-57.dll' The system cannot find the file specified.

Which usually means file not found.

ispysoftware commented 8 years ago

Yeah the dll is definitely found - it's loading it but there's some internal dependency that isn't resolving. I have a hunch it's some c++ merge module issue but it's hard to figure out what from that stupid error message.

I can ignore mono on windows problems, I just wanted to get it working with mono on windows before I tackled mono on linux and osx.

Ruslan-B commented 8 years ago

http://www.dependencywalker.com ? c++ runtime?

ispysoftware commented 8 years ago

Yeah not sure - the executable is running fine on it's own, it runs fine under .net debugging just craps it's pants when run with mono - pretty weird. I don't know enough about mono to know where to start. Your example app does the same thing - if you run it under mono on windows you get the exact same error message. Probably a bug in mono.

Ruslan-B commented 8 years ago

May be stupid question but did you copied all ffmpeg dll's next to executable or only mentioned in exception?

ispysoftware commented 8 years ago

Yeah i've spent about 10 hours trying everything i can think of.

Ruslan-B commented 8 years ago

I can take a look in few week (on vacation now). I can assume you trying to run example project on mono. Could you please provide mono version (xamarin) and windows version.

ispysoftware commented 8 years ago

Sure - windows 10 64 bit, xamarin studio 5.10.1 build 6.

just to reiterate, it works fine in VS 2015 and in xamarin with .net, and just running the executable from the bin folder. If you right click the project in xamarin and click "run with..." and select "mono 4.2.3 (visual)" that's when you get the error.

Ruslan-B commented 8 years ago

Just in case :) - did you tried to keep all ddl's (64 bit) next to exe and delete FFmpeg.AutoGen.dll.config?

ispysoftware commented 8 years ago

Just tried that, same issue :(

ispysoftware commented 8 years ago

Right i don't know what I did but it just started working. Sorry for wasting your time.

Ruslan-B commented 8 years ago

Good!