GNOME Bugzilla – Bug 777903
x264 fails to build on Windows
Last modified: 2017-02-02 12:34:50 UTC
[1/2] Compiling c object subprojects/gst-plugins-ugly/ext/x264/gstx264@sha/gstx264enc.c.obj FAILED: cl @subprojects/gst-plugins-ugly/ext/x264/gstx264@sha/gstx264enc.c.obj.rsp ext\x264\gstx264enc.c(140): error C2099: initializer is not a constant ext\x264\gstx264enc.c(140): warning C4047: 'initializing': 'const int *' differs in levels of indirection from 'void (__cdecl *)(x264_t *)' ext\x264\gstx264enc.c(140): warning C4047: 'initializing': 'const int *' differs in levels of indirection from 'int (__cdecl *)(x264_t *)' ext\x264\gstx264enc.c(140): warning C4113: 'int (__cdecl *)(x264_t *,x264_nal_t **,int *,x264_picture_t *,x264_picture_t *)' differs in parameter lists from 'void (__cdecl *)(x264_t *)' ext\x264\gstx264enc.c(140): warning C4113: 'int (__cdecl *)(x264_t *,x264_nal_t **,int *)' differs in parameter lists from 'int (__cdecl *)(x264_t *)' ext\x264\gstx264enc.c(140): warning C4113: 'void (__cdecl *)(x264_t *)' differs in parameter lists from 'int (__cdecl *)(x264_t *,x264_nal_t **,int *,x264_picture_t *,x264_picture_t *)' ext\x264\gstx264enc.c(140): warning C4133: 'initializing': incompatible types - from 'void (__cdecl *)(x264_t *)' to 'int (__cdecl *)(x264_t *,x264_nal_t **,int *,x264_picture_t *,x264_picture_t *)' ext\x264\gstx264enc.c(140): warning C4113: 'int (__cdecl *)(x264_t *)' differs in parameter lists from 'int (__cdecl *)(x264_t *,x264_nal_t **,int *)' ext\x264\gstx264enc.c(140): warning C4028: formal parameter 1 different from declaration ext\x264\gstx264enc.c(140): warning C4047: 'initializing': 'void (__cdecl *)(x264_t *)' differs in levels of indirection from 'x264_t *(__cdecl *)(x264_param_t *)' ext\x264\gstx264enc.c(140): warning C4113: 'int (__cdecl *)(x264_t *,x264_param_t *)' differs in parameter lists from 'int (__cdecl *)(x264_t *)' ext\x264\gstx264enc.c(140): warning C4047: 'initializing': 'x264_t *(__cdecl *)(x264_param_t *)' differs in levels of indirection from 'void (__cdecl *)(x264_param_t *)' ext\x264\gstx264enc.c(140): warning C4028: formal parameter 2 different from declaration ext\x264\gstx264enc.c(140): warning C4047: 'initializing': 'const x264_level_t (*)[0]' differs in levels of indirection from 'void (__cdecl *)(x264_param_t *)' ext\x264\gstx264enc.c(140): warning C4113: 'int (__cdecl *)(x264_param_t *,const char *,const char *)' differs in parameter lists from 'void (__cdecl *)(x264_param_t *)' ext\x264\gstx264enc.c(140): warning C4113: 'int (__cdecl *)(x264_param_t *,const char *,const char *)' differs in parameter lists from 'int (__cdecl *)(x264_param_t *,const char *)' ninja: build stopped: cannot make progress due to previous errors.
These all seem weird, but seem to be 2 groups: 1) "initializer is not a constant" must be the NULL or the constants in the beginning, but why would that not be constant? 2) all others look like everything moved by 2 elements up in the array. The types differ in exactly that way. My guess is that somehow MSVC can't handle putting the constants in there and fails to properly parse everything because of that.
Just for the record, I get the same error with MinGW/GCC with Meson on Windows too: FAILED: i686-w64-mingw32-gcc @subprojects/gst-plugins-ugly/ext/x264/gstx264@sha/gstx264enc.c.obj.rsp ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:141:3: error: initializer element is not constant ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:141:3: error: (near initialization for 'default_vtable.module') ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:142:3: error: initializer element is not constant ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:142:3: error: (near initialization for 'default_vtable.x264_bit_depth') ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:142:3: warning: initialization from incompatible pointer type [enabled by default] ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:142:3: warning: (near initialization for 'default_vtable.x264_chroma_format') [enabled by default] ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:142:3: warning: initialization from incompatible pointer type [enabled by default] ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:142:3: warning: (near initialization for 'default_vtable.x264_encoder_close') [enabled by default] ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:143:3: warning: initialization from incompatible pointer type [enabled by default] ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:143:3: warning: (near initialization for 'default_vtable.x264_encoder_delayed_frames') [enabled by default] ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:143:3: warning: initialization from incompatible pointer type [enabled by default] ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:143:3: warning: (near initialization for 'default_vtable.x264_encoder_encode') [enabled by default] ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:143:3: warning: initialization from incompatible pointer type [enabled by default] ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:143:3: warning: (near initialization for 'default_vtable.x264_encoder_headers') [enabled by default] ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:144:3: warning: initialization from incompatible pointer type [enabled by default] ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:144:3: warning: (near initialization for 'default_vtable.x264_encoder_intra_refresh') [enabled by default] ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:144:3: warning: initialization from incompatible pointer type [enabled by default] ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:144:3: warning: (near initialization for 'default_vtable.x264_encoder_maximum_delayed_frames') [enabled by default] ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:145:3: warning: initialization from incompatible pointer type [enabled by default] ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:145:3: warning: (near initialization for 'default_vtable.x264_encoder_open_148') [enabled by default] ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:145:3: error: initializer element is not constant ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:145:3: error: (near initialization for 'default_vtable.x264_encoder_reconfig') ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:145:3: warning: initialization from incompatible pointer type [enabled by default] ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:145:3: warning: (near initialization for 'default_vtable.x264_levels') [enabled by default] ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:146:3: warning: initialization from incompatible pointer type [enabled by default] ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:146:3: warning: (near initialization for 'default_vtable.x264_param_apply_fastfirstpass') [enabled by default] ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:146:3: warning: initialization from incompatible pointer type [enabled by default] ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:146:3: warning: (near initialization for 'default_vtable.x264_param_apply_profile') [enabled by default] ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:146:3: warning: initialization from incompatible pointer type [enabled by default] ../subprojects/gst-plugins-ugly/ext/x264/gstx264enc.c:146:3: warning: (near initialization for 'default_vtable.x264_param_default') [enabled by default]
Created attachment 344669 [details] [review] Manually initialize the vtable
Will test on Linux and push.
commit 184351ae485d5befc3311a122c717ec534225c52 Author: Nirbheek Chauhan <nirbheek@centricular.com> Date: Wed Feb 1 03:08:10 2017 +0530 x264: Initialize function vtable in plugin_init() These values are defined in the x264.h header and are not const on Windows due to the way DLLs work. See: https://msdn.microsoft.com/en-us/library/619w14ds.aspx https://msdn.microsoft.com/en-us/library/zw3za17w.aspx https://bugzilla.gnome.org/show_bug.cgi?id=777903