kidrigger / godot-videodecoder

GDNative Video Decoder libraries for Godot Game Engine, using FFmpeg library for codecs. A Google Summer of Code Project, 2018
MIT License
84 stars 22 forks source link

Added x11 32bit and Windows 32bit for compiling #34

Closed JezSonic closed 3 years ago

JezSonic commented 3 years ago

So i needed to build this plugin for my 32bit Linux and also I made Windows 32bit build. As i saw in the terminal output there are no errors. Also 32bit linux build works perfectly on my 32bit laptop.

JezSonic commented 3 years ago

I did PR cause my work may help other people so I just decided to make pull request on this repository. Hope You'll enjoy my work

JezSonic commented 3 years ago

And i see now i forgot to include SConstruct file prepared for those two platforms. I'll include it here as soon as possible or in a new pr. Really dunno why did I make such a mistake. sorry about that

jamie-pate commented 3 years ago

Hey, did you have any changes to ffmpeg-static to back this? I'm getting some issues compiling for the x11_32 and win32 platforms:

*** Building FFmpeg ***
Makefile:2: ffbuild/config.mak: No such file or directory
Makefile:40: /tools/Makefile: No such file or directory
Makefile:41: /ffbuild/common.mak: No such file or directory
Makefile:90: /libavutil/Makefile: No such file or directory
Makefile:90: /ffbuild/library.mak: No such file or directory
Makefile:92: /fftools/Makefile: No such file or directory
Makefile:93: /doc/Makefile: No such file or directory
Makefile:94: /doc/examples/Makefile: No such file or directory
Makefile:159: /tests/Makefile: No such file or directory
make: *** No rule to make target '/tests/Makefile'.  Stop.
+ EXTRA_LIBS= -lpthread -lm 
+ PKG_CONFIG_PATH=/opt/godot-videodecoder/ffmpeg-static/target/lib/pkgconfig ./configure --prefix=/opt/godot-videodecoder/thirdparty/win32 --pkg-config-flags=--static --extra-cflags=-I/opt/godot-videodecoder/ffmpeg-static/target/include --extra-ldflags=-L/opt/godot-videodecoder/ffmpeg-static/target/lib --extra-libs= -lpthread -lm  --bindir=/opt/godot-videodecoder/ffmpeg-static/bin --disable-everything --disable-debug --disable-gpl --disable-nonfree --disable-programs --enable-shared --disable-static --enable-decoder=libopus --enable-decoder=opus --enable-decoder=vp9 --enable-decoder=libvorbis --enable-decoder=vorbis --enable-parser=vp9 --enable-parser=opus --enable-parser=vorbis --enable-demuxer=matroska --enable-demuxer=opus --enable-demuxer=vorbis --enable-libopus --enable-libvorbis --enable-opengl --disable-vaapi --disable-vdpau
ERROR: opengl not found.
Install file: "thirdparty/x11_32/lib/libavdevice.so.58" as "/opt/target/x11_32/libavdevice.so.58"
gcc -o src/gdnative_videodecoder.os -c -std=gnu11 -fPIC -g -Ithirdparty/x11_32/include -Igodot_include src/gdnative_videodecoder.c
src/gdnative_videodecoder.c: In function 'godot_videodecoder_get_supported_ext':
src/gdnative_videodecoder.c:511:9: warning: return from incompatible pointer type [-Wincompatible-pointer-types]
  return supported_ext;
         ^
scons: building terminated because of errors.
scons: *** [bin/x11_32/libgdnative_videodecoder.so] Implicit dependency `/usr/lib/i386-linux-gnu/libc_nonshared.a' not found, needed by target `bin/x11_32/libgdnative_videodecoder.so'.
The command '/bin/sh -c scons platform=x11_32 prefix="${FINAL_TARGET_DIR}"' returned a non-zero code: 2
jamie-pate commented 3 years ago

Can you try this build and see if it works for win 32 and x11_32?

JezSonic commented 3 years ago

Sure, of course. Just give me a minute. (I'm a student. I have lessons now)

JezSonic commented 3 years ago

x11_32 build from build from GitHub Actions is not working. Error says

ERROR: open_dynamic_library: Can't open dynamic library: /home/godot/Pulpit/Foxy-Adventure/addons/bin/x11_32/libgdnative_videodecoder.so.
Error: /home/godot/Pulpit/Foxy-Adventure/addons/bin/x11_32/libgdnative_videodecoder.so: wrong ELF class: ELFCLASS64

Maybe you should configure actions to do the compilation on 32bit OS?

I also wanna tell you that I didn't have that issue with my build on 32bit pc

I saw also that files for x11_32 from GitHub Actions build have different size than files from my build. The difference in size between them is about 50-200 kB

jamie-pate commented 3 years ago

It was a long shot that it would work the first time.. just gave to get the cross compiler set up properly... Getting closer though

jamie-pate commented 3 years ago

yup target/x11_32/libgdnative_videodecoder.so: ELF 64-bit LSB shared object

:(

JezSonic commented 3 years ago

I will send you my compilation for x11_32 when I'll be at home. Also. I tried to compile that plugin for android and i used precompiled ffmpeg downloaded from web. While compilation ndk prints lots of undefined references in src/gdnative_videodecoder.c and terminates the build while everything is ok in jni/Application.mk and jni/Android.mk. Any thoughts how to fix it?

jamie-pate commented 3 years ago

1) the idea is to have automated builds, no point uploading builds as they will just be out of date soon

2) no idea, undefined references are probably the functions that it expects to link against from the ffmpeg library? iOS and Android platforms are very different from the desktop platforms

JezSonic commented 3 years ago

Yeah, but libraries and those files are linked properly in jni/Android.mk file

jamie-pate commented 3 years ago

Probably have to put in the code for the get_ticks_msec() etc from the Android platform?

It would help more to have the complete output

JezSonic commented 3 years ago

I did something and now I have 30 kilobytes output files from Android ndk. I'm not sure that I linked libs properly in Android.mk file

jamie-pate commented 3 years ago

https://github.com/jamie-pate/godot-videodecoder/releases/tag/0.0.1-draft.14 this one has all the right file types, but need help testing for x11_32 and win32 :D

JezSonic commented 3 years ago

I'll test it as soon as possible. Also i was talking with my friend about my issue with compiling videodecoder for android and he said it may be "cause of difference in preprocessor in Android's NDK". I asked him to help me and he agreed so today we're gonna work with it. Also can you add me on discord so i would ask you on discord if i have questions about godot videodecoder for android (add me anyway, haha - just kidding) (my discord: sonic#7813)? I just think that this is not the best place to talk about videodecoder for android etc. on discord I can answer something very quickly, and on github I have to check everything that is tiring for me and therefore I answer you for a long time etc.

JezSonic commented 3 years ago

so x11_32 from latest auto-builded release works, win32 too. I also saw in debug logs, that win32 requires this file to run libgcc_s_sjlj-1.dll