[mb-devel] Building/developing with Picard on Windows
Philipp Wolfer
ph.wolfer at googlemail.com
Sat Jul 2 12:16:58 UTC 2011
Hi Chad,
setting up a complete build environment for Picard on Windows can be
quite a hassle. You can either use MingW as in the guide above or use
Visual Studio 2008. But to build ffmpeg you need MingW anyway.
Below some answers to your questsions:
On Sat, Jul 2, 2011 at 11:53 AM, Chad Wilson <chad.wilson at gmx.net> wrote:
> So anyway, it seems to me that the Windows dev setup/build instructions
> for Python are pretty, err, patchy at the moment. I'd like to help
> improve them. I've been working from the INSTALL.txt and
> http://wiki.musicbrainz.org/How_To_Build_Picard_For_Windows and trying
> to fill in the gaps.
I always wanted to update the install instructions above, I have
attached my pesonal updated notes for building, but they are
incomplete and they would need to be verified. I don't know when I
will merge them with the current wiki page.
> I have a few questions as a result of where I'm up to now. I can run and
> debug Picard with python tagger.py but libofa/ffmpeg aren't working;
> python dies if I try a scan, so I've obviously done something wrong. I
> imagine my questions below may highlight what that is!
Happened frequently for me. In my experience the version of GCC used
to build ffmpeg is the key factor. With the wrong version it might
even compile but crash on runtime. The last time I tried a few months
ago I used GCC 4.5 which seemed to work. For Picard 0.12 I had been
using GCC 4.2, I remember that neither 4.1 nor 4.3 did produce stable
binaries. I don't know which version Lukas used for the current
release.
For the Picard 0.12 release I uploaded the compiled version of ffmpeg
to http://users.musicbrainz.org/~outsidecontext/ . They should still
work for a development setup, maybe you can try those. Lukas might
have newer builds available.
> Please bear with me if they appear stupid :)
>
> 0) I've made some changes to
> http://wiki.musicbrainz.org/How_To_Build_Picard_For_Windows - if someone
> could review to see if they're misleading, it'd be appreciated.
Looks ok to me.
> Building ffmpeg 0.5.2 was difficult for me. The prebuilt historic 0.5.2
> win32 shared-dev versions appear to be difficult to find now.
One disadvantage of the pre-compiled ffmpeg versions you sometimes
find is, that they are quite large. For the release versions of Picard
we therefore always used a custom build ffmpeg which only includes
> 1) excuse my likely ignorance, but for the purposes of Picard is it a
> problem to just use the DLLs directly ? I note that Phillipp's guide
> above appears to do this, and this is what I eventually did too. When
> building ffmpeg with MSYS I get errors building the .libs as make
> appears to want to use MS' lib.exe for this purpose, which I don't have
> available. Is it OK without?
I think as long as you use GCC in MingW for everything you don't need
them. If you would use Visual Studio the lib files would be required.
> 2) which begs the question of whether one really needs to build ffmpeg
> DLLs, or can just just existing DLLs?
At least newer GCC seemed to be able to do so.
> 3) the build.cfg generated by setup.py still expects .libs. If DLLs are
> sufficient is it possible to change this?
I always manually changed the build.cfg, but it would of course be
better to automate this if possible.
> 4) FFmpeg 0.6.1 and 0.7 appear to not work - there's a patch at
> http://bugs.musicbrainz.org/ticket/5939 but I guess it should be
> #ifdefed around ffmpeg versions. Not sure if it fully works either.
> Anyone know of any need for/advantage to move to a newer ffmpeg version?
I always tried to use the latest ffmpeg since in my expeience the
newer the version the less problems it has with reading files. But
it's a rapidly changing library and the devs have some habit of
deprecating existing APIs quickly. And you would really need to follow
the development closely to see the changes and benefits. So if the
build works today it might not work tomorrow with the same setup :D
> 5) is DirectShow ever required now?
No
> 6) When building the package with ndist, should I just manually copy the
> DLLs it looks for into the Picard source root, (libfftw, python27 etc
> etc) or have I got my path setup wrongly so it can't find these?
That's what I always did, I found not other way that worked for me.
--
Philipp
-------------- next part --------------
BuildingPicardOnWin32
= How to build Picard for Windows =
== Disclaimer ==
This HowTo is work in progress and terribly incomplete. Currently it is more a collection of notes which can help you to build Picard on Windows, but it is not a real step by step instruction.
== About ==
This HowTo explains the process of building the Picard installer for Windows from source using the MinGW or Visual Studio build environment. This guide will show the complete process of building a Picard release from the ground up.
== Install dependencies ==
=== Python ===
Download and install [http://python.org/download/ Python 2.6]. I recommend to use the MSI installer package. For this guide Python 2.6.6 was used. Do not use Python 3, Picard does not support it.
=== PyQt 4 ===
Download and install [http://www.riverbankcomputing.co.uk/software/pyqt/download PyQt 4] using the Windows installer package for the Python version you have installed (PyQt-Py2.6-gpl-4.x.y-n.exe). For this guide PyQt 4.8.2-2 was used.
=== Mutagen ===
Download the latest tarball of [http://code.google.com/p/mutagen/downloads/list Mutagen] (at the time of writing the latest version is 1.20) and extract the archive somewhere. Open a command prompt, change to the directory where you have unpacked Mutagen and run the following commands:
setup.py build
setup.py install
=== GNU gettext ===
Download and install [http://gnuwin32.sourceforge.net/packages/gettext.htm GNU gettext]. For this guide GNU gettext 0.14.4 was used. In order to use gettext from the command prompt you must add the bin directory of the GNU gettext installation to your PATH variable. On the command prompt you can run:
set PATH=%PATH%;%PROGRAMFILES%\GnuWin32\bin
=== Bazaar ===
You need the Bazaar revision control system to download the latest source code of Picard. If you only want to compile the release version of Picard you can just download the latest Picard source package from the [http://musicbrainz.org/doc/PicardDownload download page]. Otherwise download and install [http://wiki.bazaar.canonical.com/Download Bazaar].
== Install a compiler ==
Picard includes some Python modules which require a C/C++ compiler to build. You can either use the Microsoft compiler by installing Visual Studio 2008 or you can use GCC by installing MinGW. To simply run Picard the easiest way is probably to install the free Visual C++ 2008 Express Edition. If however you plan to compile all of Picard's dependencies in order to package Picard you must use MinGW to compile ffmpeg since ffmpeg can not be compiled with the Microsoft compiler. The official Picard builds use ffmpeg build with MinGW and everything else build with Visual Studio 2008.
=== Visual Studio 2008 ===
If you own a copy of Visual Studio 2008 you can use that. If not you can download and install the free version [http://www.microsoft.com/express/Downloads/#Visual_Studio_2008_Express_Downloads Visual C++ 2008 Express Edition].
=== MinGW and MSYS ===
To install [http://www.mingw.org MinGW] download and install the [http://sourceforge.net/downloads/mingw/Automated%20MinGW%20Installer/ automated MinGW installer]. For this guide the current version of MinGW with GCC 4.5.0 was used. See [http://www.mingw.org/wiki/InstallationHOWTOforMinGW this guide] for installation details.
Make sure you select the C++ Compiler, MSYS Basic System and the MinGW Developer Toolkit during the installation process.
TODO: Install YASM exe to mingw/bin
== Testrun Picard ==
If all of the above dependencies have been installed you can now testrun Picard. Fingerprinting will be disabled, though, but we will fix that later.
=== Get the source ===
To use the latest release version of Picard download the latest source tarball from the [http://musicbrainz.org/doc/PicardDownload download page]. For the latest development source code open a command prompt and run:
bzr branch lp:picard
=== Run Picard from source ===
Either open a Visual Studio 2008 Command Prompt or a MinGW shell and go to the directory where you have the Picard source code. From there run:
setup.py build_ext -i
setup.py build_locales -i
tagger.py
== Compiling with MinGW ==
For all the below instructions you should open a MinGW shell window. I recommend you create a build directory where you place all the build results. The examples below will use C:\build\mingw for that.
=== Compiling ffmpeg ===
It is recommended to use the latest development version when compiling ffmpeg. The latest version can be obtained using [http://subversion.apache.org/ Subversion]. To checkout the latest source code run the following command (or use [http://tortoisesvn.net/ TortoiseSVN]):
svn co svn://svn.ffmpeg.org/ffmpeg/trunk
To minimize the size of ffmpeg you should configure it to include no video and only the audio formats supported by Picard. Since the necessary configure command is quite long you can download and use the script [http://users.musicbrainz.org/~outsidecontext/configure-ffmpeg-for-picard.sh configure-ffmpeg-for-picard.sh]. Download the script, place it in the ffmpeg source directory and make it executable with
chmod +x configure-ffmpeg-for-picard.sh
TODO: Set path for lib.exe
export PATH=$PATH:"$PROGRAMFILES\\Microsoft Visual Studio 9.0\\VC\\bin"
Make sure to adapt the build directory C:\build\mingw inside the files to your needs. To build ffmpeg run:
./configure-ffmpeg-for-picard.sh
make
make install
=== Compiling libofa ===
TODO
=== Compiling libdiscid ===
Get the source
Apply the patch from [http://bugs.musicbrainz.org/ticket/5255 ticket #5255].
Prepare the configure script (only for SVN):
libtoolize --force --copy
aclocal
autoconf
automake
Compile libdiscid
export CFLAGS=-mno-cygwin
export LDFLAGS=-Wl,--add-stdcall-alias
./configure --prefix=C:/build/mingw
make
make install
=== Compiling Picard ===
Configure Picard by running:
setup.py config
Replace build.cfg with the one below
[directshow]
libs =
cflags =
[libofa]
libs = -LC:\MinGW\lib -LC:\build\mingw\lib libofa.dll
cflags = -IC:\MinGW\include -IC:\build\mingw\include
[avcodec]
libs = -LC:\MinGW\lib -LC:\build\mingw\lib avcodec-52.dll avformat-52.dll avutil-50.dll
cflags = -IC:\MinGW\include -IC:\build\mingw\include
[build]
with-directshow = False
with-avcodec = True
with-libofa = True
Build Picard:
setup.py build_ext -i
setup.py build_locales -i
Run Picard:
tagger.py
== Compiling with Visual Studio ==
For all the below instructions you should open a Visual Studio 2008 Command Prompt window. I recommend you create a build directory where you place all the build results. The examples below will use C:\build\vs for that.
=== Compiling ffmpeg ===
ffmpeg can not be compiled with ffmpeg. You must use MinGW as described above. Alternatively you can download the [http://users.musicbrainz.org/~outsidecontext/ ffmpeg binaries] that were used for the official Picard releases. Place the files from the zip archive in C:\build\vs.
=== Compiling libofa ===
TODO
=== Compiling libdiscid ===
TODO
=== Compiling Picard ===
Configure Picard by running:
setup.py config
maybe use -LC:\build\vs\lib -IC:\build\vs\include
Replace build.cfg with the one below
[directshow]
libs = strmiids.lib
cflags =
[libofa]
libs = /LIBPATH:C:\build\vs\lib libofa.lib
cflags = -IC:\build\vs\include
[avcodec]
libs = /LIBPATH:C:\build\vs\lib avformat.lib avcodec.lib avutil.lib
cflags = /IC:\build\vs\include
[build]
with-directshow = False
with-avcodec = True
with-libofa = True
Build Picard:
setup.py build_ext -i
setup.py build_locales -i
Run Picard:
tagger.py
== Build a Picard installer package ==
=== Install py2exe and NSIS ===
In order to build a Picard installer package you have to install [http://www.py2exe.org/ py2exe] and [http://nsis.sourceforge.net/Download NSIS]. For this guide py2exe 0.6.9 and NSIS 2.46 were used.
Copy relevant DLLs into Picard main folder
=== Build the installer with MinGW ===
setup.py config --compiler mingw32 -LC:\MinGW\lib -LC:\build\mingw\lib -IC:\MinGW\include -IC:\build\mingw\include
setup.py build --compiler mingw32 bdist_nsis
=== Build the installer with Visual Studio ===
setup.py config -LC:\build\vs\lib -IC:\build\vs\include
setup.py build bdist_nsis
NOTE: sdtint.h and inttypes.h missing
More information about the MusicBrainz-devel
mailing list