I found the cause! Both glibc and gettext provide libintl.h. I was using libintl.h provided by gettext. Using libintl.h from glibc resolves this issue. I found this conflict confusing. A related issue, both Linux and glibc provide a directory include/scsi. I was using the one provided by Linux. Compiling libsanitizer in GCC requires include/scsi/scsi.h from glibc. The moral of this story appears to be, in case of conflict, use the version provided by glibc. Cheers, Shaun http://sjackman.ca On 2 September 2014 14:09, Shaun Jackman <sjackman@xxxxxxxxx> wrote: > This error occurs both with and without --with-included-gettext. Any > thoughts on a workaround and/or solution? Does it involve using > --with-boot-libs? > > Cheers, > Shaun > http://sjackman.ca > > > On 2 September 2014 13:41, Shaun Jackman <sjackman@xxxxxxxxx> wrote: >> I'm compiling GCC --with-sysroot. In stage 2, I'm seeing undefined >> reference to `libintl_textdomain' when linking cc1. I'm using >> --with-included-gettext (and --disable-nls) which may be related, or >> possibly causing this error. If I (warning, ugly hack) run `make >> ZLIB='-lz -lintl'` it successfully links. I would use >> HOST_LIBS=-lintl, but it has the side effect of using CC rather than >> CXX to link "so that the -lstdc++ library is not introduced", which is >> not desirable here. >> >> I'll try compiling without --with-included-gettext and see if that's >> the cause. See below for more detailed info. >> >> Cheers, >> Shaun >> >> http://sjackman.ca >> >> gcc 4.9.1 >> binutils 2.24 >> glibc 2.19 >> linux headers 3.15.9 >> >> The configure line is >> >> ../configure --with-sysroot=/home/sjackman/.linuxbrew >> --prefix=/Cellar/xgcc/4.9.1 >> --with-native-system-header-dir=/opt/xglibc/include >> --with-build-time-tools=/opt/xbinutils/bin >> --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-4.9 >> --with-gmp=/home/sjackman/.linuxbrew/opt/gmp >> --with-mpfr=/home/sjackman/.linuxbrew/opt/mpfr >> --with-mpc=/home/sjackman/.linuxbrew/opt/libmpc >> --with-cloog=/home/sjackman/.linuxbrew/opt/cloog >> --with-isl=/home/sjackman/.linuxbrew/opt/isl --with-system-zlib >> --enable-libstdcxx-time=yes --enable-stage1-checking >> --enable-checking=release --enable-lto --disable-werror >> '--with-pkgversion=Homebrew xgcc 4.9.1' --without-multilib >> --with-bugurl=https://github.com/Homebrew/homebrew/issues >> --enable-plugin --disable-nls --disable-multilib >> --with-included-gettext --with-boot-ldflags='-static-libstdc++ >> -static-libgcc -L/home/sjackman/.linuxbrew/lib >> -Wl,-rpath,/home/sjackman/.linuxbrew/lib >> -Wl,--dynamic-linker=/home/sjackman/.linuxbrew/opt/glibc/lib/ld-linux-x86-64.so.2' >> >> The error is >> >> /var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/build/./prev-gcc/xg++ >> -B/var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/build/./prev-gcc/ >> -B/Cellar/xgcc/4.9.1/x86_64-unknown-linux-gnu/bin/ -nostdinc++ >> -B/var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs >> -B/var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs >> -I/var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu >> -I/var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include >> -I/var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/libstdc++-v3/libsupc++ >> -L/var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs >> -L/var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs >> -c -DIN_GCC_FRONTEND -g -O2 -gtoggle -DIN_GCC -fno-exceptions >> -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing >> -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic >> -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings >> -DHAVE_CONFIG_H -I. -I. -I../../gcc -I../../gcc/. >> -I../../gcc/../include -I../../gcc/../libcpp/include >> -I/home/sjackman/.linuxbrew/opt/gmp/include >> -I/home/sjackman/.linuxbrew/opt/mpfr/include >> -I/home/sjackman/.linuxbrew/opt/libmpc/include >> -I../../gcc/../libdecnumber -I../../gcc/../libdecnumber/bid >> -I../libdecnumber -I../../gcc/../libbacktrace -DCLOOG_INT_GMP >> -I/home/sjackman/.linuxbrew/opt/cloog/include >> -I/home/sjackman/.linuxbrew/opt/isl/include >> -I/home/sjackman/.linuxbrew/opt/xglibc/include >> -I/home/sjackman/.linuxbrew/opt/xbinutils/include >> -isystem/home/sjackman/.linuxbrew/include -o cc1-checksum.o -MT >> cc1-checksum.o -MMD -MP -MF ./.deps/cc1-checksum.TPo cc1-checksum.c >> /var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/build/./prev-gcc/xg++ >> -B/var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/build/./prev-gcc/ >> -B/Cellar/xgcc/4.9.1/x86_64-unknown-linux-gnu/bin/ -nostdinc++ >> -B/var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs >> -B/var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs >> -I/var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu >> -I/var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include >> -I/var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/libstdc++-v3/libsupc++ >> -L/var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs >> -L/var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs >> -g -O2 -gtoggle -DIN_GCC -fno-exceptions -fno-rtti >> -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings >> -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long >> -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H >> -static-libstdc++ -static-libgcc >> -L/home/sjackman/.linuxbrew/opt/xglibc/lib >> -L/home/sjackman/.linuxbrew/opt/xbinutils/lib >> -L/home/sjackman/.linuxbrew/lib >> -Wl,-rpath,/home/sjackman/.linuxbrew/lib >> -Wl,--dynamic-linker=/home/sjackman/.linuxbrew/opt/glibc/lib/ld-linux-x86-64.so.2 >> -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-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-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 >> i386-c.o glibc-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 ../libbacktrace/.libs/libbacktrace.a >> ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a >> -L/home/sjackman/.linuxbrew/opt/cloog/lib -lcloog-isl >> -L/home/sjackman/.linuxbrew/opt/isl/lib -lisl >> -L/home/sjackman/.linuxbrew/opt/gmp/lib >> -L/home/sjackman/.linuxbrew/opt/mpfr/lib >> -L/home/sjackman/.linuxbrew/opt/libmpc/lib -lmpc -lmpfr -lgmp >> -rdynamic -ldl -lz >> /var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.a(locale-inst.o): >> In function `std::messages<char>::do_open(std::string const&, >> std::locale const&) const': >> locale-inst.cc:(.text._ZNKSt8messagesIcE7do_openERKSsRKSt6locale[_ZNKSt8messagesIcE7do_openERKSsRKSt6locale]+0x5): >> undefined reference to `libintl_textdomain' >> /var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.a(locale-inst.o): >> In function `std::messages<char>::open(std::string const&, std::locale >> const&, char const*) const': >> locale-inst.cc:(.text._ZNKSt8messagesIcE4openERKSsRKSt6localePKc[_ZNKSt8messagesIcE4openERKSsRKSt6localePKc]+0x19): >> undefined reference to `libintl_bindtextdomain' >> /var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.a(wlocale-inst.o): >> In function `std::messages<wchar_t>::do_open(std::string const&, >> std::locale const&) const': >> wlocale-inst.cc:(.text._ZNKSt8messagesIwE7do_openERKSsRKSt6locale[_ZNKSt8messagesIwE7do_openERKSsRKSt6locale]+0x5): >> undefined reference to `libintl_textdomain' >> /var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.a(wlocale-inst.o): >> In function `std::messages<wchar_t>::open(std::string const&, >> std::locale const&, char const*) const': >> wlocale-inst.cc:(.text._ZNKSt8messagesIwE4openERKSsRKSt6localePKc[_ZNKSt8messagesIwE4openERKSsRKSt6localePKc]+0x19): >> undefined reference to `libintl_bindtextdomain' >> /var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.a(messages_members.o): >> In function `std::messages<char>::do_get(int, int, int, std::string >> const&) const': >> messages_members.cc:(.text._ZNKSt8messagesIcE6do_getEiiiRKSs+0x25): >> undefined reference to `libintl_gettext' >> /var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs/libstdc++.a(messages_members.o): >> In function `std::messages<wchar_t>::do_get(int, int, int, >> std::basic_string<wchar_t, std::char_traits<wchar_t>, >> std::allocator<wchar_t> > const&) const': >> messages_members.cc:(.text._ZNKSt8messagesIwE6do_getEiiiRKSbIwSt11char_traitsIwESaIwEE+0x23): >> undefined reference to `libintl_gettext' >> collect2: error: ld returned 1 exit status >> ../../gcc/c/Make-lang.in:71: recipe for target 'cc1' failed >> make[3]: *** [cc1] Error 1 >> make[3]: Leaving directory '/var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/build/gcc' >> Makefile:4263: recipe for target 'all-stage2-gcc' failed >> make[2]: *** [all-stage2-gcc] Error 2 >> make[2]: Leaving directory '/var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/build' >> Makefile:19682: recipe for target 'stage2-bubble' failed >> make[1]: *** [stage2-bubble] Error 2 >> make[1]: Leaving directory '/var/tmp/sjackman/xgcc-y14685/gcc-4.9.1/build' >> Makefile:19885: recipe for target 'bootstrap' failed >> make: *** [bootstrap] Error 2