https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78251
--- Comment #1 from Jack Howarth <howarth.at.gcc at gmail dot com> --- FYI, the only reason we never see the same breakage on fink as MacPorts is that we don't happen to have a libunwinder package in our package set to expose us to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=14925 We do however end up with the same contamination of CPPFLAGS late in the build (in our case with contamination by -I/sw/include). Also, in the case of --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib this process results in DIR being placed on CPPFLAGS instead of being keep on the INCLUDES lines of individual Makefile.in instead. My initial attempts to detangle this have been along the lines of... --- gcc/Makefile.in.orig 2016-11-08 03:29:02.000000000 -0500 +++ gcc/Makefile.in 2016-11-08 03:29:56.000000000 -0500 @@ -1063,7 +1063,7 @@ # currently being compiled, in both source trees, to be examined as well. # libintl.h will be found in ../intl if we are using the included libintl. INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \ - -I$(srcdir)/../include @INCINTL@ \ + -I$(srcdir)/../include @INCINTL@ ${INCICONV} \ $(CPPINC) $(GMPINC) $(DECNUMINC) $(BACKTRACEINC) \ $(ISLINC) --- libstdc++-v3/src/Makefile.in.orig 2016-11-08 02:14:37.000000000 -0500 +++ libstdc++-v3/src/Makefile.in 2016-11-08 02:15:15.000000000 -0500 @@ -126,7 +126,7 @@ @VTV_CYGMIN_TRUE@am_libvtv_la_OBJECTS = vtv_stubs.lo libvtv_la_OBJECTS = $(am_libvtv_la_OBJECTS) @VTV_CYGMIN_TRUE@am_libvtv_la_rpath = -rpath $(toolexeclibdir) -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -I${INCICONV} depcomp = am__depfiles_maybe = CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ --- libstdc++-v3/configure.orig 2016-11-08 02:00:42.000000000 -0500 +++ libstdc++-v3/configure 2016-11-08 02:10:25.000000000 -0500 @@ -28529,7 +28529,6 @@ am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no am_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $INCICONV" if test x$gcc_no_link = xyes; then as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 fi @@ -40804,7 +40803,6 @@ am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no am_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $INCICONV" if test x$gcc_no_link = xyes; then as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 fi @@ -46928,7 +46926,6 @@ am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no am_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $INCICONV" if test x$gcc_no_link = xyes; then as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 fi @@ -59755,7 +59752,6 @@ am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no am_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $INCICONV" if test x$gcc_no_link = xyes; then as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 fi --- libstdc++-v3/configure.orig 2016-11-08 02:33:18.000000000 -0500 +++ libstdc++-v3/configure 2016-11-08 02:34:41.000000000 -0500 @@ -28596,7 +28596,7 @@ if test "$am_cv_func_iconv" != yes; then am_save_CPPFLAGS="$CPPFLAGS" am_save_LIBS="$LIBS" - CPPFLAGS="$LIBS $INCICONV" + CPPFLAGS="$LIBS" LIBS="$LIBS $LIBICONV" if test x$gcc_no_link = xyes; then as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 @@ -40870,7 +40870,7 @@ if test "$am_cv_func_iconv" != yes; then am_save_CPPFLAGS="$CPPFLAGS" am_save_LIBS="$LIBS" - CPPFLAGS="$LIBS $INCICONV" + CPPFLAGS="$LIBS" LIBS="$LIBS $LIBICONV" if test x$gcc_no_link = xyes; then as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 @@ -46993,7 +46993,7 @@ if test "$am_cv_func_iconv" != yes; then am_save_CPPFLAGS="$CPPFLAGS" am_save_LIBS="$LIBS" - CPPFLAGS="$LIBS $INCICONV" + CPPFLAGS="$LIBS" LIBS="$LIBS $LIBICONV" if test x$gcc_no_link = xyes; then as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 @@ -59819,7 +59819,7 @@ if test "$am_cv_func_iconv" != yes; then am_save_CPPFLAGS="$CPPFLAGS" am_save_LIBS="$LIBS" - CPPFLAGS="$LIBS $INCICONV" + CPPFLAGS="$LIBS" LIBS="$LIBS $LIBICONV" if test x$gcc_no_link = xyes; then as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 --- gcc/configure.orig 2016-11-08 02:53:20.000000000 -0500 +++ gcc/configure 2016-11-08 02:56:53.000000000 -0500 @@ -10681,7 +10681,6 @@ am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no am_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $INCICONV" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> @@ -10743,7 +10742,7 @@ if test "$am_cv_func_iconv" != yes; then am_save_CPPFLAGS="$CPPFLAGS" am_save_LIBS="$LIBS" - CPPFLAGS="$LIBS $INCICONV" + CPPFLAGS="$LIBS" LIBS="$LIBS $LIBICONV" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ --- intl/Makefile.in.orig 2016-11-08 01:34:50.000000000 -0500 +++ intl/Makefile.in 2016-11-08 01:37:15.000000000 -0500 @@ -136,7 +136,7 @@ $(YACC) $(YFLAGS) --output $@ $< rm -f $*.h -INCLUDES = -I. -I$(srcdir) +INCLUDES = -I. -I$(srcdir) -I$(LIBICONV_INCLUDE) check: all --- intl/configure.orig 2016-11-08 01:34:58.000000000 -0500 +++ intl/configure 2016-11-08 01:35:49.000000000 -0500 @@ -4973,7 +4973,6 @@ am_save_CPPFLAGS="$CPPFLAGS" am_save_LIBS="$LIBS" if test -n "$LIBICONV_INCLUDE"; then - CPPFLAGS="$CPPFLAGS $LIBICONV_INCLUDE" LIBS="$LIBS $LIBICONV_LIBDIR" fi LIBS="$LIBS -liconv" which has been successful up until a failed linkage of... /usr/bin/clang++ -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 -Wl,-no_pie gcov-dump.o \ hash-table.o ggc-none.o\ libcommon.a ../libcpp/libcpp.a -liconv ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -o gcov-dump Undefined symbols for architecture x86_64: "_libiconv", referenced from: convert_using_iconv(void*, unsigned char const*, unsigned long, _cpp_strbuf*) in libcpp.a(charset.o) "_libiconv_close", referenced from: __cpp_destroy_iconv in libcpp.a(charset.o) __cpp_convert_input in libcpp.a(charset.o) "_libiconv_open", referenced from: init_iconv_desc(cpp_reader*, char const*, char const*) in libcpp.a(charset.o) ld: symbol(s) not found for architecture x86_64