Kagami / mpv.js

:movie_camera: mpv pepper plugin
Creative Commons Zero v1.0 Universal
408 stars 63 forks source link

What to do after MPV-Build on Linux #68

Open anesuc opened 4 years ago

anesuc commented 4 years ago

Hi,

This is slightly linked to my previous issue #67 I added a while back but there hasn't been any response to it. So I've tried to see if I can attempt it either way but I am not sure where to go from here. This is related to this:

Compile static libmpv.so with e.g. mpv-build.

I've compiled with mpv build as instructed on that git. But I don't really know where to go from here. How do I link to this newly compiled one?

Hopefully someone has a solution to this as a project of mine is on standstill due to this sadly.

Thanks

anesuc commented 4 years ago

Update: I've added the .a files for libav I've compiled into the "libraries" binding.gyp and it compiled fully. However I'm now getting undefined symbols errors i.e:

undefined symbol: mpv_create

When I try to run the App

Kagami commented 4 years ago

Probably you forgot to enable libmpv.

anesuc commented 4 years ago

What do you mean? --enable-libmpv-shared? That just generates the .so one which I can't use because it's a non static one. Either way I did that and included the same .a files still same error. I'll retry in a sec it in case I missed something

Kagami commented 4 years ago

Try with --libmpv-static https://github.com/mpv-player/mpv/blob/82ded968aae9e4141d6b25791546b9f92e3c20d1/wscript#L53

anesuc commented 4 years ago

This is into the mpv_options file right? Because I did that and got this error: `make: Leaving directory '/node_modules/mpv.js/mpv-build/ffmpeg_build' Using mpv options: --libmpv-static waf [commands] [options]

Main commands (example: ./waf build -j4) .....(Shows a lot of options I can use here) ..... waf: error: no such option: --libmpv-static`

One of the options in there just had enable infront of it which was: --enable-libmpv-static Did that and it compiled successfully. However, still same problem :(

anesuc commented 4 years ago

Wait, I think I know

anesuc commented 4 years ago

I didn't have the newly created libmpv.a in binding.gyp but after adding it I get errors during buld now which are:

CXX(target) Release/obj.target/mpvjs/index.o SOLINK_MODULE(target) Release/obj.target/mpvjs.node /usr/bin/ld: /home/extern/Downloads/test/lol/lib-retry/node_modules/mpv.js/mpv-build/mpv/build/libmpv.a(mp_image.c.26.o): relocation R_X86_64_PC32 against symbolmp_image_setfmt' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Bad value collect2: error: ld returned 1 exit status mpvjs.target.mk:158: recipe for target 'Release/obj.target/mpvjs.node' failed make: *** [Release/obj.target/mpvjs.node] Error 1 make: Leaving directory '/home/extern/Downloads/test/lol/lib-retry/node_modules/mpv.js/build' gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/node-gyp/lib/build.js:194:23) gyp ERR! stack at ChildProcess.emit (events.js:315:20) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12) gyp ERR! System Linux 5.3.0-51-generic gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild" gyp ERR! cwd /home/extern/Downloads/test/lol/lib-retry/node_modules/mpv.js gyp ERR! node -v v13.14.0 gyp ERR! node-gyp -v v6.1.0 gyp ERR! not ok `

Edit: I'm looking into the fPIC flag

anesuc commented 4 years ago

Looked into the fPIC flag which is not a valid flag for mpv_options. The closest was --enable-pic which looked like it was already enabled for ffmpeg_options but I added it anyway. It's not valid for mpv_options though.

Any ideas?

anesuc commented 4 years ago

Update on this tried adding --enable-static-build as well ended up with this error during compile of mpv:

`scripting.c:302: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/bin/ld: cannot find -ldrm collect2: error: ld returned 1 exit status

Waf: Leaving directory /home/extern/Downloads/test/lol/lib-retry/node_modules/mpv.js/mpv-build/mpv/build' Build failed -> task in 'mpv' failed with exit status 1 (run with -v to display more information)

Kagami commented 4 years ago

You can ask in https://github.com/mpv-player/mpv how to compile static libmpv.

anesuc commented 4 years ago

Ok I've asked the question there! Hopefully we might get somewhere! Was documenting here so that it might help someone attempting this later

1056824847 commented 4 years ago

Can you tell me how to compile libmpv for linux x64 and arm64, I can’t run it after compiling