Page 1 of 1

Handbrake Compilation story

Posted: Sun May 10, 2009 10:59 pm
by fred_be9300
I compiled Handbrake yesterday for the first time. I followed the wiki instructions to the letter, and apart from a very minor adjustment here and there, it worked without issues. I just wanted to leave a trace of what I did, in case it helps anyone ;-) There's 1 or 2 things that could be used to correct the wiki.

I did everything in a Virtual Machine (Virtual PC 2007 SP1): guest OS = 100% fresh Win XP SP3 with all security updates installed.

The surprise headlines (a.k.a: what I didn't read anywhere else)
- I used a separate Cygwin partition (a fixed size virtual HD), which I initially sized too small. You'll need at least ~3.0 GB (I first sized at 2.0 GB, but ran out of space during GCC compile. Resizing a VHD isn't a standard operation...).
- Visual C# 2008 SP1 Express Edition also needs around 800 MB I believe, most of it wants to go on drive C:
- You need time! All together, I believe the Cygwin preparation was maybe 3-4 hours (I went away at some point, esp. GCC compile takes time - I also lost time due to mistakes I made). The Handbrake CLI took around 2 hours to compile. No doubt it was slower for me using Virtual PC.

Disclaimer: I'm fairly technical in IT, and I do have a (theoretical) software dev training, but in this case, I'm a newb regarding all things involved.

* the only thing not mentioned in wiki, was to install QuickTime. Without that, build failed with some errors/warnings about QTOControlLib and AxQTOControlLib (or so) missing.

* I made a mistake in the Cygwin install, accidentally forgetting the mandatory bison and byacc. Wiki has a cygcheck command that can help you verify the cygwin install, but it's not complete. This one is (more) complete:

Code: Select all

cygcheck -c autoconf automake bash binutils bison byacc bzip2 cygutils diffutils \
            gcc gcc-core gcc-java gcc-g++ gzip libbz2-devel libtool m4 make patch patchutils perl \
            nasm subversion  wget  unzip zip 
* I picked up some newer versions of the tools:
Wiki: YASM 0.7.1, Jam2.5, GMP4.2.3, MPFR 2.3.2, GCC 4.2.4
I used: YASM 0.8.0, Jam2.5, GMP4.3.0, MPFR 2.4.1, GCC 4.3.3

Here's download locations for each of these newer versions:

Code: Select all

Note: I'm not saying it's a good idea to use these. I have no clue :wink: I'm saying they're newer, and I was able to build with them. I know there's a newer GCC 4.4.0, but I naively speculated that a .0 release might have a few undiscovered bugs more than a .3)

If you want to stick with the versions mentioned by wiki, note that the mpfr-2.4.0 link in wiki is dead. This one works:

Code: Select all

* After building GMP, I ran a unit test, as (strongly) suggested on their website. Takes a long time though (~ 1 hour?)

Code: Select all

cd gmp-4.3.0 && make check
* the wiki says to build the CLI with

Code: Select all

svn co svn://  HandBrake
cd HandBrake
That last command seemed to do nothing for me at that point. I found another README under "./doc" of the SVN code which offered this command instead. It worked :-)

Code: Select all

./configure --launch
I've copied GUI and CLI into a folder, added cygwin1.dll, and it runs. I haven't actually run an encode, as I have a family visit ;-)

Re: Handbrake Compilation story

Posted: Sun May 10, 2009 11:07 pm
by s55
Note the wiki instructions are for the 0.9.3 source code, not current.

/doc folder contains up to date build instructions.

Re: Handbrake Compilation story

Posted: Sun May 10, 2009 11:23 pm
by fred_be9300
thanks for your reply.

The /doc folder is very light on preparation of Cygwin environment... It has only a few words to say:

Code: Select all

41	   * Cygwin, gcc 4.2.4
43	   * yasm (for i386 or x86_64 architectures)
(+ a list of some more packages needed... not quoted)

So it doesn't mention gmp (which is mentioned as a pre-req in the wiki). Given that GMP took a very long time to compile, I'm compelled to ask: is GMP needed for compiling HB 0.9.4 ?

