Opened 7 years ago
Closed 6 years ago
#55410 closed defect (fixed)
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 "Pete" Dyballa) | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.4.2 |
Keywords: | Cc: | jeremyhu (Jeremy Huddleston Sequoia), ryandesign (Ryan Carsten 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 (2)
Change History (14)
Changed 7 years ago by ballapete (Peter "Pete" Dyballa)
Attachment: | main.log.gz added |
---|
comment:1 follow-up: 2 Changed 7 years ago by kencu (Ken)
comment:2 Changed 7 years ago by ballapete (Peter "Pete" 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 7 years ago by ryandesign (Ryan Carsten 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: 5 Changed 7 years 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 follow-up: 6 Changed 7 years ago by ryandesign (Ryan Carsten 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 Changed 7 years ago by ballapete (Peter "Pete" 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.)
Changed 7 years ago by chrisjogorman
Attachment: | main.log.2.gz added |
---|
comment:7 Changed 7 years ago by chrisjogorman
Found a new tester for you. I have the same problem Peter described but for gcc-7.3.0. I've attached my main.log as main.log.2.gz
/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 cc1 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 \ cc1-checksum.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a -liconv ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.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 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(char const*, std::allocator<char> const&)", referenced from: 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> >::~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> >::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: 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) 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::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)", referenced from: "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)", 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) 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::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string()", 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) chkp_build_instrumented_fndecl(tree_node*) in libbackend.a(ipa-chkp.o) "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()", referenced from: ld: symbol(s) not found for architecture x86_64 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> >::operator=(char const*)", referenced from: clang: error: linker command failed with exit code 1 (use -v to see invocation) make[3]: *** [lto1] Error 1 make[3]: *** Waiting for unfinished jobs.... 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::__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) "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) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[3]: *** [cc1] Error 1 rm gcc.pod make[3]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc7/gcc7/work/build/gcc' make[2]: *** [all-stage1-gcc] Error 2 make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc7/gcc7/work/build' make[1]: *** [stage1-bubble] Error 2 make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc7/gcc7/work/build' make: *** [bootstrap-lean] Error 2 make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc7/gcc7/work/build' Command failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc7/gcc7/work/build" && /usr/bin/make -j2 -w bootstrap-lean Exit code: 2 Error: Failed to build gcc7: command execution failed Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_lang_gcc7/gcc7/main.log for details. Error: Problem while installing gcc7 Error: Unable to execute port: upgrade arpack failed
comment:8 Changed 7 years ago by kencu (Ken)
I assume you also have 10.6.8 configured with cxx_stdlib libc++
and the default compiler is set to clang-3.9
in macports.conf.
If all that is true, I would go into macports.conf, temporarily disable the default compiler being clang-3.9 by commenting out that line, build gcc7 (which should complete without too much trouble with the standard 10.6.8 compilers if we are at all lucky) and once it is installed, then re-enable the default compiler as clang-3.9
in macports.conf.
(I don't see this error, but I have modified my version of clang-3.9 to behave as clang behaves on all the newer systems, adding -stdlib=libc++
to the link lines if no standard lib is specified, and I believe that is why I don't see it.)
comment:9 Changed 7 years ago by chrisjogorman
I will try what you suggest. I am currently trying the suggestion with libgcc6
as it appears to have failed at the linking stage due to the omission of -stdlib=libc++
with clang-3.9
. How did you modify your version of clang to pass the switch if it is omitted? (I would like to do as you do by passing the switch to clang-3.9
).
comment:10 Changed 7 years ago by kencu (Ken)
The following quite simple patch makes clang-3.9 work on 10.6.8 as it does on newer systems, adding stdlib=libc++
if there is none specified on the build or link line, which is what you want if you have your cxx_stdlib set to libc++. However, don't forget you have done this, as it changes default behaviour. For that reason I have it as a variant so I can see that I did that.
and this installation set is what I use:
<https://github.com/kencu/SnowLeopardPorts/tree/master/lang/llvm-3.9>
comment:11 Changed 6 years ago by kencu (Ken)
builds on the buildbots now without any troubles. <http://packages.macports.org/gcc7/gcc7-7.3.0_6.darwin_10.x86_64.tbz2>
comment:12 Changed 6 years ago by kencu (Ken)
Resolution: | → fixed |
---|---|
Status: | new → closed |
Is this system configured to libc++ with LibcxxOnOlderSystems?