[MacPorts] #55135: gcc5 @5.5.0 fails to build on Snow Leopard, Mac OS X 10.6.8, because linker command failed with undefined symbols for architecture x86_64

MacPorts noreply at macports.org
Sun Oct 22 14:07:16 UTC 2017


#55135: gcc5 @5.5.0 fails to build on Snow Leopard, Mac OS X 10.6.8, because linker
command failed with undefined symbols for architecture x86_64
------------------------+-------------------------
  Reporter:  ballapete  |      Owner:
      Type:  defect     |     Status:  new
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:  2.4.2
Resolution:             |   Keywords:  snowleopard
      Port:  gcc5       |
------------------------+-------------------------

Comment (by kencu):

 Hmmm. Looks like gcc5 built through overnight and seems to work OK for me.
 {{{
 $ port -v installed gcc5
 The following ports are currently installed:
   gcc5 @5.5.0_0 (active) platform='darwin 10' archs='x86_64'
 date='2017-10-21T22:30:22-0700'
 }}}
 {{{
 $ gcc-mp-5 --version
 gcc-mp-5 (MacPorts gcc5 5.5.0_0) 5.5.0
 Copyright (C) 2015 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
 PURPOSE.
 }}}

 I notice on this failing link line there is no `-stdlib=libc++` set:

 {{{
 /opt/local/bin/clang++-mp-3.9 -arch x86_64   -g  -DIN_GCC    -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 tree-browser.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
 }}}

 by default then, clang-3.9 on your system would add `-stdlib=libstdc++`
 for you to link against, which is the wrong stdlib for you, and would
 generate the errors for the missing symbols that you see. As you know I
 have modified clang-3.9 on my systems to default to adding
 `-stdlib=libc++` if there is no standard lib set for exactly this reason,
 so that is most likely why my build succeeds and your build fails.

 So -- to get past this particular hiccup on your system (which is 10.6.8 /
 LibcxxOnOlderSystems), the first thing I would do is to try building gcc5
 with the following added to the portfile, to specify the standard lib
 explicitly:

 {{{
 configure.cxxflags-append  -stdlib=libc++
 configure.ldflags-append   -stdlib=libc++
 }}}


 If that fails, then remove those two lines from the portfile again, and
 try building gcc5 with the older default compiler that is installed:

 `sudo port -v install gcc5 configure.compiler=gcc-4.2`

 I know that goes against what we usually do with macports, but it should
 work in this specific case.

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


More information about the macports-tickets mailing list