The Go compiler uses the -I option to find imported packages. It also supports -L options to find them, expecting -L options to be passed from the gccgo compiler driver. Because it expects -L to come from the driver, it searches VERSION and VERSION/MACHINE subdirectories first.
The in-tree build of the gotools directory was passing -L options to the in-tree libgo, but not -I options. The compiler driver also passes the default -L options. The effect of this was that if you installed libgo, and then did a build with the same prefix, the build of gotools would search the installed libgo before the in-tree one. That normally works fine, but PR 80814 reports a case where it didn't. Fix this by having gotools pass a -I option, as expected, pointing to the in-tree libgo. Bootstrapped on x86_64-pc-linux-gnu. Committed to mainline. Ian 2017-05-18 Ian Lance Taylor <i...@golang.org> PR go/80814 * Makefile.am (AM_GOCFLAGS): Define. * Makefile.in: Rebuild.
Index: Makefile.am =================================================================== --- Makefile.am (revision 247837) +++ Makefile.am (working copy) @@ -38,6 +38,7 @@ endif GOCFLAGS = $(CFLAGS_FOR_TARGET) GOCOMPILE = $(GOCOMPILER) $(GOCFLAGS) +AM_GOCFLAGS = -I $(libgodir) AM_LDFLAGS = -L $(libgodir) -L $(libgodir)/.libs GOLINK = $(GOCOMPILER) $(GOCFLAGS) $(AM_GOCFLAGS) $(LDFLAGS) $(AM_LDFLAGS) -o $@