Log in

View Full Version : Manual for compiling x264 under Cygwin for Windows


vova254
13th July 2009, 23:21
I'm a newbie in x264 compiling, and I would like to make a small amendments in source code, convenient for me. it appears to me that this corrections do not influence the errors during compilation.
Could anyone advise a reference to a simple manual for building of x264 under Cygwin for Windows with pthread support using snapshots from http://www.videolan.org/developers/x264.html.
An example of such manual for ffmpeg is http://www.salyens.com/mingw/. Turning on the option "pthread" to "yes" in configure file leads to numerous compiling errors while building the project:
gcc -O4 -ffast-math -Wall -I. -mno-cygwin -march=i686 -DHAVE_MMX -DARCH_X86 -DSYS_MINGW -DHAVE_PTHREAD -s -fomit-frame-pointer -c -o x264.o x264.c
In file included from common/osdep.h:103,
from common/common.h:62,
from x264.c:31:
./pthread.h:77: error: parse error before '*' token
./pthread.h:78: warning: type defaults to `int' in declaration of `pthread_attr_t'
./pthread.h:78: error: parse error before '*' token
./pthread.h:79: warning: type defaults to `int' in declaration of `pthread_attr_t'
./pthread.h:79: error: parse error before '*' token
./pthread.h:80: warning: type defaults to `int' in declaration of `pthread_attr_t'
./pthread.h:80: error: parse error before '*' token
./pthread.h:81: warning: type defaults to `int' in declaration of `pthread_attr_t'
./pthread.h:81: error: parse error before '*' token
./pthread.h:82: warning: type defaults to `int' in declaration of `pthread_attr_t'
./pthread.h:82: error: parse error before '*' token
./pthread.h:83: error: parse error before '*' token
./pthread.h:84: error: parse error before '*' token
./pthread.h:85: error: parse error before '*' token
./pthread.h:86: error: parse error before '*' token
./pthread.h:87: error: parse error before '*' token
./pthread.h:88: error: parse error before '*' token
./pthread.h:104: warning: parameter names (without types) in function declaration
./pthread.h:127: error: parse error before '*' token
./pthread.h:128: error: parse error before '*' token
./pthread.h:129: error: parse error before '*' token
./pthread.h:130: error: parse error before '*' token
./pthread.h:131: error: parse error before '*' token
./pthread.h:133: error: parse error before '*' token
./pthread.h:134: error: parse error before '*' token
./pthread.h:135: warning: type defaults to `int' in declaration of `pthread_condattr_t'
./pthread.h:135: error: parse error before '*' token
./pthread.h:136: error: parse error before '*' token
./pthread.h:137: error: parse error before '*' token
./pthread.h:139: error: parse error before '*' token
./pthread.h:140: error: `pthread_create' declared as function returning a function
./pthread.h:140: error: parse error before "void"
./pthread.h:141: warning: parameter names (without types) in function declaration
./pthread.h:142: warning: parameter names (without types) in function declaration
./pthread.h:144: error: parse error before "int"
./pthread.h:145: warning: parameter names (without types) in function declaration
./pthread.h:146: error: parse error before "void"
./pthread.h:147: error: parse error before '*' token
./pthread.h:147: error: parse error before ')' token
./pthread.h:148: warning: parameter names (without types) in function declaration
./pthread.h:151: error: parse error before '*' token
./pthread.h:152: warning: type defaults to `int' in declaration of `pthread_mutex_t'
./pthread.h:152: error: parse error before '*' token
./pthread.h:153: error: parse error before '*' token
./pthread.h:154: error: parse error before '*' token
./pthread.h:155: error: parse error before '*' token
./pthread.h:156: error: parse error before '*' token
./pthread.h:157: error: parse error before '*' token
./pthread.h:158: error: parse error before '*' token
./pthread.h:159: warning: type defaults to `int' in declaration of `pthread_mutexattr_t'
./pthread.h:159: error: parse error before '*' token
./pthread.h:160: warning: type defaults to `int' in declaration of `pthread_mutexattr_t'
./pthread.h:160: error: parse error before '*' token
./pthread.h:161: warning: type defaults to `int' in declaration of `pthread_mutexattr_t'
./pthread.h:161: error: parse error before '*' token
./pthread.h:162: warning: type defaults to `int' in declaration of `pthread_mutexattr_t'
./pthread.h:162: error: parse error before '*' token
./pthread.h:163: error: parse error before '*' token
./pthread.h:164: error: parse error before '*' token
./pthread.h:165: error: parse error before '*' token
./pthread.h:166: error: parse error before '*' token
./pthread.h:167: error: parse error before '*' token
./pthread.h:170: error: parse error before '*' token
./pthread.h:171: error: parse error before '*' token
./pthread.h:172: error: parse error before '*' token
./pthread.h:173: error: parse error before '*' token
./pthread.h:174: error: parse error before '*' token
./pthread.h:175: error: parse error before '*' token
./pthread.h:176: error: parse error before '*' token
./pthread.h:177: error: parse error before '*' token
./pthread.h:178: warning: type defaults to `int' in declaration of `pthread_rwlockattr_t'
./pthread.h:178: error: parse error before '*' token
./pthread.h:180: error: parse error before '*' token
./pthread.h:181: error: parse error before '*' token
./pthread.h:183: error: parse error before '*' token
./pthread.h:183: error: parse error before ')' token
./pthread.h:190: error: parse error before "pthread_self"
./pthread.h:190: warning: type defaults to `int' in declaration of `pthread_self'
./pthread.h:190: warning: data definition has no type or storage class
./pthread.h:193: error: parse error before "int"
./pthread.h:194: error: parse error before "const"
./pthread.h:199: warning: parameter names (without types) in function declaration
./pthread.h:200: warning: parameter names (without types) in function declaration
In file included from common/common.h:74,
from x264.c:31:
common/frame.h:91: error: parse error before "pthread_mutex_t"
common/frame.h:91: warning: no semicolon at end of struct or union
common/frame.h:92: warning: type defaults to `int' in declaration of `cv'
common/frame.h:92: warning: data definition has no type or storage class
common/frame.h:94: warning: type defaults to `int' in declaration of `x264_frame_t'
common/frame.h:94: warning: data definition has no type or storage class
common/frame.h:110: error: parse error before '*' token
common/frame.h:110: warning: type defaults to `int' in declaration of `x264_frame_new'
common/frame.h:110: warning: data definition has no type or storage class
common/frame.h:111: error: parse error before '*' token
common/frame.h:113: error: parse error before "x264_frame_t"
common/frame.h:115: error: parse error before "x264_frame_t"
common/frame.h:116: error: parse error before "x264_frame_t"
common/frame.h:117: error: parse error before '*' token
common/frame.h:118: error: parse error before "x264_frame_t"
common/frame.h:123: error: parse error before "x264_frame_t"
common/frame.h:124: error: parse error before "x264_frame_t"
common/frame.h:128: error: parse error before '*' token
common/frame.h:129: error: parse error before '*' token
common/frame.h:131: error: parse error before '*' token
common/frame.h:132: error: parse error before '*' token
common/frame.h:132: error: parse error before '*' token
common/frame.h:132: warning: type defaults to `int' in declaration of `x264_frame_pop'
common/frame.h:132: warning: data definition has no type or storage class
common/frame.h:133: error: parse error before '*' token
common/frame.h:134: error: parse error before '*' token
common/frame.h:134: error: parse error before '*' token
common/frame.h:134: warning: type defaults to `int' in declaration of `x264_frame_shift'
common/frame.h:134: warning: data definition has no type or storage class
common/frame.h:135: error: parse error before "x264_frame_t"
common/frame.h:136: error: parse error before '*' token
common/frame.h:136: warning: type defaults to `int' in declaration of `x264_frame_pop_unused'
common/frame.h:136: warning: data definition has no type or storage class
common/frame.h:137: error: parse error before '*' token
In file included from x264.c:31:
common/common.h:266: error: parse error before "pthread_t"
common/common.h:266: warning: no semicolon at end of struct or union
common/common.h:330: error: parse error before "x264_frame_t"
common/common.h:330: warning: no semicolon at end of struct or union
common/common.h:332: warning: type defaults to `int' in declaration of `next'
common/common.h:332: warning: data definition has no type or storage class
common/common.h:334: error: parse error before '*' token
common/common.h:334: warning: type defaults to `int' in declaration of `unused'
common/common.h:334: warning: data definition has no type or storage class
common/common.h:336: error: parse error before '*' token
common/common.h:336: warning: type defaults to `int' in declaration of `last_nonb'
common/common.h:336: warning: data definition has no type or storage class
common/common.h:339: error: parse error before '*' token
common/common.h:339: warning: type defaults to `int' in declaration of `reference'
common/common.h:339: warning: data definition has no type or storage class
common/common.h:351: error: parse error before '}' token
common/common.h:351: warning: type defaults to `int' in declaration of `frames'
common/common.h:351: warning: data definition has no type or storage class
common/common.h:354: error: parse error before '*' token
common/common.h:354: warning: type defaults to `int' in declaration of `fenc'
common/common.h:354: warning: data definition has no type or storage class
common/common.h:357: error: parse error before '*' token
common/common.h:357: warning: type defaults to `int' in declaration of `fdec'
common/common.h:357: warning: data definition has no type or storage class
common/common.h:361: error: parse error before '*' token
common/common.h:361: warning: type defaults to `int' in declaration of `fref0'
common/common.h:361: warning: data definition has no type or storage class
common/common.h:363: error: parse error before '*' token
common/common.h:363: warning: type defaults to `int' in declaration of `fref1'
common/common.h:363: warning: data definition has no type or storage class
common/common.h:620: error: 'stat' redeclared as different kind of symbol
./sys/stat.h:124: error: previous declaration of 'stat' was here
common/common.h:620: error: 'stat' redeclared as different kind of symbol
./sys/stat.h:124: error: previous declaration of 'stat' was here
common/common.h:641: error: parse error before '}' token
In file included from common/common.h:644,
from x264.c:31:
common/macroblock.h:272: error: parse error before "x264_frame_t"
common/macroblock.h: In function `x264_macroblock_cache_mv':
common/macroblock.h:384: error: dereferencing pointer to incomplete type
common/macroblock.h: In function `x264_macroblock_cache_mvd':
common/macroblock.h:388: error: dereferencing pointer to incomplete type
common/macroblock.h: In function `x264_macroblock_cache_ref':
common/macroblock.h:392: error: dereferencing pointer to incomplete type
common/macroblock.h: In function `x264_macroblock_cache_skip':
common/macroblock.h:396: error: dereferencing pointer to incomplete type
common/macroblock.h: In function `x264_macroblock_cache_intra8x8_pred':
common/macroblock.h:400: error: dereferencing pointer to incomplete type
common/macroblock.h: In function `x264_mb_predict_intra4x4_mode':
common/macroblock.h:425: error: dereferencing pointer to incomplete type
common/macroblock.h:426: error: dereferencing pointer to incomplete type
common/macroblock.h: In function `x264_mb_predict_non_zero_code':
common/macroblock.h:437: error: dereferencing pointer to incomplete type
common/macroblock.h:438: error: dereferencing pointer to incomplete type
common/macroblock.h: In function `x264_mb_transform_8x8_allowed':
common/macroblock.h:461: error: dereferencing pointer to incomplete type
common/macroblock.h:463: error: dereferencing pointer to incomplete type
common/macroblock.h:464: error: dereferencing pointer to incomplete type
common/macroblock.h:465: error: dereferencing pointer to incomplete type
In file included from /usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../include/w32api/windows.h:98,
from x264.c:41:
/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../include/w32api/winsock2.h:103:2: warning: #warning "fd_set and associated macros have been defined in sys/types. This may cause runtime problems with W32 sockets"
x264.c: In function `main':
x264.c:100: warning: implicit declaration of function `_setmode'
x264.c:100: warning: implicit declaration of function `_fileno'
make: *** [x264.o] Error 1

Dark Shikari
13th July 2009, 23:25
Nothing to do with x264; your pthread.h is broken.

Compilation works fine here.

vova254
14th July 2009, 20:07
but I can open this file in editor and source code is correct. I used pthread.h from usr/include headers from Cygwin and compiled the snapshot right there! What should I do? Could you provide me with the normal one?

kemuri-_9
14th July 2009, 20:40
you obviously don't know what you're doing:

you can't have -mno-cygwin (don't use cygwin) and use cygwin's pthreads at the same time.

you need to acquire/compile pthreads-win32 through mingw (which is what is what -mno-cygwin means) and use that instead.

vova254
17th July 2009, 06:16
Thanks a lot for advise! I have distributed corresponding files from last build of pthreads-win32 into /mingw/include and /lib directories. There's left the last step! Help me, please...

ranlib libx264.a
gcc -o x264.exe x264.o matroska.o muxers.o libx264.a -mno-cygwin -lpthread -lvfw
32 -s
libx264.a(cpu.o):cpu.c:(.text+0x4e2): undefined reference to `__imp__pthread_num
_processors_np'
collect2: ld returned 1 exit status
make: *** [x264.exe] Error 1

Kurtnoise
17th July 2009, 06:38
I have distributed corresponding files from last build of pthreads-win32
you better use the last cvs entry instead...