libass.a made by HandBrake has undefined symbols for x86_64

Jeffrey Jay Hayes vulcan_ at me.com
Fri Jun 6 06:26:56 PDT 2014


HI folks

I documented an issue in TRAC "libass.a made by HandBrake has undefined symbols for x86_64"

The key evidence the issue is this, the linking results at the end of the build process:
--
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.
First, the command that shows the problem (redacted to be readable)

Note that all paths have local/var/macports/build/_opt_local_var_macports_sources_mse.uk.rsync.macports.org_rsync.macports.org_release_tarballs_ports_aqua_HandBrake/HandBrake/work removed

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
we see the -lass that is referring to the libass.a made by HandBrake in the contribs/lib subdirectory.

the resulting error is

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)
...
I show only 2 of the 20+ undefined symbols in the list, seemingly all from ass_shaper.o

the final msg is

ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
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

the HandBrake build failed at the same place.

I tried drilling down to the libass directory and doing make cleanand then maketo see if that would give any insight as to how the library was built. The following build of HandBrake failed in the same way. 

--
My own detective work revealed that the problem is unresolved symbols from harfbuzz

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.

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  "_hb_buffer_add_utf32" ), 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.

still no change.

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  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.

so now that I have harfbuzz install .. why is the build still not finding the library ?

suggestions ?


--
Jeff Hayes is vulcan_
vulcan_ at mac.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-users/attachments/20140606/c33fa52e/attachment.html>


More information about the macports-users mailing list