[MacPorts] #57774: texlive-bin @2018.47642_8 : error: Undefined symbols for architecture x86_64

MacPorts noreply at macports.org
Thu Dec 13 23:06:34 UTC 2018


#57774: texlive-bin @2018.47642_8  : error: Undefined symbols for architecture
x86_64
--------------------------+--------------------
  Reporter:  kencu        |      Owner:  (none)
      Type:  defect       |     Status:  new
  Priority:  Normal       |  Milestone:
 Component:  ports        |    Version:
Resolution:               |   Keywords:
      Port:  texlive-bin  |
--------------------------+--------------------
Description changed by kencu:

Old description:

> On 10.7, and I think likely all systems not configured to use libc++, we
> see:
> {{{
> libtool: link: /opt/local/bin/clang++-mp-5.0 -pipe -Os -std=c++11 -Wno-
> reserved-user-defined-literal -D_GLIBCXX_USE_CXX11_ABI=0 -stdlib
> =macports-libstdc++ -arch x86_64 -Wl,-headerpad_max_install_names -arch
> x86_64 -o .libs/xetex xetexdir/xetex-xetexextra.o synctexdir/xetex-
> synctex.o xetex-xetexini.o xetex-xetex0.o xetex-xetex-pool.o  -framework
> Cocoa libxetex.a -L/opt/local/lib /opt/local/lib/libharfbuzz-icu.dylib
> /opt/local/lib/libharfbuzz.dylib /opt/local/lib/libgraphite2.dylib
> -licui18n -licuuc -licudata -lpthread -lm
> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports
> .org_macports_release_tarballs_ports_tex_texlive-bin/texlive-bin/work
> /texlive-source-2018.47642/libs/teckit/libTECkit.a
> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports
> .org_macports_release_tarballs_ports_tex_texlive-bin/texlive-bin/work
> /texlive-source-2018.47642/libs/poppler/libpoppler.a
> /opt/local/lib/libpng16.dylib /opt/local/lib/libfreetype.dylib -lz
> libmd5.a lib/lib.a
> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports
> .org_macports_release_tarballs_ports_tex_texlive-bin/texlive-bin/work
> /texlive-source-2018.47642/texk/kpathsea/.libs/libkpathsea.dylib
> -framework ApplicationServices
> Undefined symbols for architecture x86_64:
> "XeTeXFontMgr::appendToList(std::__cxx11::list<std::__cxx11::basic_string<char,
> std::char_traits<char>, std::allocator<char> >,
> std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>,
> std::allocator<char> > > >*, char const*)", referenced from:
>       XeTeXFontMgr_Mac::appendNameToList(__CTFont const*,
> std::__cxx11::list<std::__cxx11::basic_string<char,
> std::char_traits<char>, std::allocator<char> >,
> std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>,
> std::allocator<char> > > >*, __CFString const*) in libxetex.a(libxetex_a-
> XeTeXFontMgr_Mac.o)
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
> }}}
>
> This looks to be occurring because we are trying to link in libgcc in
> ABI5 mode rather than ABI4 mode. In c++ files a flag is added
> automatically by the cxx11 PG to fix this, but this flag is not
> automatically added to the objective c++ flags (maybe should be?), so it
> errors out with an ABI mismatch.
>
> The solution is to add that ABI-forcing flag to the ObjectiveC++ build
> flags:
>
> {{{
> if {[string match *clang* ${configure.cxx}]} {
>     build.env-append        OBJCXXFLAGS="${configure.objcxxflags}
> [get_canonical_archflags objcxx] -D_GLIBCXX_USE_CXX11_ABI=0
> -stdlib=${configure.cxx_stdlib}"
> } else {
>     build.env-append        OBJCXXFLAGS="${configure.objcxxflags}
> [get_canonical_archflags objcxx]"
> }
> }}}
>
> and then the build succeeds:
> {{{
> $ port -v installed texlive-bin
> The following ports are currently installed:
>   texlive-bin @2018.47642_8+x11 (active) platform='darwin 11'
> archs='x86_64' date='2018-12-13T14:16:40-0800'
> }}}
>
> I don't think we should just add ` -D_GLIBCXX_USE_CXX11_ABI=0` to all
> builds. It's only useful when using libgcc. For our purposes, adding the
> flag if the `configure.cxx_stdlib` is not `libc++` would probably be the
> right test...

