Opened 3 months ago

Last modified 3 weeks ago

#55410 new defect

gcc7 @7.2.0 does not build on Mac OS X 10.6.8, Snow Leopard, because of "Undefined symbols for architecture x86_64"

Reported by: ballapete (Peter Dyballa) Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.4.2
Keywords: Cc: jeremyhu (Jeremy Huddleston Sequoia), ryandesign (Ryan Schmidt)
Port: gcc7

Description

After fftw-3 was built installed port decided to install GCC7. Is cxx_stdlib PortGroup missing? Or too much?

if [ -f ../stage_final ] \
	   && cmp -s ../stage_current ../stage_final; then \
	  cp ../prev-gcc/cc1-checksum.c cc1-checksum.c; \
	else \
	  build/genchecksum c/c-lang.o c-family/stub-objc.o attribs.o c/c-errors.o c/c-decl.o c/c-typeck.o c/c-convert.o c/c-aux-info.o c/c-objc-common.o c/c-parser.o c/c-array-notation.o c/c-fold.o c/gimple-parser.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-indentation.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o c-family/c-cilkplus.o c-family/array-notation-common.o c-family/cilk.o c-family/c-ubsan.o c-family/c-attribs.o c-family/c-warn.o i386-c.o darwin-c.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a ../libiberty/libiberty.a   ../libdecnumber/libdecnumber.a ../libbacktrace/.libs/libbacktrace.a \
                     checksum-options > cc1-checksum.c.tmp && 		 \
	  /opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_lang_gcc7/gcc7/work/gcc-7.2.0/gcc/../move-if-change cc1-checksum.c.tmp cc1-checksum.c; \
	fi
if [ -f ../stage_final ] \
	   && cmp -s ../stage_current ../stage_final; then \
	   cp ../prev-gcc/cc1plus-checksum.c cc1plus-checksum.c; \
	else \
	  build/genchecksum cp/cp-lang.o c-family/stub-objc.o cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o cp/class.o cp/decl2.o cp/error.o cp/lex.o cp/parser.o cp/ptree.o cp/rtti.o cp/typeck.o cp/cvt.o cp/except.o cp/friend.o cp/init.o cp/method.o cp/search.o cp/semantics.o cp/tree.o cp/repo.o cp/dump.o cp/optimize.o cp/mangle.o cp/cp-objcp-common.o cp/name-lookup.o cp/cxx-pretty-print.o cp/cp-cilkplus.o cp/cp-gimplify.o cp/cp-array-notation.o cp/lambda.o cp/vtable-class-hierarchy.o cp/constexpr.o cp/cp-ubsan.o cp/constraint.o cp/logic.o attribs.o incpath.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-indentation.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o c-family/c-cilkplus.o c-family/array-notation-common.o c-family/cilk.o c-family/c-ubsan.o c-family/c-attribs.o c-family/c-warn.o i386-c.o darwin-c.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a ../libiberty/libiberty.a   ../libdecnumber/libdecnumber.a ../libbacktrace/.libs/libbacktrace.a \
                     checksum-options > cc1plus-checksum.c.tmp &&	   \
	  /opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_lang_gcc7/gcc7/work/gcc-7.2.0/gcc/../move-if-change cc1plus-checksum.c.tmp cc1plus-checksum.c; \
	fi
/opt/local/bin/clang++-mp-3.9 -arch x86_64 -std=gnu++98    -g  -DIN_GCC    -fno-strict-aliasing -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -L/opt/local/lib -Wl,-headerpad_max_install_names -o lto1 \
		lto/lto-lang.o lto/lto.o lto/lto-object.o attribs.o lto/lto-partition.o lto/lto-symtab.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a -L/opt/local/lib -lisl -L/opt/local/lib -L/opt/local/lib -L/opt/local/lib -lmpc -lmpfr -lgmp   -lz libcommon.a ../libcpp/libcpp.a  -liconv ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a 