Re: Handbrake Compilation story

Posted: Sun May 10, 2009 11:35 pm
by s55
It's needed for gcc4.

It's a HB compile guide, not a setup cygwin guide. IT assumes you have the knowledge to be able to figure it out yoursef.

The Wiki cygwin setup part is still relevant even if versions are a tad out of date now.

At some point, all the docs will be updated, but it's really not a priority when no release is soon.

Re: Handbrake Compilation story

Posted: Sun May 10, 2009 11:40 pm
by FalconFour
Virtual PC seems to use pure emulation, so it's exponentially slower than doing it on a real PC. I'm almost done compiling gmp now, although I didn't realize there would be newer versions until I ran into that 404 error and had to dig out a later version.

As for wiki being outdated and /doc being not outdated, well... seems like a worthwhile question, but how would we be able to access /doc without getting to the svn stage of the wiki? There's very spotty information scattered here and there on the site about development and compiling, so maybe it would be beneficial to either keep the wiki more up to date (preferred, imo), or link to the "/doc" somewhere on the site so I could read it...

Either way, thanks for the info! I'd be lost without knowing "./configure --launch" :)

Re: Handbrake Compilation story

Posted: Sun May 10, 2009 11:45 pm
by fred_be9300
Fair enough. Thanks for you help.

I agree the wiki is sufficient to help one to setup cygwin.

While you say doc isn't priority because there's no release, I'd be of the opinion that the absence of a release is likely to stimulate people (me, for one) to try the build themselves ;-) So I just wanted to tell my story - and ideas around the few obstacles I found, in case anyone wants to give it a try.

Re: Handbrake Compilation story

Posted: Sun May 10, 2009 11:56 pm
by FalconFour
fred_be9300 wrote:While you say doc isn't priority because there's no release, I'd be of the opinion that the absence of a release is likely to stimulate people (me, for one) to try the build themselves ;-) So I just wanted to tell my story - and ideas around the few obstacles I found, in case anyone wants to give it a try.
This, exactly. The primary reason for me trying to build this is because of how old the main release is, and I wanted to see what upcoming improvements there were in the SVN. It's also nice to have a natively optimized build as well (it's impressive to see it building for Athlon64 optimization). For lack of compiled snapshots being available, I figured I'm up to the challenge of setting up a build environment and giving it a go! ;)

It'd definitely be a good idea for me to set up a virtual hard drive image and mount it in the cygwin folder, as the folder has already grown beyond 15,000 files! Another neat feature of Win7 is that I can directly mount a virtual hard drive image in disk manager :)

... Finished gmp make and make install, now running make check. And I'm still on battery! :lol:

Re: Handbrake Compilation story

Posted: Mon May 11, 2009 5:10 pm
by jbrjake
I have a draft update for the Mac section of the wiki article sitting in an open text file, but have yet to make the requisite screen shots and do a test-run of the commands as given, etc.

It was a very low priority to me until the new build system finally stabilized a few weeks ago, and now it's just a low priority. Frankly, with the amount of flux the trunk is undergoing at the moment, I don't think it's quite yet ready for attention from people who need a hand with checking code out from the repo and are mostly interested in getting fresher builds to use, not bug testing.
FalconFour wrote:how would we be able to access /doc without getting to the svn stage of the wiki?
As the docs are in the SVN trunk, they are, of course, available on the same Trac you'd be reading the wiki entry on.

Re: Handbrake Compilation story

Posted: Thu May 14, 2009 11:22 pm
by fred_be9300
I see sr55 updated the CompileOnWindows Wiki page (and Cygwin instructions moved to their own page). Nice :-)

this thread may or may not be the best place, but I have 4 (low importance) points of feedback.

1) wget fails for me; but works with http:// (same address)

