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 Version 4

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

Description (last modified by kencu (Ken))

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

Change History (5)

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

Description: modified (diff)

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

OK. Those flags are already in the PG:

            configure.objcxxflags-delete -D_GLIBCXX_USE_CXX11_ABI=0
            configure.objcxxflags-append -D_GLIBCXX_USE_CXX11_ABI=0

so now I'm a touch confused. Why weren't they used in the build line...?

/opt/local/bin/clang++-mp-5.0 -DHAVE_CONFIG_H -I. -I./w2c  -I/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 -I/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 -I./xetexdir -I/opt/local/include  -I/opt/local/include/freetype2 -I/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/include -I/opt/local/include/harfbuzz -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include  -I/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/include -I/opt/local/include/libpng16  -I./libmd5 -DXETEX_MAC  -isystem/opt/local/include  -Os -stdlib=macports-libstdc++ -arch x86_64 -stdlib=macports-libstdc++ -std=c++11 -MT xetexdir/libxetex_a-XeTeXFontMgr_Mac.o -MD -MP -MF xetexdir/.deps/libxetex_a-XeTeXFontMgr_Mac.Tpo -c -o xetexdir/libxetex_a-XeTeXFontMgr_Mac.o `test -f 'xetexdir/XeTeXFontMgr_Mac.mm' || echo './'`xetexdir/XeTeXFontMgr_Mac.mm

When I add the flag manually to the Portfile, it does make it onto the build line (and then the build succeeds):

/opt/local/bin/clang++-mp-5.0 -DHAVE_CONFIG_H -I. -I./w2c  -I/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 -I/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 -I./xetexdir -I/opt/local/include  -I/opt/local/include/freetype2 -I/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/include -I/opt/local/include/harfbuzz -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include  -I/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/include -I/opt/local/include/libpng16  -I./libmd5 -DXETEX_MAC  -isystem/opt/local/include  -Os -stdlib=macports-libstdc++ -arch x86_64 -D_GLIBCXX_USE_CXX11_ABI=0 -stdlib=macports-libstdc++ -std=c++11 -MT xetexdir/libxetex_a-XeTeXFontMgr_Mac.o -MD -MP -MF xetexdir/.deps/libxetex_a-XeTeXFontMgr_Mac.Tpo -c -o xetexdir/libxetex_a-XeTeXFontMgr_Mac.o `test -f 'xetexdir/XeTeXFontMgr_Mac.mm' || echo './'`xetexdir/XeTeXFontMgr_Mac.mm
Last edited 6 years ago by kencu (Ken) (previous) (diff)

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

The OBJCXXFLAGS are not apparently seeing the -D_GLIBCXX_USE_CXX11_ABI=0 that is being added by the cxx11 PG, although the CXXFLAGS are seeing it:

configure: running /bin/sh ./configure --disable-option-checking '--prefix=/opt/local'  '--bindir=/opt/local/libexec/texlive/binaries' '--mandir=/opt/local/libexec/texlive/binaries' '--infodir=/opt/local/share/info' '--enable-shared' '--disable-multiplatform' '--disable-native-texlive-build' '--without-old-mac-fonts' '--with-banner-add=/MacPorts 2018.47642_8' '--with-system-freetype2' '--without-system-freetype' '--without-system-icu' '--with-system-cairo' '--with-system-gd' '--with-system-gmp' '--with-system-graphite2' '--with-system-harfbuzz' '--with-system-icu' '--with-system-libpaper' '--with-libpaper-includes=/opt/local/include' '--with-libpaper-libdir=/opt/local/lib' '--with-system-libpng' '--with-libpng-includes=/opt/local/include' '--with-libpng-libdir=/opt/local/lib' '--with-system-mpfr' '--with-system-ncurses' '--with-system-pixman' '--without-system-poppler' '--with-system-potrace' '--without-system-xpdf' '--with-system-zlib' '--with-system-zziplib' '--disable-biber' '--disable-etex' '--disable-detex' '--disable-dvi2tty' '--disable-dvipng' '--disable-dvisvgm' '--disable-lcdf-typetools' '--disable-ps2eps' '--disable-psutils' '--disable-t1utils' '--disable-texinfo' '--disable-xindy' '--enable-build-in-source-tree' 'ac_cv_prog_AWK=/usr/bin/awk' '--with-xdvi-x-toolkit=xaw' 'CC=/opt/local/bin/clang-mp-5.0' 'CFLAGS=-pipe -Os -arch x86_64' 'LDFLAGS=-Wl,-headerpad_max_install_names -arch x86_64' 'CPPFLAGS=-isystem/opt/local/include' 'CXX=/opt/local/bin/clang++-mp-5.0' 'CXXFLAGS=-pipe -Os -std=c++11 -Wno-reserved-user-defined-literal -D_GLIBCXX_USE_CXX11_ABI=0 -stdlib=macports-libstdc++ -arch x86_64' '--enable-largefile' '--disable-silent-rules' '--enable-cxx-runtime-hack=no' '--enable-libtool-hack=yes' '--enable-texlive-build' '--with-x' '--enable-autosp=yes' '--enable-axodraw2=yes' '--enable-devnag=yes' '--enable-lacheck=yes' '--enable-m-tx=yes' '--enable-pmx=yes' '--enable-texdoctk=yes' '--enable-tpic2pdftex=yes' '--enable-vlna=yes' '--with-clisp-runtime=system' '--enable-xpdfopen=yes' '--enable-web2c=yes' '--enable-afm2pl=yes' '--enable-bibtex-x=yes' '--enable-chktex=yes' '--enable-cjkutils=yes' '--enable-dtl=yes' '--enable-dvidvi=yes' '--enable-dviljk=yes' '--enable-dvipdfm-x=yes' '--enable-dvipos=yes' '--enable-dvipsk=yes' '--enable-gregorio=yes' '--enable-gsftopk=yes' '--enable-makeindexk=yes' '--enable-makejvf=yes' '--enable-mendexk=yes' '--enable-musixtnt=yes' '--enable-ps2pk=yes' '--enable-seetexk=yes' '--enable-tex4htk=yes' '--enable-ttf2pk2=yes' '--enable-ttfdump=yes' '--enable-upmendex=yes' '--enable-xdvik=yes' '--enable-texlive=yes' '--with-system-teckit=no' '--with-system-ptexenc=no' '--with-system-kpathsea=no' 'OBJCXX=/opt/local/bin/clang++-mp-5.0' 'OBJCXXFLAGS=-Os -stdlib=macports-libstdc++ -arch x86_64 -stdlib=macports-libstdc++' --cache-file=/dev/null --srcdir=.

Changed 6 years ago by kencu (Ken)

log from failed build on 10.8

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

Description: modified (diff)
Note: See TracTickets for help on using tickets.