PDA

View Full Version : Compiling x264 on Fedora9 for windows


ramprasad85
10th November 2008, 14:38
Hi
I am able to compile x264 for linux.
i wish to cross compile x264 for windows from linux.
I have installed mingw
the cross compiler is located at /usr/local/mingw/bin/i586-mingw32msvc-gcc
The script i used has:
CC=/usr/local/mingw/bin/i586-mingw32msvc-gcc \
./configure --host=i586-mingw32msvc --disable-pthread --disable-avis-input

the output is
Platform: X86
System: MINGW
avis input: no
mp4 output: no
pthread: no
gtk: no
debug: no
gprof: no
PIC: no
shared: no
visualize: no

then when i run "make"
i am getting this error


yasm -O2 -f win32 -DPREFIX -DHAVE_SSE3 -Icommon/i386/ -o common/i386/dct-a.o common/i386/dct-a.asm
strip:common/i386/dct-a.o: File format not recognized
make: [common/i386/dct-a.o] Error 1 (ignored)
yasm -O2 -f win32 -DPREFIX -DHAVE_SSE3 -Icommon/i386/ -o common/i386/cpu-a.o common/i386/cpu-a.asm
strip:common/i386/cpu-a.o: File format not recognized
make: [common/i386/cpu-a.o] Error 1 (ignored)
yasm -O2 -f win32 -DPREFIX -DHAVE_SSE3 -Icommon/i386/ -o common/i386/pixel-a.o common/i386/pixel-a.asm
strip:common/i386/pixel-a.o: File format not recognized
make: [common/i386/pixel-a.o] Error 1 (ignored)
yasm -O2 -f win32 -DPREFIX -DHAVE_SSE3 -Icommon/i386/ -o common/i386/mc-a.o common/i386/mc-a.asm
strip:common/i386/mc-a.o: File format not recognized
make: [common/i386/mc-a.o] Error 1 (ignored)
yasm -O2 -f win32 -DPREFIX -DHAVE_SSE3 -Icommon/i386/ -o common/i386/mc-a2.o common/i386/mc-a2.asm
strip:common/i386/mc-a2.o: File format not recognized
make: [common/i386/mc-a2.o] Error 1 (ignored)
yasm -O2 -f win32 -DPREFIX -DHAVE_SSE3 -Icommon/i386/ -o common/i386/predict-a.o common/i386/predict-a.asm
strip:common/i386/predict-a.o: File format not recognized
make: [common/i386/predict-a.o] Error 1 (ignored)
yasm -O2 -f win32 -DPREFIX -DHAVE_SSE3 -Icommon/i386/ -o common/i386/pixel-sse2.o common/i386/pixel-sse2.asm
strip:common/i386/pixel-sse2.o: File format not recognized
make: [common/i386/pixel-sse2.o] Error 1 (ignored)
yasm -O2 -f win32 -DPREFIX -DHAVE_SSE3 -Icommon/i386/ -o common/i386/quant-a.o common/i386/quant-a.asm
strip:common/i386/quant-a.o: File format not recognized
make: [common/i386/quant-a.o] Error 1 (ignored)
yasm -O2 -f win32 -DPREFIX -DHAVE_SSE3 -Icommon/i386/ -o common/i386/deblock-a.o common/i386/deblock-a.asm
strip:common/i386/deblock-a.o: File format not recognized
make: [common/i386/deblock-a.o] Error 1 (ignored)
ar rc libx264.a common/mc.o common/predict.o common/pixel.o common/macroblock.o common/frame.o common/dct.o common/cpu.o common/cabac.o common/common.o common/mdate.o common/csp.o common/set.o common/quant.o encoder/analyse.o encoder/me.o encoder/ratecontrol.o encoder/set.o encoder/macroblock.o encoder/cabac.o encoder/cavlc.o encoder/encoder.o encoder/eval.o common/i386/mc-c.o common/i386/predict-c.o common/i386/dct-a.o common/i386/cpu-a.o common/i386/pixel-a.o common/i386/mc-a.o common/i386/mc-a2.o common/i386/predict-a.o common/i386/pixel-sse2.o common/i386/quant-a.o common/i386/deblock-a.o
ranlib libx264.a
/usr/local/mingw/bin/i586-mingw32msvc-gcc -o x264.exe x264.o matroska.o muxers.o libx264.a -s
libx264.a: could not read symbols: Archive has no index; run ranlib to add one
make: *** [x264.exe] Error 1

i used nasm and got similar error.
I tried make AS=i586-mingw32msvc-as
but i says

i586-mingw32msvc-as -O2 -f elf -DHAVE_SSE3 -Icommon/i386/ -o common/i386/dct-a.o common/i386/dct-a.asm
i586-mingw32msvc-as: unrecognized option '-O2'
make: *** [common/i386/dct-a.o] Error 1