2) GCC website says "we highly recommend that GCC be built into a separate directory than the sources which does not reside within the source tree." (GCC installation: Steps on [Cygwin] page don't follow this recommendation. I know, there seems to be no ill effect in that. Still, why not do as they say? ;-)

3) previous instructions for WinGUI, said to checkout svn://, new instructions say to check out the entire trunk. I can't help but wonder why. I was able to compile the WinGUI with nothing more than the trunk/win folder. Downloading more than needed... seems like a waste?

4) could better be mentioned: WinGUI compilation requires some DLLs that get installed when you install QuickTime.

hope this helps.

Re: Handbrake Compilation story

Posted: Sat May 16, 2009 3:27 pm
by Northy
hey there,

IDK if this is the right place to post but I'll try in here first :)

I just got an error in compiling and as I haven't seen this error before I have no idea how to fix it, it happens each time I try to compile using the Compile Guide on the Wiki.

Code: Select all

  : ** BUILD FAILED **
  : The following build commands failed:
  : external:
  : 	ExternalBuildToolExecution external
  : HandBrakeCLI:
  : 	Ld ../build/HandBrakeCLI normal i386
  : HandBrake:
  : 	Preprocessing /Users/Alex/.Trash/HandBrake/HandBrake-source/macosx/../build/macosx/ Info.plist
  : 	Ld ../build/ normal i386
  : (4 failures)
  : make: *** [] Error 1
time end: Sat May 16 16:24:26 2009
duration: 37 seconds (37.27s)
result: FAILURE (code 2)
If someone would be so kind as to help me work this out I'd be very grateful :D


P.S If you need the rest of the code that showed up just ask :)

Re: Handbrake Compilation story

Posted: Sat May 16, 2009 3:39 pm
by fred_be9300
this thread so far has been about compiling on Windows. Looks like you're compiling on Mac. I'd suggest opening a new thread.

but word of the wise, developers of Handbrake don't give support on compiling - and they are very vocal about preferring not to spend time on such posts. So if you post, make it clear you hope for advice from your peers more than from the developers. Or wait for a release ;-)

Re: Handbrake Compilation story

Posted: Sat May 16, 2009 3:40 pm
by s55
It's not a supported process, so opening a new thread, isn't going to help anyone.

The docs work and are up to date, so if you can't get it to work, read it again or wait.

Re: Handbrake Compilation story

Posted: Mon May 18, 2009 11:29 pm
by dvd4sign
fred_be9300 -

Any chance of getting a zip file of your completed build? I can't get mine to compile for the life of me. I am currently trying your tweaks.



Re: Handbrake Compilation story

Posted: Sat May 23, 2009 2:02 am
by masterasia
Hi there fred_be9300,

Like you, I have also managed to compile on Win32.

My Env:
Native Windows 7
Cygwin 1.5
Yasm 0.8.0
GCC 4.2.4

after a successful compile, I decided to take a risk and upgraded the GCC compiler to 4.4.0 and compile HB again. the resulting CLI file was 12.9MB (compared with GCC 4.2.4's 11.7MB). Also now the resulting CLI requires a strange naming cygcc_s-sjilj-1.dll instead of the regular cygwin1.dll
I haven't notice any significant improvement in encoding FPS, but GCC 4.4.0 compiles faster. I have not experienced any crashes or bugs with GCC 4.4.0 build yet.

Reading the complie log, I notice alot of warnings were generated by the compiler. I wish I could edit flags in the codes to reflect the new mtune=core2 instead of the march=pentiumpro, or if there's anyway I can force the compiler to use my flags instead.

Comparing HandBrake 0.9.3 to the SVN, there is definitely an increase in encoding FPS.

Although I am still unable to compile HB on my PS3 Linux(YDL or Ubuntu8/9), even though I followed the Linux guide religiously. Damn PPC64 I hate you. My instinct tells me that most of the compile errors are due to the bulit-in GCC compiler being not able to read some of the coding. I think i'm gonna try recompling YASM and GCC on the PS3.

Undocumented Windows Feature I discovered:

You can pause and resume encoding by typing P or R(followed by ENTER key) into the CLI.

Random Handbrake Rant: Linux GUI has Pause button but no easily accessible Stop button, while the WINGUI has no pause button but comes with a stop button.