Opened 12 years ago

Last modified 6 years ago

#36667 assigned defect

HandBrakeCLI @0.10.0_0: cannot link to libiconv

Reported by: stanimura Owned by: larryv (Lawrence Velázquez)
Priority: Normal Milestone:
Component: ports Version: 2.1.2
Keywords: snowleopard Cc: chantivlad@…, jpenney (Jason Penney), kevin.krouse@…, ryandesign (Ryan Carsten Schmidt), macports@…
Port: HandBrakeCLI

Description (last modified by ryandesign (Ryan Carsten Schmidt))

HandBrake 0.9.8 would not be built on MacPorts 2.1.2 and MacOSX 10.7.5. It seems a problem involved in linker command.

$ uname -v
Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64
$ gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)

Extracts from main.log

info:build Undefined symbols for architecture x86_64:
:info:build   "_libiconv_close", referenced from:
:info:build       _decsrtClose in libhb.a(decsrtsub.o)
:info:build       _FcSfntNameTranscode in libfontconfig.a(fcfreetype.o)
:info:build       _xmlFindCharEncodingHandler in libxml2.a(encoding.o)
:info:build       _xmlCharEncCloseFunc in libxml2.a(encoding.o)
:info:build   "_libiconv", referenced from:
:info:build       _decsrtWork in libhb.a(decsrtsub.o)
:info:build       _FcSfntNameTranscode in libfontconfig.a(fcfreetype.o)
:info:build       _xmlIconvWrapper in libxml2.a(encoding.o)
:info:build   "_libiconv_open", referenced from:
:info:build       _decsrtInit in libhb.a(decsrtsub.o)
:info:build       _FcSfntNameTranscode in libfontconfig.a(fcfreetype.o)
:info:build       _xmlFindCharEncodingHandler in libxml2.a(encoding.o)
:info:build ld: symbol(s) not found for architecture x86_64
:info:build clang: error: linker command failed with exit code 1 (use -v to see invocation)
:info:build 
:info:build 
:info:build ** BUILD FAILED **
:info:build 
:info:build 
:info:build The following build commands failed:
:info:build     Ld /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_aqua_HandBrake/HandBrake/work/HandBrake-0.9.8/build/xroot/HandBrakeCLI normal x86_64
:info:build (1 failure)
:info:build make: *** [macosx.build] Error 65

Attachments (1)

main.log (1.9 MB) - added by stanimura 12 years ago.

Download all attachments as: .zip

Change History (17)

Changed 12 years ago by stanimura

Attachment: main.log added

comment:2 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)
Summary: HandBrake 0.9.8_0 build failed (linker)HandBrake: Undefined symbols _libiconv_close _libiconv _libiconv_open

comment:3 Changed 12 years ago by chantivlad@…

Cc: chantivlad@… added

Cc Me!

comment:4 Changed 12 years ago by jmroot (Joshua Root)

This is usually due to using the headers from the MacPorts version of libiconv and the library from the system version, or vice versa.

comment:5 Changed 12 years ago by jpenney (Jason Penney)

Cc: jpenney@… added

Cc Me!

comment:6 Changed 12 years ago by kevin.krouse@…

Cc: kevin.krouse@… added

Cc Me!

comment:7 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign@… added

comment:ticket:37434:6 states that upgrading to Xcode 4.5.2 fixes this problem. Can anyone here confirm? Be sure to also upgrade the version of the command line tools; to do that, open Xcode app, go to the Preferences window, and go to the Downloads section. Before you do so, please tell us what version of Xcode you had before that would not build HandBrake.

comment:8 in reply to:  7 ; Changed 12 years ago by chantivlad@…

Replying to ryandesign@…:

comment:ticket:37434:6 states that upgrading to Xcode 4.5.2 fixes this problem. Can anyone here confirm? Be sure to also upgrade the version of the command line tools; to do that, open Xcode app, go to the Preferences window, and go to the Downloads section. Before you do so, please tell us what version of Xcode you had before that would not build HandBrake.

