<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">HI folks<div><br></div><div>I documented an issue in TRAC "<a href="https://trac.macports.org/ticket/43900">libass.a made by HandBrake has undefined symbols for x86_64</a>"</div><div><br></div><div>The key evidence the issue is this, the linking results at the end of the build process:</div><div>--</div><div>on Lion (Mac OS X 10.7.5) i see a problem doing "port -v install 
handbrake". Extracting the relevant failure details from the log.
I have XCode 4.6 installed and am using the command line tools that come
 with it.</div><div><p>
First, the command that shows the problem (redacted to be readable)
</p><p>
Note that all paths have <tt>local/var/macports/build/_opt_local_var_macports_sources_mse.uk.rsync.macports.org_rsync.macports.org_release_tarballs_ports_aqua_HandBrake/HandBrake/work</tt> removed
</p>
<pre class="wiki">Ld /opt/../HandBrake-0.9.8/build/xroot/HandBrakeCLI normal x86_64
    cd /opt/../HandBrake-0.9.8/macosx
    setenv MACOSX_DEPLOYMENT_TARGET 10.7
    /usr/bin/clang++ -arch x86_64 
-L/opt/../HandBrake-0.9.8/build/xroot
-L/opt/../HandBrake-0.9.8/build/libhb
-L/opt/../HandBrake-0.9.8/build/contrib/lib 
-F/opt/../HandBrake-0.9.8/build/xroot -filelist /opt/../HandBrake-0.9.8/build/xroot/HandBrakeCLI.build/Objects-normal/x86_64/HandBrakeCLI.LinkFileList -mmacosx-version-min=10.7 -framework AudioToolbox -framework IOKit -framework CoreServices -liconv -lbz2 -lz -lhb -la52 '''-lass''' -lavcodec -lavformat -lavutil -lbluray -ldca -ldvdnav -ldvdread -lfaac -lfontconfig -lfreetype -lfribidi -lmkv -lmp3lame -lmp4v2 -lmpeg2 -logg -lsamplerate -lswscale -ltheora -lvorbis -lvorbisenc -lx264 -lxml2 
-o /opt/../HandBrake-0.9.8/build/xroot/HandBrakeCLI
</pre><p>
we see the -lass that is referring to the <tt>libass.a</tt> made by HandBrake in the contribs/lib subdirectory.
</p><p>
the resulting error is 
</p>
<pre class="wiki">Undefined symbols for architecture x86_64:
  "_hb_buffer_add_utf32", referenced from:
      _shape_harfbuzz in libass.a(ass_shaper.o)
  "_hb_buffer_create", referenced from:
      _shape_harfbuzz in libass.a(ass_shaper.o)
...
</pre><p>
I show only 2 of the 20+ undefined symbols in the list, seemingly all from ass_shaper.o
</p><p>
the final msg is 
</p>
<pre class="wiki">ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
</pre><p>
thinking that libass.a might be the one in /opt/local/lib, which comes 
in with ffmpeg, I thought to remove it by uninstalling ffmpeg 
@2.2.2_1+gpl2+nofree
</p><p>
the HandBrake build failed at the same place.
</p><p>
I tried drilling down to the libass directory and doing <tt>make clean</tt>and then <tt>make</tt>to see if that would give any insight as to how the library was built. The following build of HandBrake failed in the same way.&nbsp;</p></div><div>--</div><div>My own detective work revealed that the problem is unresolved symbols from harfbuzz</div><div><br></div><div>the thing is that HandBrake uses its own version of libass in its build, ignoring anything in the system or in MacPorts, which means even after installing a different port that puts a copy of this library into /opt/local/lib the HandBrake build still fails.</div><div><br></div><div>the unresolved symbols are coming from ass_shaper.c which is trying to use functions from harfbuzz (which is the reason for the _hb_ at the start of the symbols like&nbsp;<span class="Apple-style-span" style="font-family: monospace; white-space: pre; "> "_hb_buffer_add_utf32" </span>), a font manipulation utility, and this harfbuzz things was not on my system .. but it is a port in Macports, so I installed it too.</div><div><br></div><div>still no change.</div><div><br></div><div>I see in the ass_shaper.c code and there is a conditional compile flag controlling the inclusion of hb_ft.h and the use of &nbsp;the functions and symbols .. it is obviously set, but the header file must be found as the compile is succeeding, it is only in the last linking step that the unresolved symbols show up.</div><div><br></div><div>so now that I have harfbuzz install .. why is the build still not finding the library ?</div><div><br></div><div>suggestions ?</div><div><br></div><div><br></div><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Bookman Old Style'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Bookman Old Style'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div style="font-family: Helvetica; font-size: 12px; ">--</div><div>Jeff Hayes is vulcan_</div><div style="font-family: Helvetica; font-size: 12px; "><a href="mailto:vulcan_@mac.com">vulcan_@mac.com</a></div></div></div></span></span>
</div>

<br></body></html>