View Full Version : Is there any directives for compiling the x264 using the MinGW
schweinsz
15th November 2013, 16:35
I download the latest MinGW from the sourceforge.net, and set the environment variables.
I write a very simple c++ program and compile it successfully using the g++.
Then I download the latest x264 snapshot and make it using the command:
D:\x264Compilation\last_stable_x264>mingw32-make
Makefile:3: config.mak: No such file or directory
process_begin: CreateProcess(NULL, cat config.h, ...) failed.
./configure
process_begin: CreateProcess(NULL, bash D:\x264Compilation\last_stable_x264\configure, ...) failed.
make (e=2):
Makefile:208: recipe for target 'config.mak' failed
mingw32-make: *** [config.mak] Error 2
What do I missed?
MasterNobody
15th November 2013, 16:54
You need MSYS to compile x264 with MinGW. mingw32-make is not enough, you need bash also to run configure scripts.
schweinsz
16th November 2013, 09:44
You need MSYS to compile x264 with MinGW. mingw32-make is not enough, you need bash also to run configure scripts.
Yes, I compiled it successfully. But I found that lavf, ffms and gpac are all disabled.
lavf: no
ffms: no
gpac: no
How to enable it? What else do I need to download?
MasterNobody
16th November 2013, 10:14
Yes, I compiled it successfully. But I found that lavf, ffms and gpac are all disabled.
lavf: no
ffms: no
gpac: no
How to enable it? What else do I need to download?
You need to download, compile and install (make install):
lavf - ffmpeg (http://ffmpeg.org/) or libav (http://libav.org/).
ffms - FFmpegSource (https://github.com/FFMS/ffms2)
gpac - GPAC (http://gpac.wp.mines-telecom.fr/)
Compiled libraries and headers should be in search path for compiler so when running x264's configure you can add (if you used default prefixes for install):
--extra-cflags="-I/usr/local/include" --extra-ldflags="-L/usr/local/lib"
schweinsz
16th November 2013, 10:27
You need to download, compile and install (make install):
lavf - ffmpeg (http://ffmpeg.org/) or libav (http://libav.org/).
ffms - FFmpegSource (https://github.com/FFMS/ffms2)
gpac - GPAC (http://gpac.wp.mines-telecom.fr/)
Compiled libraries and headers should be in search path for compiler so when running x264's configure you can add (if you used default prefixes for install):
--extra-cflags="-I/usr/local/include" --extra-ldflags="-L/usr/local/lib"
Copy the headers to the directory "-I/usr/local/include", and the libraries to the directory "L/usr/local/lib", then add the --extra-cflags="-I/usr/local/include" --extra-ldflags="-L/usr/local/lib" to the system environment variable?
Can I use the pre-compiled libraries and headers from here (http://komisar.gin.by/mingw/libpack-gcc48x-20131031.7z)?
MasterNobody
16th November 2013, 10:57
Copy the headers to the directory "-I/usr/local/include", and the libraries to the directory "L/usr/local/lib", then add the --extra-cflags="-I/usr/local/include" --extra-ldflags="-L/usr/local/lib" to the system environment variable?
Can I use the pre-compiled libraries and headers from here (http://komisar.gin.by/mingw/libpack-gcc48x-20131031.7z)?
Yes, you can if you use komisar's gcc 4.8.x (but this version of pack has l-smash instead of gpac so you will need to get newer x264 with l-smash support if you want mp4 output). You can extract it to any directory, for example "c:\libpack-gcc48x-20131031" and then compile x264 (in case of 32-bit build):
sh ./configure --extra-cflags="-Ic:/libpack-gcc48x-20131031/i686-w64-mingw32/include" --extra-ldflags="-Lc:/libpack-gcc48x-20131031/i686-w64-mingw32/lib"
make
schweinsz
16th November 2013, 11:18
Yes, you can if you use komisar's gcc 4.8.x (but this version of pack has l-smash instead of gpac so you will need to get newer x264 with l-smash support if you want mp4 output). You can extract it to any directory, for example "c:\libpack-gcc48x-20131031" and then compile x264 (in case of 32-bit build):
sh ./configure --extra-cflags="-Ic:/libpack-gcc48x-20131031/i686-w64-mingw32/include" --extra-ldflags="-Lc:/libpack-gcc48x-20131031/i686-w64-mingw32/lib"
make
I run the configure and find that there is no c compiler.
$ ./configure --disable-opencl --extra-cflags="-Ic:\mingw\extras\include" --ex
tra-ldflags="-Lc:\mingw\extras\lib"
No working C compiler found.
Does it mean that I must overwrite my GCC using the komisar's GCC version?
LoRd_MuldeR
16th November 2013, 13:42
Is there any directives for compiling the x264 using the MinGW
We've head various thread about this:
http://forum.doom9.org/showthread.php?t=165350
:search:
I run the configure and find that there is no c compiler.
Type "gcc -v" and GCC should print out its version. If it does so, then you know GCC is there.
If, instead, you get some error like "command gcc not found!", then obviously something with your build environment isn't set up correctly.
Now, if the "configure" script fails with "No working C compiler found" although you have verified that GCC definitely is there, have a look at "config.log" to see what's going wrong.
Maybe one of your extra options made the compiler fail, so that's why the "configure" script determined that "no working C compiler" could be found ;)
BTW: Inside the MSYS environment, you probably should be using Unix-style paths (e.g. use "/c/mingw/extras/include" rather than "c:\mingw\extras\include") only.
MasterNobody
16th November 2013, 14:35
I run the configure and find that there is no c compiler.
$ ./configure --disable-opencl --extra-cflags="-Ic:\mingw\extras\include" --ex
tra-ldflags="-Lc:\mingw\extras\lib"
No working C compiler found.
Does it mean that I must overwrite my GCC using the komisar's GCC version?
Look in config.log may be you specified incorrect parameter there so it can't compile anything with it.
schweinsz
18th November 2013, 03:20
We've head various thread about this:
http://forum.doom9.org/showthread.php?t=165350
:search:
Type "gcc -v" and GCC should print out its version. If it does so, then you know GCC is there.
If, instead, you get some error like "command gcc not found!", then obviously something with your build environment isn't set up correctly.
Now, if the "configure" script fails with "No working C compiler found" although you have verified that GCC definitely is there, have a look at "config.log" to see what's going wrong.
Maybe one of your extra options made the compiler fail, so that's why the "configure" script determined that "no working C compiler" could be found ;)
BTW: Inside the MSYS environment, you probably should be using Unix-style paths (e.g. use "/c/mingw/extras/include" rather than "c:\mingw\extras\include") only.
The GCC is there, when I run the gcc -v, the output is as follows:
Using built-in specs.
COLLECT_GCC=c:\mingw\bin\gcc.exe
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.8.1/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.8.1/configure --prefix=/mingw --host=mingw32 --build=mingw32 --without-pic --enable-shared --enable-static --with-gnu-ld --enable-lto --enable-libssp --di
sable-multilib --enable-languages=c,c++,fortran,objc,obj-c++,ada --disable-sjlj-exceptions --with-dwarf2 --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific
-runtime-libs --with-gmp=/usr/src/pkg/gmp-5.1.2-1-mingw32-src/bld --with-mpc=/usr/src/pkg/mpc-1.0.1-1-mingw32-src/bld --with-mpfr= --with-system-zlib --with-gnu-as --enable-decimal
-float=yes --enable-libgomp --enable-threads --with-libiconv-prefix=/mingw32 --with-libintl-prefix=/mingw --disable-bootstrap LDFLAGS=-s CFLAGS=-D_USE_32BIT_TIME_T
Thread model: win32
gcc version 4.8.1 (GCC)
When I run the "./configure --disable-opencl --extra-cflags="-I/c/mingw/extras/include" --extra-ldflags="-L/c/mingw/extras/lib"", the output is:
No working C compiler found.
I check the conftest.log, the text is:
C:/mingw/lib/crt2.o: In function `_mingw_CRTStartup':
e:\p\giaw\src\pkg\mingwrt-4.0.3-1-mingw32-src\bld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/crt1.c:217: undefined reference to `__cpu_features_init'
C:/mingw/lib/crt2.o: In function `mingw32_init_mainargs':
e:\p\giaw\src\pkg\mingwrt-4.0.3-1-mingw32-src\bld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/init.c:260: undefined reference to `_CRT_glob'
C:/mingw/lib/crt2.o: In function `_mingw_setargv':
e:\p\giaw\src\pkg\mingwrt-4.0.3-1-mingw32-src\bld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/init.c:120: undefined reference to `_CRT_glob'
e:\p\giaw\src\pkg\mingwrt-4.0.3-1-mingw32-src\bld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/init.c:155: undefined reference to `_CRT_glob'
e:\p\giaw\src\pkg\mingwrt-4.0.3-1-mingw32-src\bld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/init.c:241: undefined reference to `__mingw_glob'
C:/mingw/lib/crt2.o: In function `mingw32_init_fmode':
e:\p\giaw\src\pkg\mingwrt-4.0.3-1-mingw32-src\bld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/crt1.c:84: undefined reference to `_CRT_fmode'
e:\p\giaw\src\pkg\mingwrt-4.0.3-1-mingw32-src\bld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/crt1.c:101: undefined reference to `_CRT_fmode'
e:\p\giaw\src\pkg\mingwrt-4.0.3-1-mingw32-src\bld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/crt1.c:105: undefined reference to `_CRT_fmode'
C:/mingw/lib/crt2.o: In function `_mingw_setargv':
e:\p\giaw\src\pkg\mingwrt-4.0.3-1-mingw32-src\bld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/init.c:214: undefined reference to `__mingw_glob'
e:\p\giaw\src\pkg\mingwrt-4.0.3-1-mingw32-src\bld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/init.c:186: undefined reference to `_CRT_glob'
collect2.exe: error: ld returned 1 exit status
I can't understand the upper text and there is no the directory "e:\p\giaw\src\pkg\mingwrt-4.0.3-1-mingw32-src\bld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt" in my computer. I don't know how it is there.
MasterNobody
18th November 2013, 06:36
schweinsz
Upload full config.log (not conftest.log) to any pastebin site (for example to privatepaste.com (http://privatepaste.com/)).
Jeroi
18th November 2013, 08:29
My solutions with mingw+msys.
Copy all the bins to msys bins folder. Msys bin is treaded as /usr/bin.
Rename mingw-make into make.
Edit /etc/profile to export: /c/MinGW/bin:/c/MinGW/include:/usr/bin:/usr/lib:/usr/share:/user/include
in the profile there is also variable by default. This takes windows system enviromental path variable and adds all the folders from there. I did not felt need to include some other environments sdk's so I removed the variabes.
With this combiling should work as always. When things don't find it's because PATH variable is not including necessary paths. For quickie you can just type 'export $PATH=path:path:path' and it will work untile reboot of msys.
Also you will need win32api from mingw-get to be able to handle those windows functions.
schweinsz
18th November 2013, 10:27
schweinsz
Upload full config.log (not conftest.log) to any pastebin site (for example to privatepaste.com (http://privatepaste.com/)).
The text in config.log is as follows (it is not long):
checking whether windres works... yes
x264 configure script
Command line options: "--disable-opencl" "--extra-cflags=-I/c/mingw/extras/include" "--extra-ldflags=-L/c/mingw/extras/lib"
checking whether gcc works... no
Failed commandline was:
--------------------------------------------------
gcc conftest.c -m32 -Wall -I. -I$(SRCPATH) -I/c/mingw/extras/include -march=i686 -mfpmath=sse -msse -lshell32 -m32 -L/c/mingw/extras/lib -Wl,--large-address-aware -Wl,--nxcompat -Wl,--dynamicbase -o conftest
C:/mingw/lib/crt2.o: In function `_mingw_CRTStartup':
e:\p\giaw\src\pkg\mingwrt-4.0.3-1-mingw32-src\bld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/crt1.c:217: undefined reference to `__cpu_features_init'
C:/mingw/lib/crt2.o: In function `mingw32_init_mainargs':
e:\p\giaw\src\pkg\mingwrt-4.0.3-1-mingw32-src\bld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/init.c:260: undefined reference to `_CRT_glob'
C:/mingw/lib/crt2.o: In function `_mingw_setargv':
e:\p\giaw\src\pkg\mingwrt-4.0.3-1-mingw32-src\bld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/init.c:120: undefined reference to `_CRT_glob'
e:\p\giaw\src\pkg\mingwrt-4.0.3-1-mingw32-src\bld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/init.c:155: undefined reference to `_CRT_glob'
e:\p\giaw\src\pkg\mingwrt-4.0.3-1-mingw32-src\bld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/init.c:241: undefined reference to `__mingw_glob'
C:/mingw/lib/crt2.o: In function `mingw32_init_fmode':
e:\p\giaw\src\pkg\mingwrt-4.0.3-1-mingw32-src\bld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/crt1.c:84: undefined reference to `_CRT_fmode'
e:\p\giaw\src\pkg\mingwrt-4.0.3-1-mingw32-src\bld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/crt1.c:101: undefined reference to `_CRT_fmode'
e:\p\giaw\src\pkg\mingwrt-4.0.3-1-mingw32-src\bld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/crt1.c:105: undefined reference to `_CRT_fmode'
C:/mingw/lib/crt2.o: In function `_mingw_setargv':
e:\p\giaw\src\pkg\mingwrt-4.0.3-1-mingw32-src\bld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/init.c:214: undefined reference to `__mingw_glob'
e:\p\giaw\src\pkg\mingwrt-4.0.3-1-mingw32-src\bld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/init.c:186: undefined reference to `_CRT_glob'
collect2.exe: error: ld returned 1 exit status
--------------------------------------------------
Failed program was:
--------------------------------------------------
int main () { return 0; }
--------------------------------------------------
DIED: No working C compiler found.
MasterNobody
18th November 2013, 17:07
I don't know. Looks like your mingw installation is broken.
LoRd_MuldeR
18th November 2013, 17:40
I don't know. Looks like your mingw installation is broken.
Agreed.
I would recommend to make a clean re-install of MinGW and MSYS with:
MSYS with everything you'll need: http://sourceforge.net/projects/mingwbuilds/files/external-binary-packages/msys%2B7za%2Bwget%2Bsvn%2Bgit%2Bmercurial%2Bcvs-rev13.7z/download
Latest MinGW package (GCC 4.8.1): http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/4.8.1/32-bit/threads-posix/dwarf/x32-4.8.1-release-posix-dwarf-rev5.7z/download
Just unzip the MSYS package to "C:\Dev\MSYS" so that you have "C:\Dev\MSYS\bin\bash.exe" and friends. Also unzip the MinGW package to "C:\Dev\MinGW" so that you have "C:\Dev\MinGW\bin\gcc.exe" and friends.
You also want to add YASM, because otherwise x264 will be built without assembly optimizations and be really slow:
Just grab latest YASM here (http://www.tortall.net/projects/yasm/releases/yasm-1.2.0-win32.exe) and save it to your local computer at "C:\Dev\MSYS\bin\yasm.exe".
Now run "msys.bat" from MSYS directory to open a bash. There type the following to set up everything as needed (the last line checks that GCC is in place):
umount /mingw
mount c:/Dev/MinGW /mingw
gcc -v
BTW: There seems to be some kind of "incompatibility" between x264 and the PThreads implementation that ships with latest MinGW, so I highly recommend using "--enable-win32thread" when you configure x264.
cd /c/Dev
git clone git://git.videolan.org/x264.git
cd x264
./configure --enable-win32thread --disable-opencl
make
Groucho2004
18th November 2013, 17:40
Things are pretty straightforward using this guide (http://doom10.org/index.php?topic=26.0).
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.