I have XCode 4.2.1 build 4D502 and have the linking problem. I will update XCode and let you know if it helps.

comment:9 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Knowing the version of clang you're seeing the problem with (run "clang -v") would be even more helpful than the Xcode version; I should have asked for that before.

comment:10 in reply to:  9 Changed 12 years ago by chantivlad@…

Replying to ryandesign@…:

Knowing the version of clang you're seeing the problem with (run "clang -v") would be even more helpful than the Xcode version; I should have asked for that before.

Apple clang version 3.0 (tags/Apple/clang-211.12) (based on LLVM 3.0svn) Target: x86_64-apple-darwin11.4.2 Thread model: posix

Version 0, edited 12 years ago by chantivlad@… (next)

comment:11 in reply to:  8 Changed 12 years ago by chantivlad@…

Replying to chantivlad@…:

Replying to ryandesign@…:

comment:ticket:37434:6 states that upgrading to Xcode 4.5.2 fixes this problem. Can anyone here confirm? Be sure to also upgrade the version of the command line tools; to do that, open Xcode app, go to the Preferences window, and go to the Downloads section. Before you do so, please tell us what version of Xcode you had before that would not build HandBrake.

I have XCode 4.2.1 build 4D502 and have the linking problem. I will update XCode and let you know if it helps.

I activated XCode Version 4.5.2 (4G2008a) and removed 4.2.1, but this did not help.

comment:12 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

And you updated the command line tools and now have a newer version of clang? And you cleaned the HandBrake port before trying again?

comment:13 in reply to:  12 Changed 12 years ago by chantivlad@…

Replying to ryandesign@…:

And you updated the command line tools and now have a newer version of clang? And you cleaned the HandBrake port before trying again?

I did clean the HandBrake port before trying again but had not updated the command line tools.

So after installing the XCode command line tools (OS X Lion) for XCode - November 2012 (xcode452cltools10_76938212a.dmg):

$ clang --version
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.2
Thread model: posix
$ sudo port clean handbrake
$ sudo port -d install handbrake
[...]
make[5]: Nothing to be done for `all-am'.
Making all in example
/Applications/Xcode.app/Contents/Developer/usr/bin/llvm-gcc-4.2 -DHAVE_CONFIG_H -I. -I.. -I../include -I../include -I./include    -arch x86_64 -mmacosx-version-min=10.7 -arch x86_64  -arch x86_64 -mmacosx-version-min=10.7 -arch x86_64 -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -c gjobread.c
cc1: warning: -Wuninitialized is not supported without -O
/bin/sh ../libtool --tag=CC   --mode=link /Applications/Xcode.app/Contents/Developer/usr/bin/llvm-gcc-4.2  -arch x86_64 -mmacosx-version-min=10.7 -arch x86_64 -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls  -arch x86_64 -mmacosx-version-min=10.7 -arch x86_64 -o gjobread gjobread.o ../libxml2.la  -lz -liconv -lm  
libtool: link: /Applications/Xcode.app/Contents/Developer/usr/bin/llvm-gcc-4.2 -arch x86_64 -mmacosx-version-min=10.7 -arch x86_64 -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -arch x86_64 -mmacosx-version-min=10.7 -arch x86_64 -o gjobread gjobread.o  ../.libs/libxml2.a -lz -liconv -lm
Making all in xstc
make[4]: Nothing to be done for `all'.
touch contrib/libxml2/.stamp.build
Showing first 200 notices only


** BUILD FAILED **


The following build commands failed:
	ExternalBuildToolExecution external
(1 failure)
make: *** [macosx.build] Error 65
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_aqua_HandBrake/HandBrake/work/HandBrake-0.9.8/build'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_aqua_HandBrake/HandBrake/work/HandBrake-0.9.8/build" && /usr/bin/make -j4 -w 
Exit code: 2
Error: org.macports.build for port HandBrake returned: command execution failed
DEBUG: Error code: CHILDSTATUS 40368 2
DEBUG: Backtrace: command execution failed
    while executing