Undefined symbols for architecture x86_64:
  "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::c_str() const", referenced from:
      chkp_build_instrumented_fndecl(tree_node*) in libbackend.a(ipa-chkp.o)
      chkp_add_bounds_params_to_function(tree_node*) in libbackend.a(ipa-chkp.o)
  "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()", referenced from:
      chkp_build_instrumented_fndecl(tree_node*) in libbackend.a(ipa-chkp.o)
      chkp_add_bounds_params_to_function(tree_node*) in libbackend.a(ipa-chkp.o)
  "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string()", referenced from:
      chkp_build_instrumented_fndecl(tree_node*) in libbackend.a(ipa-chkp.o)
  "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator=(char const*)", referenced from:
      chkp_build_instrumented_fndecl(tree_node*) in libbackend.a(ipa-chkp.o)
  "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator+=(char const*)", referenced from:
      chkp_build_instrumented_fndecl(tree_node*) in libbackend.a(ipa-chkp.o)
      chkp_add_bounds_params_to_function(tree_node*) in libbackend.a(ipa-chkp.o)
  "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)", referenced from:
      chkp_add_bounds_params_to_function(tree_node*) in libbackend.a(ipa-chkp.o)
  "std::__detail::_List_node_base::_M_unhook()", referenced from:
      std::__cxx11::list<ipa_icf::congruence_class*, std::allocator<ipa_icf::congruence_class*> >::_M_erase(std::_List_iterator<ipa_icf::congruence_class*>) in libbackend.a(ipa-icf.o)
  "std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)", referenced from:
      std::__cxx11::list<ipa_icf::congruence_class*, std::allocator<ipa_icf::congruence_class*> >::_M_insert(std::_List_iterator<ipa_icf::congruence_class*>, ipa_icf::congruence_class* const&) in libbackend.a(ipa-icf.o)
ld: symbol(s) not found for architecture x86_64

Attachments (1)

main.log.gz (774.2 KB) - added by ballapete (Peter Dyballa) 3 months ago.

Download all attachments as: .zip

Change History (7)

Changed 3 months ago by ballapete (Peter Dyballa)

comment:1 follow-up: Changed 3 months ago by kencu (Ken)

Is this system configured to libc++ with LibcxxOnOlderSystems?

comment:2 in reply to: ↑ 1 Changed 3 months ago by ballapete (Peter Dyballa)

Replying to kencu:

Is this system configured to libc++ with LibcxxOnOlderSystems?

/opt/local/etc/macports/macports.conf contains cxx_stdlib libc++.

comment:3 Changed 3 weeks ago by ryandesign (Ryan Schmidt)

  • Cc jeremyhu ryandesign added
  • Keywords snowleopard removed

The compile line you showed that invokes clang++-mp-3.9 clearly doesn't contain -stdlib=libc++, which is why it failed. But the -stdlib flag was deliberately removed from all gcc ports in [89d05e8e171da75f86ac27a575eedf1bef0e8818/macports-ports]. Jeremy, any advice on how this issue can be addressed?

comment:4 follow-up: Changed 3 weeks ago by kencu (Ken)

tricky. usually the defaults would work, but not in this case as libc++ is not the default for clang-3.9 on 10.6.8. So it adds libstdc++, and that errors out... kind of a unique situation.

Would have to strip out the -stdlib flab only if the bootstrap compiler is not clang.

There is another way -- as you may recall, I have altered clang-3.9 on my 10.6.8 system to default to add -stdlib=libc++ if no -stdlib is present, so I would not see this error.

comment:5 in reply to: ↑ 4 ; follow-up: Changed 3 weeks ago by ryandesign (Ryan Schmidt)

Replying to ryandesign:

The compile line you showed that invokes clang++-mp-3.9 clearly doesn't contain -stdlib=libc++, which is why it failed.

At least I assumed that was why it failed. But that would only make sense if it was trying to link with a dependency's library which used C++, and I can't see any of gcc's dependencies that use C++. So maybe it's failing for a different reason. Please try gcc7 @7.3.0 and if it still fails please attach a new log.

Replying to kencu:

Would have to strip out the -stdlib flab only if the bootstrap compiler is not clang.

MacPorts base only adds -stdlib in the first place if the compiler is clang. See proc portconfigure::should_add_stdlib in macports-base/src/port1.0/portconfigure.tcl.

comment:6 in reply to: ↑ 5 Changed 3 weeks ago by ballapete (Peter Dyballa)

Replying to ryandesign:

At least I assumed that was why it failed. But that would only make sense if it was trying to link with a dependency's library which used C++, and I can't see any of gcc's dependencies that use C++. So maybe it's failing for a different reason. Please try gcc7 @7.3.0 and if it still fails please attach a new log.

Sorry, I can't test anymore, I upgraded to El Capitan, OS X 10.11.6. (And might continue upgrading to High Sierra.)

Note: See TracTickets for help on using tickets.