Opened 6 years ago

Last modified 6 years ago

#57774 closed defect

texlive-bin @2018.47642_8 : error: Undefined symbols for architecture x86_64 — at Initial Version

Reported by: kencu (Ken) Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: drkp (Dan Ports)
Port: texlive-bin

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 if 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 is the configure.cxx_stdlib is not libc++ would probably be the right test...

Change History (0)

Note: See TracTickets for help on using tickets.