"system -nice 0 $fullcmdstring"
    ("eval" body line 1)
    invoked from within
"eval system $notty $nice \$fullcmdstring"
    invoked from within
"command_exec build"
"command_exec build"
    (procedure "portbuild::build_main" line 8)
    invoked from within
"$procedure $targetname"
Warning: targets not executed for HandBrake: org.macports.activate org.macports.build org.macports.destroot org.macports.install
Please see the log file for port HandBrake for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_aqua_HandBrake/HandBrake/main.log
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
Error: Processing of port handbrake failed

So it seems the linking error with libiconv has disapeeared indeed. I'll have to investigate why it is still failing. Thanks for the help.

comment:14 Changed 10 years ago by larryv (Lawrence Velázquez)

Owner: changed from macports-tickets@… to larryv@…
Port: HandBrakeCLI added; HandBrake removed
Status: newassigned

After r132827, this is only a problem with HandBrakeCLI on Snow Leopard. (HandBrake cannot build on Snow Leopard at all.) Leaving this open until I fix it or give up.

comment:15 Changed 10 years ago by larryv (Lawrence Velázquez)

Keywords: snowleopard added
Summary: HandBrake: Undefined symbols _libiconv_close _libiconv _libiconv_openHandBrakeCLI @0.10.0_0: cannot link to libiconv

comment:16 Changed 10 years ago by macports@…

Cc: macports@… added

Cc Me!

comment:17 Changed 6 years ago by kencu (Ken)

/Developer/usr/bin/g++-4.2 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_multimedia_HandBrake/HandBrakeCLI/work/HandBrake-0.10.0/build/xroot -L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_multimedia_HandBrake/HandBrakeCLI/work/HandBrake-0.10.0/build/libhb -L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_multimedia_HandBrake/HandBrakeCLI/work/HandBrake-0.10.0/build/contrib/lib -F/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_multimedia_HandBrake/HandBrakeCLI/work/HandBrake-0.10.0/build/xroot -filelist /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_multimedia_HandBrake/HandBrakeCLI/work/HandBrake-0.10.0/build/xroot/HandBrakeCLI.build/Objects-normal/x86_64/HandBrakeCLI.LinkFileList -mmacosx-version-min=10.6 -filelist /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_multimedia_HandBrake/HandBrakeCLI/work/HandBrake-0.10.0/build/macosx/osl.filelist.txt -framework AudioToolbox -framework CoreServices -framework IOKit -lbz2 -liconv -lz -lhandbrake -lass -lavcodec -lavformat -lavresample -lavutil -lbluray -ldvdnav -ldvdread -lfontconfig -lfreetype -lfribidi -lmp3lame -logg -lsamplerate -lswscale -ltheora -lvorbis -lvorbisenc -lvpx -lx264 -lxml2 -prebind -o /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_multimedia_HandBrake/HandBrakeCLI/work/HandBrake-0.10.0/build/xroot/HandBrakeCLI

Undefined symbols:
  "_libiconv_close", referenced from:
      _decsrtClose in libhandbrake.a(decsrtsub.o)
  "_x264_encoder_open_142", referenced from:
      _encx264Init in libhandbrake.a(encx264.o)
  "_libiconv", referenced from:
      _decsrtWork in libhandbrake.a(decsrtsub.o)
  "_libiconv_open", referenced from:
      _decsrtInit in libhandbrake.a(decsrtsub.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
** BUILD FAILED **

this error on 10.6.8 occurs because xcodebuild is trying link against the libiconv.dylib in the SDK

$ nm libiconv.dylib | grep close
                 U _fclose
000000000000bd17 T _iconv_close

instead of the one in `/opt/local/lib'

$ nm libiconv.dylib | grep close
000000000000c927 T _libiconv_close

So xcodebuild has to be forced to use the link libraries in /opt/local/lib preferentially, and fall back to the SDK.

Note: See TracTickets for help on using tickets.