View Full Version : x264 compilation
Pages :
1
2
[
3]
4
5
6
7
8
9
10
11
Sharktooth
31st May 2005, 18:47
remove --enable-vfw if you want multithreading
it should work
bob0r
31st May 2005, 20:25
remove --enable-vfw if you want multithreading
it should work
You aren't reading what i said/asked.... i have NO idea how or where to use "-L " Thus i am asking your help! I have NO idea what do to with -L and pthreadGC2.dll
Just a guess: Maybe "-L..." instead of "-l..." in
gcc -o x264.exe x264.o libx264.a -lvfw32 -lm4systems_static -lwinmm -lpthreadGC2 -s
Sharktooth
1st June 2005, 01:45
I didnt read bobor copied the files in mingw/libs and mingw/include. Sorry, -L is not necessary. However --enable-vfw must be removed to compile x264 CLI using --enable-pthread.
@bobor: just use the configure command line you posted above without --enable-vfw and adding --extra-ldflags=-lpthreadGC2 (this is for linking pthreads) and it will work.
Just a guess: Maybe "-L..." instead of "-l..." in
Nope '-L' is for path, '-l' is for lib name, so if you link against '/some/path/libfoo.a', you either pass absolute name or add '-L/some/path -lfoo'
As temporary measure sth like this should do: http://4nykey.nm.ru/tmp/VFW_PTHR
'patch -p0 < VFW_PTHR' will apply it, 'patch -p0 -R < VFW_PTHR' will revert back
Sharktooth
1st June 2005, 02:02
Nope '-L' is for path, '-l' is for lib name, so if you link against '/some/path/libfoo.a', you either pass absolute name or add '-L/some/path -lfoo'
As temporary measure sth like this should do: http://4nykey.nm.ru/tmp/VFW_PTHR
'patch -p0 < VFW_PTHR' will apply it, 'patch -p0 -R < VFW_PTHR' will revert back
Sure, i suggested -L coz i didnt read he already copied the files in the correct dirs...
In that case he doesnt need -L.
bob0r
1st June 2005, 03:13
Ok Sharktooth explained it all to me now.
What i do is:
cvs -z3 -d:pserver:anoncvs@sources.redhat.com:/cvs/pthreads-win32 co -P pthreads
make clean GC
copied libpthreadGC2.a > G:\MinGW\lib
copied *.h > G:\MinGW\include
configure --enable-avis-input --enable-mp4-output --enable-pthread
(1) Note that make clean GC is NOT make clean GC-static, which gives us the following error:
gcc -o x264.exe x264.o libx264.a -lvfw32 -lm4systems_static -lwinmm -lpthreadGC2 -s
libx264.a(encoder.o)(.text+0x394d):encoder.c: undefined reference to `_imp__pthread_create'
libx264.a(encoder.o)(.text+0x3982):encoder.c: undefined reference to `_imp__pthread_join'
collect2: ld returned 1 exit status
make: *** [x264.exe] Error 1
(2) Also when you enable vfw with configure ( --enable-vfw ) x264vfw.dll will not compile, because it does not "allow" pthreads yet, which means you have to compile vfw and cli MT seperately.
The first problem seems to be a pthreads problem, the second problem is hopefully something pengvado(irc name) can fix quickly, so we can have all versions by just using:
configure --enable-vfw --enable-avis-input --enable-mp4-output --enable-pthread
make
Thanks all!
make clean
celtic_druid
1st June 2005, 10:21
Looks like x264 in ffdshow just got pthread support. Also looks there have been some updates in regards to gcc compiling.
Ajaja2005
2nd June 2005, 16:09
I use MSVC .NET 2003 + nasm for compiling x264. In my tests msvc builds are faster than gcc (mingw) builds for my Athlon Barton. But I have one small problem. Is it possible to use GPAC library in this case for mp4 support?
bob0r
2nd June 2005, 23:09
@celtic_druid & Sharktooth
I tried Sharktooth's VFW multithread build, the vfw patch indeed shows the option pthread, but vdub crashes the minute you change 1 to any higher value.
This is the exact same i had with my own compile.
You may have overlooked it, but you should get the same error as before:
Creating library file: x264vfw.dll.a
G:/msys/1.0/home/user/x264_pthread/vfw/build/cygwin/../../../libx264.a(encoder.o)(.text+0x394c):encoder.c: undefined reference to `pthread_create'
G:/msys/1.0/home/user/x264_pthread/vfw/build/cygwin/../../../libx264.a(encoder.o)(.text+0x3980):encoder.c: undefined reference to `pthread_join'
collect2: ld returned 1 exit status
make[1]: *** [x264vfw.dll] Error 1
make[1]: Leaving directory `/home/user/x264_pthread/vfw/build/cygwin'
make: *** [x264vfw.dll] Error 2
(ofcourse your paths are different)
If one of you guys truely managed to compile x264 cli AND vfw with pthreads
( configure --enable-vfw --enable-avis-input --enable-mp4-output --enable-pthread )
please tell us how, and x264 can be updated, if not, we have to wait patiently :)
Extra for general readers:
X264.exe (cli) does infact work, but only when pthread compiled as: make clean GC.
make clean GC-static also does compile, but x264.exe fails to work (probably pthread bug)
make clean GC does mean you require an extra .dll file (pthreadGC2.dll), Sharktooth includes this with his installer to your system32 directory.
Sharktooth
3rd June 2005, 01:23
bobor, my builds (both CLI and VFW) work with threads > 1...
it crashes only with GC-static.
Ensure you have the correct pthread library builds in your paths.
bob0r
3rd June 2005, 02:27
Great, it works indeed!
Good work, i hope so see it updated for x264 soon, :thanks:
For anyone who wants to try it: Just wait, because i still have no idea what sharktooth did exactly, and i think to be honest, nor did he, hehehe :D
celtic_druid
3rd June 2005, 04:27
As said, with phtreads statically linked it crashes. Guess maybe the method I came up with for getting it to link statically is floored?. x264 in ffdshow works fine though as does x264 if you link dynamically.
If you get "undefined reference to `pthread_join'" then you are linking statically. The problem is VfW not linking to libpthread or linking in the wrong order.
Sharktooth
3rd June 2005, 10:15
i managed to link vfw to pthreads and it's working. But as CD said, static links generate crashes. I think it's a problem with pthreads too.
Btw the problem lies in the configure script. It does not propagate --extra-xxflags to the vfw/build/cygwin/config.mak
akupenguin
3rd June 2005, 10:31
Btw the problem lies in the configure script. It does not propagate --extra-xxflags to the vfw/build/cygwin/config.mak It does for me...
Sharktooth
3rd June 2005, 10:58
My configure line looks like this: ./configure --enable-vfw --enable-avis-input --enable-mp4-output --enable-pthread --extra-cflags=-I../gpac/include --extra-ldflags=-L../gpac/bin/gcc --extra-cflags=-march=pentium2 --extra-cflags=-mmmx --extra-cflags=-O4 --extra-cflags=-finline-functions --extra-cflags=-funroll-loops --extra-cflags=-ffast-math --extra-cflags=-fomit-frame-pointer --extra-cflags=-I../pthread --extra-ldflags=-L../pthread
and the vfw/build/cygwin/config.mak after the configure looks like this:
CFLAGS=-I../pthread
LDFLAGS=-L../pthread -s
so something was not being propagated... only the last "--extra-xxflags=" value was written in the vfw/build/cygwin/config.mak ...
celtic_druid
3rd June 2005, 11:08
Try:
./configure --enable-vfw --enable-avis-input --enable-mp4-output --enable-pthread --extra-cflags="-I../gpac/include -march=pentium2 -mmmx -O4 -finline-functions -funroll-loops -ffast-math -fomit-frame-pointer -I../pthread" --extra-ldflags="-L../pthread -L../gpac/bin/gcc"
Sharktooth
3rd June 2005, 11:20
uhm... it works... the flags are propagated but it doesnt compile (the usual linking problem with pthreads).
actually with this patch it works (both static and dynamic libs - but static linking crashes at runtime):
--- vfw/build/cygwin/Makefile Thu Jun 2 11:49:32 2005
+++ M2 Thu Jun 2 11:51:57 2005
@@ -38,7 +38,7 @@
# Constants which should not be modified
# The `mingw-runtime` package is required when building with -mno-cygwin
-CFLAGS += -I$(DIR_SRC)/w32api -I$(DIR_INC)
+CFLAGS += -I$(DIR_SRC)/w32api -I$(DIR_INC) -DPTW32_BUILD -DHAVE_PTHREAD=1
CFLAGS += -D_WIN32_IE=0x0500
CFLAGS += -mno-cygwin
@@ -50,7 +50,7 @@
# Compiler flags for linking stage
##############################################################################
-LDFLAGS += -L$(DIR_LIB) -lx264
+LDFLAGS += -L$(DIR_LIB) -lx264 -lwinmm -lpthreadGC2 -lwsock32
##############################################################################
# Rules
celtic_druid
3rd June 2005, 11:47
From recollection it works without -DPTW32_BUILD (static or otherwise). But yeah if you don't add the lib to the make file, then it doesn't compile. I guess it is because lpthread has to be linked in the right order.
Also you should only need -lwsock32 if you are using the static libpthread. Does this mean that you got it to work without crashing?
Sharktooth
3rd June 2005, 11:51
no.. static linking pthreads make x264 crash at runtime with threads > 1.
bob0r
4th June 2005, 22:39
Ok, i updated pthread: cvs up
make clean GC
clean x264 248
added sharktooth patch: patch -p0 < VFWthreads.diff
Manual edit: x264_pthread\vfw\build\cygwin\config.mak:
CFLAGS += -DPTW32_BUILD -DHAVE_PTHREAD=1
LDFLAGS += -lwinmm -lpthreadGC2 -lwsock32 -s
And edit x264_pthread\vfw\build\cygwin\Makefile:
changed:
CFLAGS += -I$(DIR_SRC)/w32api -I$(DIR_INC)
to:
CFLAGS = -I$(DIR_SRC)/w32api -I$(DIR_INC)
I removed the + from +=
same for:
LDFLAGS += -L$(DIR_LIB) -lx264
to:
LDFLAGS = -L$(DIR_LIB) -lx264
x264vfw.dll does compile and seems to work.
Also when my config.mak looks like this:
LDFLAGS += -lpthreadGC2 -s
x264vfw.dll does compile and still seems to work. (yes i removed a lot of flags and CFLAGS)
.... When i try all of the above with: make clean GC-static, nothing compiles, so also with full config.mak:
CFLAGS += -DPTW32_BUILD -DHAVE_PTHREAD=1
LDFLAGS += -lwinmm -lpthreadGC2 -lwsock32 -s
i get:
Creating library file: x264vfw.dll.a
G:/msys/1.0/home/user/x264_pthread/vfw/build/cygwin/../../../libx264.a(encoder.o)(.text+0x38ea):encoder.c: undefined reference to `_imp__pthread_create'
G:/msys/1.0/home/user/x264_pthread/vfw/build/cygwin/../../../libx264.a(encoder.o)(.text+0x391f):encoder.c: undefined reference to `_imp__pthread_join'
collect2: ld returned 1 exit status
make[1]: *** [x264vfw.dll] Error 1
make[1]: Leaving directory `/home/user/x264_pthread/vfw/build/cygwin'
make: *** [x264vfw.dll] Error 2
I am by all means no expert, i am just trying some things, to learn and hopefully clear some things up.... What is the verdict?
Edit:
I have found out, that with make clean GC-static, the new updated pthread, also does no longer compiles with the test files (x264.7z) sharktooh send me, which means, pthread now "logically" does not compile x264 with pthread, by simple giving the same output again:
Creating library file: x264vfw.dll.a
G:/msys/1.0/home/user/x264/vfw/build/cygwin/../../../libx264.a(encoder.o)(.text+0x5f14):encoder.c: undefined reference to `_imp__pthread_create'
G:/msys/1.0/home/user/x264/vfw/build/cygwin/../../../libx264.a(encoder.o)(.text+0x5f49):encoder.c: undefined reference to `_imp__pthread_join'
collect2: ld returned 1 exit status
make[1]: *** [x264vfw.dll] Error 1
make[1]: Leaving directory `/home/user/x264/vfw/build/cygwin'
make: *** [x264vfw.dll] Error 2
cp: cannot stat `x264.exe': No such file or directory
cp: cannot stat `vfw/build/cygwin/bin/x264vfw.dll': No such file or directory
So x264 + pthread no longer will compile with GC-static, which did not work (crashed x264) anyway!
bob0r
5th June 2005, 14:55
Problem of pthread solved:
------------------------------------------------------------------------
r250 | titer | 2005-06-05 12:17:10 +0200 (Sun, 05 Jun 2005) | 3 lines
Use win32 native threads (you still have to --enable-pthread to use
them, though)
------------------------------------------------------------------------
pthread is no longer used! :devil:
I also heard win32 native threads can be enabled in x264 by default in the future, good news for Sharktooth's VFW-GUI :eek:
leowai
15th June 2005, 12:35
I'm wondering anyone of you experience problem with the compiled x264 vfw under MinGW32?
I did experience problem from the vfw where the "About" dialog can not be shown. This occurs in the OS (I tried in win2k, winxp) which uses "Chinese Simplified" as the default language for non-Unicode programs (this can be changed in the control panel -> Regional & Languages Settings -> "Language for non-Unicode programs"). There will no be a problem IF "English" is used for non-Unicode programs (You can try this out out. :)).
I use the Resource Hacker to check on the x264vfw.dll file, it shows as follow:
http://img236.echo.cx/img236/43/resourcebefore4rb.png (http://www.imageshack.us)
As you can see, the "Visit Homepage" button in resource (and the third line in the window) can't be read correctly and I found the cause is from the resource.rc in line 225. There are unicodes in the line!
CTEXT "Copyright 2005 Laurent Aimar, Justin Clay, Min Chen,\nEric Petit, M錸s Rullg錼d, Loren Merritt\n\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation",
IDC_STATIC,7,47,199,51
So I move the portion of the codes in resource.rc a few lines lower and just before the "END" at line 231 as follow:
LTEXT "x264 - H.264/MPEG-4 AVC codec",IDC_X264,53,8,145,8,
SS_CENTERIMAGE
CTEXT "Copyright 2005 Laurent Aimar, Justin Clay, Min Chen,\nEric Petit, M錸s Rullg錼d, Loren Merritt\n\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation",
IDC_STATIC,7,47,199,51
END
So the line with unicode chars is read after all others resources. This solves the problem of not showing "About" dialog box of vfw after changes above. The resource hacker shows the correct "About" dialog as:
http://img298.echo.cx/img298/3509/resourceafter5qw.png (http://www.imageshack.us)
As a result, I propose to make some changes to the resource.rc file so that it works under MinGW32 with non-English language used for non-Unicode programs.
Thanks.
regards,
leowai
Sharktooth
15th June 2005, 13:41
http://www.webalice.it/f.corriga/x264/x264vfw_unicode_fix.diff
submitted to akupenguin. just wait until he commits it...
leowai
16th June 2005, 07:08
@Sharktooth,
Thanks for your attention. :)
As an additional information, the bug only occurs in MinGW32 but not in cygwin in my OS using chinese language for non-unicode programs.
Just another minor problem in the vfw? The compiled vfw shows one of the author's name as "M?ns Rullg?rd" instead of "Måns Rullgård" (as shown in the author list from http://www.videolan.org/x264.html).
Have a quick search through about the windres function, it seems like reading unicode chars in *.rc is a known bug for windres. :(
regards,
LeoWai
Sharktooth
16th June 2005, 11:05
Nothing i can do then, sorry. but at least in my rev263A build the Visit Homepage button should work now.
leowai
17th June 2005, 06:00
@Sharktooth,
Nothing to say sorry. You've tried your best for this. :)
*Just for your information:*
I've found the cause where the char å (0xE5) not disappear correctly. It's because my OS is set to Chinese with non-unicode program (I think my OS will read any char as double byte if the char is greater ascii 128, which is 0x80).
See the reason? There is two å (0xE5) chars in the "resource.rc" file. As a result, when compiling with "windres", it reads char "ån" and char "år" as one char. This produced a "blank" char in vfw about dialog (see the picture I attached in previous thread).
So, I think it'll be better to use cygwin to compile the source if you're using non-English language for non-unicode program in your OS. MinGW32 probably will produce incorrect information of author's name in the "About" dialog box (even if there is no errors after the vfw patch :)). I believe this is because MinGW32 uses windows native reading method while cygwin uses unix based reading method.
So, you don't surprise if you see the author's name as "M?ns Rullg?rd" instead of "Måns Rullgård", in my case. :)
Cheers. :)
regards,
leowai
PS: Also note that, if you use VC++ to compile the source (not the case for cygwin and MingGW), the information in the "About" dialog will be truncated to a max of 256 chars. You will found your vfw with trancuated text at the end as "... Free Software Found??". For the users with VC++, you've to seperate the static text for Author and the terms and conditions to avoid this problem.
el divx
5th July 2005, 07:36
Anyone that can help with this:
make -C vfw/build/cygwin
make[1]: Entering directory `/home/God Of War/x264/vfw/build/cygwin'
make[1]: *** No rule to make target `codec.obj', needed by `x264vfw.dll'. Stop.
make[1]: Leaving directory `/home/God Of War/x264/vfw/build/cygwin'
make: *** [x264vfw.dll] Error 2
I get it every time I try to compile vfw. I've checked the makefile and it seems to include "codec.c".
Sharktooth
5th July 2005, 13:45
did you ./configure?
however:
./configure --enable-vfw
make
there are also other usefull options and features (for CLI) that can be set up/enabled: use ./configure --help. Also if you dont use the "standard" metod (posted above) remember you have to compile the CLI (core) before you can compile the vfw dll.
el divx
7th July 2005, 08:49
I did use ./configure --enable-vfw & make. Problem is that for a strange reason the linux lib compiles perfectly. Oh, and I'm using the latest version of cygwin if that is of any help.
Here's what the config.mak looks like:
prefix=/usr/local
eprefix=${prefix}
bindir=${eprefix}/bin
libdir=${eprefix}/lib
includedir=${prefix}/include
ARCH=X86
SYS=CYGWIN
CC=gcc
CFLAGS=-Wall -I. -O3 -ffast-math -D__X264__ -mno-cygwin -DHAVE_MMXEXT -DHAVE_SSE -DARCH_X86 -DSYS_CYGWIN -s -fomit-frame-pointer
LDFLAGS= -mno-cygwin -s
AS=nasm
ASFLAGS=-f win32 -DPREFIX
VFW=yes
EXE=.exe
VIS=no
default: x264vfw.dll
Lastly, OS is Win XP Pro SP2, CPU Athlon XP 2700+ Thoroughbred(I changed the multiplier and it now has become a 2800+), MEM 2x512MB Transcend.
leowai
12th July 2005, 05:32
el divx,
You can try MinGW (www.mingw.org). The compilation instructions is available from bob0r's website (http://mirror01.x264.nl/x264/readme.txt).
In short, you need following programs (without avs & mp4 support) to be installed:
1. MinGW-3.2.0-rc-3.exe
2. MSYS-1.0.10.exe
3. nasm-0.98.38-win32.zip (renamed nasm.exe to nasmw.exe into: C:\MinGW\bin)
el divx
12th July 2005, 10:37
This time I used MinGW and got, what a surprise, this:
ranlib libx264.a
make -C vfw/build/cygwin
make[1]: Entering directory `/home/God Of War/x264/vfw/build/cygwin'
make[1]: *** No rule to make target `codec.obj', needed by `x264vfw.dll'. Stop.
make[1]: Leaving directory `/home/God Of War/x264/vfw/build/cygwin'
make: *** [x264vfw.dll] Error 2Any help?
BTW, how do you cross-compile it on linux(I have SuSE Linux 9.3 Pro dual boot on my machine).
leowai
12th July 2005, 12:47
el divx,
Would you try a clean compilation by running following commands in MinGW in sequences?
>make distclean
>./configure --enable-vfw
>make
el divx
12th July 2005, 14:21
Tried now and same thing happened.
leowai
14th July 2005, 06:28
New (re-written) gpac is out.
http://forum.doom9.org/showthread.php?p=686757#post686757
Bad news is the new release consists different source structure and file names. Will the source of x264 be updated to get latest mp4 output format supported?
Since mp4 output works fine now, just want to know whether it will be updated or not (and I know it won't be so soon).
leon_id
20th July 2005, 00:51
Hi,
downloaded last sources from http://www.webalice.it/f.corriga/x264/X264_rev275_src.7z
encounter two small problems while trying to compile them
1) ./common/set.c doenst included in libx264.lib build under win32
2) ./vfw/codec.c, function compress_query() in comparision with fourcc uses inhdr->biCompression, i think outhdr must be used instead.
TheUnforgiven
31st July 2005, 08:13
i got mingw, msys and nasm.
nasm is in mingw bin folder
i did configure then make
the following error appears:
...
....
.....
nasm -f win32 -DPREFIX -o common/i386/dct-a.o common/i386/dct-a.asm
0 [main] make 3116 proc_subproc: Couldn't duplicate my handle<0x7E4> for pid 0, Win32 error 6
10602 [main] make 3116 proc_subproc: Couldn't duplicate my handle<0x7E4> for pid 0, Win32 error 6
make: nasm: Command not found
make: *** [common/i386/dct-a.o] Error 127
any help?
Birdy1
31st July 2005, 13:24
Did you rename nasmw.exe to nasm.exe?
TheUnforgiven
31st July 2005, 13:52
successfully compiled.
the problem was wrong version of nasm. i was using nasm for dos32. i thought this is windows :p didnt notice the win32 version.
thanx birdy for the response.
ddnt
1st August 2005, 12:50
For recent versions, including version 281, I can't get them compiled under cygwin and VC6 with default building configuration, while configure.sh can solve the problem.
I got messages like those:
libx264.lib(encoder.obj) : error LNK2001: unresolved external symbol _x264_cqm_parse_file
libx264.lib(encoder.obj) : error LNK2001: unresolved external symbol _x264_cqm_init
Ajaja2005
1st August 2005, 21:46
2ddnt
Add .\common\set.c and .\matroska.c to the project for MSVC compiling.
Kopernikus
2nd August 2005, 14:58
I try to compile x264 with --enable-avis-input, the compilation is successful, but when I try to execute x264.exe something like "The procedure entry point wasnt found in msvfw32.dll AVIFileExit()"
If i compile without --enable-avis-input the error doesnt occur.
I`m using MinGW and MSys (don`t know which Version)
OS: Win XP Home SP1
The dll is in my path.
TheUnforgiven
4th August 2005, 10:17
is there a specific version of GPac i need to use?
I got the latest one but i am unable to compile with MP4 output.
where exactly should i put the gpac source?
should i compile it before compiling x264?
thank you
celtic_druid
4th August 2005, 10:37
You need a version prior to 0.4.0, one the produces libm4systems_static.a instead of libgpac_static.a that is untill x264 is updated to the new API.
You need to compile the GPAC's lib first. You also need the include files.
TheUnforgiven
6th August 2005, 08:39
compile done successfully.
:thanks:
I wonder if it is possible to compile x264 under intel compiler and wether it gives good speed gains?
Sharktooth
6th August 2005, 12:31
:search:
LigH
10th August 2005, 22:18
rel285 @ x264.nl ;)
bob0r
25th September 2005, 15:19
@sharktooth
My old gpac 0.3.x configure was:
configure --disable-jpeg --disable-xvid --disable-mad --disable-faad --disable-ffmpeg --disable-png
I kept doing cvs up, untill gpac became 0.4.x, i could still compile 0.4.x.
Now when i ran configure --disable-jpeg --disable-xvid --disable-mad --disable-faad --disable-ffmpeg --disable-png (or configure alone)
I cant compile on mingw/msys anymore.
Can you please advice me how to compile gpac 0.4.x?
celtic_druid
25th September 2005, 16:09
If it is just for x264 then just run ./configure && make lib.
bob0r
25th September 2005, 16:35
@celtic_druid
Thanks that worked!
(i used to run just make)
btw look at the New ffdshow build (?) thread please
You know we love you right? RIGHT?! ;)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.