New description:

 On 10.7, 10.8, and I think likely all systems not configured to use
 libc++, we see:
 {{{
 libtool: link: /opt/local/bin/clang++-mp-5.0 -pipe -Os -std=c++11 -Wno-
 reserved-user-defined-literal -D_GLIBCXX_USE_CXX11_ABI=0 -stdlib=macports-
 libstdc++ -arch x86_64 -Wl,-headerpad_max_install_names -arch x86_64 -o
 .libs/xetex xetexdir/xetex-xetexextra.o synctexdir/xetex-synctex.o xetex-
 xetexini.o xetex-xetex0.o xetex-xetex-pool.o  -framework Cocoa libxetex.a
 -L/opt/local/lib /opt/local/lib/libharfbuzz-icu.dylib
 /opt/local/lib/libharfbuzz.dylib /opt/local/lib/libgraphite2.dylib
 -licui18n -licuuc -licudata -lpthread -lm
 /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports
 .org_macports_release_tarballs_ports_tex_texlive-bin/texlive-bin/work
 /texlive-source-2018.47642/libs/teckit/libTECkit.a
 /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports
 .org_macports_release_tarballs_ports_tex_texlive-bin/texlive-bin/work
 /texlive-source-2018.47642/libs/poppler/libpoppler.a
 /opt/local/lib/libpng16.dylib /opt/local/lib/libfreetype.dylib -lz
 libmd5.a lib/lib.a
 /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports
 .org_macports_release_tarballs_ports_tex_texlive-bin/texlive-bin/work
 /texlive-source-2018.47642/texk/kpathsea/.libs/libkpathsea.dylib
 -framework ApplicationServices
 Undefined symbols for architecture x86_64:
 "XeTeXFontMgr::appendToList(std::__cxx11::list<std::__cxx11::basic_string<char,
 std::char_traits<char>, std::allocator<char> >,
 std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>,
 std::allocator<char> > > >*, char const*)", referenced from:
       XeTeXFontMgr_Mac::appendNameToList(__CTFont const*,
 std::__cxx11::list<std::__cxx11::basic_string<char,
 std::char_traits<char>, std::allocator<char> >,
 std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>,
 std::allocator<char> > > >*, __CFString const*) in libxetex.a(libxetex_a-
 XeTeXFontMgr_Mac.o)
 ld: symbol(s) not found for architecture x86_64
 clang: error: linker command failed with exit code 1 (use -v to see
 invocation)
 }}}

 This looks to be occurring because we are trying to link in libgcc in ABI5
 mode rather than ABI4 mode. In c++ files a flag is added automatically by
 the cxx11 PG to fix this, but this flag is not automatically added to the
 objective c++ flags (maybe should be?), so it errors out with an ABI
 mismatch.

 The solution is to add that ABI-forcing flag to the ObjectiveC++ build
 flags:

 {{{
 if {[string match *clang* ${configure.cxx}]} {
     build.env-append        OBJCXXFLAGS="${configure.objcxxflags}
 [get_canonical_archflags objcxx] -D_GLIBCXX_USE_CXX11_ABI=0
 -stdlib=${configure.cxx_stdlib}"
 } else {
     build.env-append        OBJCXXFLAGS="${configure.objcxxflags}
 [get_canonical_archflags objcxx]"
 }
 }}}

 and then the build succeeds:
 {{{
 $ port -v installed texlive-bin
 The following ports are currently installed:
   texlive-bin @2018.47642_8+x11 (active) platform='darwin 11'
 archs='x86_64' date='2018-12-13T14:16:40-0800'
 }}}

 I don't think we should just add ` -D_GLIBCXX_USE_CXX11_ABI=0` to all
 builds. It's only useful when using libgcc. For our purposes, adding the
 flag if the `configure.cxx_stdlib` is not `libc++` would probably be the
 right test...

--

-- 
Ticket URL: <https://trac.macports.org/ticket/57774#comment:4>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list