OpenHEVC / openHEVC

HEVC decoder
http://openhevc.github.io/openHEVC/
531 stars 192 forks source link

more changes for windows builds #64

Closed aureliendavid closed 6 years ago

aureliendavid commented 6 years ago

Some notes about my attempts to build openhevc on windows

I'm only using cygwin to run configure & make but the actual compilation is done with the msvc compiler (cl). The only obstacle is that cygwin doesn't handle windows-style line endings in scripts. So I added a .gitattributes file that forces git to checkout build scripts with unix line endings.

some needed cygwin packages: yasm, pkg-config, make

To have both visual studio tools and cygwin tools available one way is to run the "visual studio developer command prompt" and then run cygwin inside of that.

to build on visual studio we need to have the c99wrap binaries available in the PATH and the path to inttypes.h in an INCLUDE environment variable.

I added a Makefile target for static linking on windows because the lib tool syntax is different from unix ar.

To build a static library I'm using

./configure --toolchain=msvc --ld=link.exe --disable-ohplay --disable-programs  --disable-ohshared --enable-ohstatic --disable-shared --enable-static --target-os=win64 --extra-cflags="-MD"
make openhevc-static-win 

There was a dumb issue about windows 32 bits adding an underscore on exported symbols and so makedef didn't find the oh_ symbols to create the .lib. It's solved by making makedef aware of the EXTERN_PREFIX variable.

However I still have some issues with x86 builds. It builds properly (both statically and dynamically) but at runtime I get crashes in gpac around there: https://github.com/OpenHEVC/openHEVC/blob/ffmpeg_update/libavcodec/x86/hevc_idct_sse.c#L641

I tried adding /arch:SSE2 to the build but it was no help.

If someone has a working w32 build I'd be interested in the configure options used (and the binaries to test).

pcabarat commented 6 years ago

Hi, Maybe --enable-memalign-hack can solve the issue. If you'd like to be able to debug intrinsics source code you can disable stripping into ffbuild/common.mak commenting out stripping related operations.

%_sse2.o: %_sse2.c $(COMPILE_C) -msse4 -$(if $(ASMSTRIPFLAGS), $(STRIP) $(ASMSTRIPFLAGS) $@)

If not, this can also be due to missing sse4 on your cpu. (There might be some calls to sse4 in these functions instead of sse2)

Pierre-Loup