i also tried
make AS=i586-mingw32msvc-as ASFLAGS="-f win32"
i am getting
common/i386/dct-a.asm:710: Warning: rest of line ignored; first ignored character is ` '


where am i going wrong?
Thank you

Dark Shikari
10th November 2008, 17:04
Start by grabbing an x264 version that isn't a year or two old...

ramprasad85
11th November 2008, 13:18
I am using the latest source code, downloaded using git
I could not locate much details at http://x264dev.multimedia.cx/
can u please direct me

when I used mingw's ar, ranlib, strip and gcc, i was able to compile the code. But the exe is not working on windows. it crashes without any error message. only the "submit error report" dialog box appears.

I was able to compile x246 on cygwin in windows. but when i run that exe, that exe also behaves in a similar manner.

please give the standard way to compile x264 on linux for windows
so that i can integrate it with VLC and use it on windows
Thank you

Dark Shikari
11th November 2008, 13:28
I am using the latest source code, downloaded using gitNo you aren't, the "i386" folder hasn't even existed for an entire year.

kemuri-_9
11th November 2008, 15:12
No you aren't, the "i386" folder hasn't even existed for an entire year.

it was renamed to x86 that long ago? wow....

squid_80
12th November 2008, 07:20
Since March (http://git.videolan.org/gitweb.cgi?p=x264.git;a=commit;h=c4680aceec03d3063cbefa5db7ab4404f32578d8), actually. (I suspect DS is in the future and sends patches back in time.)

Dark Shikari
12th November 2008, 08:50
Since March (http://git.videolan.org/gitweb.cgi?p=x264.git;a=commit;h=c4680aceec03d3063cbefa5db7ab4404f32578d8), actually. (I suspect DS is in the future and sends patches back in time.)Bah, so 9 months. Close enough :D

ramprasad85
12th November 2008, 15:09
I downloaded the source from ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20081111-2245.tar.bz2 and compiled it on FC9 using Mingw. On windows When i encode a file using x264.exe it crashes. If i manually remove the "-DHAVE_MMX" from the configure script and compile it, it works. Is there a fix

kemuri-_9
12th November 2008, 15:20
that means the ASM is broken,
thus why it crashes from the start when you try and execute.

so depending on what you were trying to build:
A. an x64 binrary
or
B. an x86 binary

the situation is as follows:
A. x264 does not have win x64 asm support, so you have to use the --disable-asm flag in the ./configure to get a compile that does not crash. And without asm, the x64 version is a complete turtle to x86 w/ asm.

B. cross-compiler failure. since it works fine on windows through the standard cygwin and msys/mingw methods.

ramprasad85
13th November 2008, 06:41
Success!
I downloaded the latest code and noticed the x86 folder.
The code compiled.
But when i executed the exe on windows it crashes.
looking at the disassembly, i figured out that it is trying to use MMX registers. So i manually deleted the -DHAVE_MMX from the configure script and compiled. Now it works. In fact VLC 0.9.6 which uses x264 also crashes when i use H264 codec.
I tested the exe on 3 computers.
Is there a fix for this.
Thank you

squid_80
13th November 2008, 06:59
Do you mean you're running x264 on a pc that doesn't have MMX?

ramprasad85
13th November 2008, 07:10
[ramprasad@localhost ~]$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 15
model : 4
model name : Intel(R) Pentium(R) 4 CPU 2.40GHz
stepping : 1
cpu MHz : 2400.260
cache size : 1024 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 5
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe constant_tsc up pebs bts pni monitor ds_cpl cid xtpr
bogomips : 4803.24
clflush size : 64

My CPU has MMX and SSE support,

Dark Shikari
13th November 2008, 08:05
Deleting -DHAVE_MMX is equivalent to disabling assembly. If it works without assembly, I suspect you have borked something relating to the assembler.

Would it happen that your Linux is 64-bit and Windows is 32-bit, for example? Or your Windows is 64-bit?

ramprasad85
13th November 2008, 10:27
I have windows and Linux on the same system (dual boot) on a intel P4
i downloaded x264 source, compiled it using Mingw32 compiler by setting 'CC=' and used Mingw32's ar ranlib and strip by modifying Make file.
when i run the exe on windows
1. send error report box appears
2. when debug button is clicked, Visual studio says (unhandled exception)
3. When i click ok the faulting instruction has some thing to do with mm0
which i believe is something to do with MMX.
when i run the same exe with --no-asm it runs perfectly
For more info have a look at the attached images
Thank you

Dark Shikari
13th November 2008, 10:34
I have windows and Linux on the same system (dual boot) on a intel P4You haven't said anything about 32-bit or 64-bit, like I asked.

kemuri-_9
13th November 2008, 15:33
i don't think his processor has the EM64T instruction set, so it shouldn't even be capable of either x64 linux or windows.

It seems that his processor is the original p4 line,
so best he has is SSE2, no SSE3 or EM64T.

so it is probably the fact he's on a really old revision and the -DHAVE_SSE3 in the ASFLAGS is fubarring it up.
since x264 is trying to use SSE3 instructions with that in there and he doesn't have them, would explain the crash when ran normally and no crash with --no-asm.

@ramprasad85
try the following
see if x264 runs fine with adding --asm sse2 to your commandline (i think it existed back then)
if that works then remake x264 with the following
make ASFLAGS="-O2 -f win32 -DPREFIX"
with whatever else you're using to get it to make right; just ASFLAGS needs to be what i have there.