http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52850
Bug #: 52850 Summary: Linker path ends up using wrong zlib Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: bootstrap AssignedTo: unassig...@gcc.gnu.org ReportedBy: sk...@iskunk.org Bootstrapping GCC on AIX fails with tg-gcc -mminimal-toc -g -fkeep-inline-functions -DIN_GCC -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wc++-compat -fno-common -DHAVE_CONFIG_H -Wl,-bmaxdata:0x40000000 -o cc1 c-lang.o c-family/stub-objc.o attribs.o c-errors.o c-decl.o c-typeck.o c-convert.o c-aux-info.o c-objc-common.o c-parser.o tree-mudflap.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 default-c.o rs6000-c.o \ cc1-checksum.o main.o tree-browser.o libbackend.a libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a -liconv ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -L/tg/freeport/arch/aix64/lib -L/tg/freeport/arch/aix64/lib -L/tg/freeport/arch/aix64/lib -lmpc -lmpfr -lgmp -L../zlib -lz ld: 0711-317 ERROR: Undefined symbol: .deflateInit_ ld: 0711-317 ERROR: Undefined symbol: .zError ld: 0711-317 ERROR: Undefined symbol: .deflate ld: 0711-317 ERROR: Undefined symbol: .deflateEnd ld: 0711-317 ERROR: Undefined symbol: .inflateInit_ ld: 0711-317 ERROR: Undefined symbol: .inflate ld: 0711-317 ERROR: Undefined symbol: .inflateEnd ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information. collect2: ld returned 8 exit status gmake[3]: *** [cc1] Error 1 gmake[3]: Leaving directory `/tmp/gcc-4.7.0-build/gcc' gmake[2]: *** [all-stage1-gcc] Error 2 gmake[2]: Leaving directory `/tmp/gcc-4.7.0-build' gmake[1]: *** [stage1-bubble] Error 2 gmake[1]: Leaving directory `/tmp/gcc-4.7.0-build' gmake: *** [bootstrap-lean] Error 2 The problem is that there is an unsuitable copy of libz installed under /tg/freeport/arch/aix64/lib (where suitable copies of gmp/mpfr/mpc are located), but since "-L../zlib -lz" is specified after "-L/tg/freeport/arch/aix64/lib", zlib is obtain from the latter location. Either "-L../zlib" should be specified prior to any user-supplied library paths, or the link invocation should specify the libz library file explicitly rather than use "-lz".