Cross Compile Win32 - How To Guide

Useful and helpful Windows specific command line samples and examples.
hnraysir
Posts: 5
Joined: Mon Mar 18, 2013 6:06 am

Re: Cross Compile Win32 - How To Guide

Post by hnraysir » Mon Apr 15, 2013 1:49 am

thx,In your 3.2.3 version,I found this:
" --threads=LIB compile with support for thread LIB (winpthreads,
pthreads-w32, disable) [winpthreads]"
winpthreads is the default thread.
so should I use "--threads=pthreads-w32" to compile the toolchain?
also I found in ffmpeg 1.2 's configure script
--disable-pthreads disable pthreads [auto]
--disable-w32threads disable Win32 threads [auto]
--disable-os2threads disable OS/2 threads [auto]
what the differences between "pthreads","w32threads","winpthreads",and "pthread-w32" "winpthread".confused.
also I can't find the option "--pkg-config="

I follow the instruction step by step,It goes well untill i do "sudo make install"."make"is succeed and produced ffmpeg.exe.
the error is :
STRIP install-libavdevice-shared
/bin/sh: 1: i686-w64-mingw32-strip: not found
make: *** [install-libavdevice-shared] Error 127

I used these commands:
sudo apt-get remove ffmpeg x264 libav-tools libvpx-dev libx264-dev yasm

sudo apt-get update

sudo apt-get -y install autoconf automake build-essential checkinstall git \
libsdl1.2-dev libspeex-dev libtool libva-dev libvdpau-dev \
libx11-dev libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev \
cvs yasm subversion flex bison texinfo

bash ./mingw-w64-build-3.2.3 --threads=pthreads-w32

export PATH="/home/ray/software/mingw-w64/mingw-w64-i686/bin:$PATH"

PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" LDFLAGS="-L/usr/local/lib" \
CFLAGS="-I/usr/local/include" ./configure --pkg-config=pkg-config --prefix="/usr/local" \
--enable-memalign-hack --arch=x86 --target-os=mingw32 --cross-prefix=i686-w64-mingw32- --enable-gpl \
--disable-ffplay --enable-shared

make

sudo make install //error occured in this command

rogerdpack
Posts: 1876
Joined: Fri Aug 05, 2011 9:56 pm

Re: Cross Compile Win32 - How To Guide

Post by rogerdpack » Mon Apr 15, 2013 11:03 pm

Maybe you need to add another directory to your PATH, like the one that contains
i686-w64-mingw32-strip

(though you could also use this script https://github.com/rdp/ffmpeg-windows-build-helpers which may do the same, but would require a gcc rebuild...

zjacobs
Posts: 9
Joined: Tue May 14, 2013 1:46 pm

Re: Cross Compile Win32 - How To Guide

Post by zjacobs » Tue Jun 11, 2013 9:12 pm

When I try to compile FFmpeg, it isn't able to find the libx264 libraries. When building x264, I ran:

Code: Select all

make distclean

/home/<userid>/source/x264/configure --host=i686-w64-mingw32 --cross-prefix=i686-w64-mingw32- --prefix="/home/<userid>/software/packages/win32"

make install; make install-lib-dev; make install-lib-static
libx264 libs are installed correctly:

Code: Select all

~/software/packages/win32$ ls *
bin:
libx264-133.dll  x264.exe

include:
x264_config.h  x264.h

lib:
libx264.a  libx264.dll.a  pkgconfig
environmental variables are set:

Code: Select all

~/source/FFmpeg$ echo $PKG_CONFIG_PATH $LDFLAGS $CFLAGS
/home/zjacobs/software/packages/win32/lib/pkgconfig -L/home/zjacobs/software/packages/win32/lib -I/home/zjacobs/software/packages/win32/include
but when I try to build ffmpeg, libx264 can't be found:

Code: Select all

./configure --enable-memalign-hack --arch=x86 --target-os=mingw32 --cross-prefix=x86_64-w64-mingw32- --pkg-config=pkg-config --prefix="/home/zjacobs/software/packages/win32" --enable-libx264 --enable-gpl --enable-nonfree --disable-w32threads

ERROR: libx264 not found

If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
[email protected] mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help
solving the problem.

zjacobs
Posts: 9
Joined: Tue May 14, 2013 1:46 pm

Re: Cross Compile Win32 - How To Guide

Post by zjacobs » Wed Jun 12, 2013 12:11 pm

Nevermind, I got it to work. I assumed the LDFLAGS and CFLAGS would automatically get added when running the ./configure script. This worked:

Code: Select all

./configure --enable-memalign-hack --arch=x86 --target-os=mingw32 --cross-prefix=x86_64-w64-mingw32- --pkg-config=pkg-config --extra-cflags=${CFLAGS} --extra-ldflags=${LDFLAGS} --prefix="/home/zjacobs/software/packages/win32" --enable-gpl --enable-nonfree --disable-w32threads --enable-libx264

rogerdpack
Posts: 1876
Joined: Fri Aug 05, 2011 9:56 pm

Re: Cross Compile Win32 - How To Guide

Post by rogerdpack » Fri Oct 11, 2013 4:17 pm

zjacobs wrote:Nevermind, I got it to work. I assumed the LDFLAGS and CFLAGS would automatically get added when running the ./configure script. This worked:

Code: Select all

./configure --enable-memalign-hack --arch=x86 --target-os=mingw32 --cross-prefix=x86_64-w64-mingw32- --pkg-config=pkg-config --extra-cflags=${CFLAGS} --extra-ldflags=${LDFLAGS} --prefix="/home/zjacobs/software/packages/win32" --enable-gpl --enable-nonfree --disable-w32threads --enable-libx264
They should be "auto added" are they not?

puck
Posts: 9
Joined: Fri Jul 08, 2011 5:36 am

Re: Cross Compile Win32 - How To Guide

Post by puck » Sun Mar 23, 2014 11:23 am

rogerdpack wrote:(though you could also use this script https://github.com/rdp/ffmpeg-windows-build-helpers which may do the same, but would require a gcc rebuild...
Hi All,

I needed a new version of FFmpeg after all this time.
I'm Glad I did :D I have to thank Roger Pack for his fine piece of coding of cross_compile_ffmpeg.sh

I bypassed my own guide and tried above script. All went without a hitch.

Regards
Mark
Regards,
Mark

(Experience is something you don't get until just after you need it.)

bublina
Posts: 6
Joined: Thu Oct 10, 2013 2:22 pm

Re: Cross Compile Win32 - How To Guide

Post by bublina » Thu Dec 31, 2015 8:49 pm

hnraysir wrote: I follow the instruction step by step,It goes well untill i do "sudo make install"."make"is succeed and produced ffmpeg.exe.
the error is :
STRIP install-libavdevice-shared
/bin/sh: 1: i686-w64-mingw32-strip: not found
make: *** [install-libavdevice-shared] Error 127
This is an annoying feature of some distros, that sudo changes $PATH

more here:

http://stackoverflow.com/questions/2576 ... s-path-why

madskillz
Posts: 11
Joined: Mon Dec 12, 2016 11:22 pm

Re: Cross Compile Win32 - How To Guide

Post by madskillz » Tue Dec 27, 2016 8:08 am

Hi

How to build lua5.1 with the method posted by OP.

what changes to makefile ? etc

Regards

Post Reply
'